Ability to configure portal links when adding Docker yaml

Problem/Justification
There is no way to add portal links when adding apps via YAML file.

Impact
It would be nice to have portal buttons when apps are configured via YAML file.

User Story
I like the YAML configuration very much because I deploy and change apps much faster as when using the wizard and I can also group apps with dependencies together. Because of this I would like to migrate all my apps to YAML but I would also like to keep the portal link buttons for each application.

The rendered TrueNAS apps have a “web-portal” clause (iirc) in their yaml.

Have you tried adding that to your yaml?

Do you mean the x-portals entry in the Yaml? Yes I’ve tried that by adding this line:

x-portals: [{“host”: “0.0.0.0”, “name”: “Web UI”, “path”: “/”, “port”: 9080, “scheme”: “http”}]

When opening the Yaml again I can see this:

x-portals:

  • host: 0.0.0.0
    name: Web UI
    path: /
    port: 9080
    scheme: http

But sadly there is still no portal link visible.

I also tried what happens if I add the x-notes entry, but notes also do not appear in the Web UI.

2 Likes

I also tried adding the entry with portal instead of x-portal. This results in an error on the log:

[2024/11/01 12:25:56] (ERROR) app_lifecycle.compose_action():56 - Failed ‘down’ action for ‘mediaservers’ app: validating /mnt/.ix-apps/app_configs/mediaservers/versions/1.0.0/templates/rendered/docker-compose.yaml: (root) Additional property portals is not allowed

1 Like

I just found out that it works if the x-portal entry is added when creating the new app. If it is added afterwards when editing the app it does not work.

I was also able to add an icon to the custom apps by directly editing the metadata.yaml. You just have to edit and save the app again and then the icon appears.

3 Likes

Sorry if there are any errors because I use Google Translate (I speak French).

Hello, I am very interested in what you have managed to do. Can you publish as an example a yaml code for jellyfin with WEBUI portal and adding an icon. This is much clearer I think. Thanks in advance

Hi, it’s very easy. Just create the JellyFin app via basic YAML as a custom app like this:

services:
  jellyfin:
    environment:
      TZ: TIMEZONE
    healthcheck:
      disable: True
    image: jellyfin/jellyfin:latest
    restart: always
    volumes:
      - HOSTPATH/cache:/cache
      - HOSTPATH/config:/config
      - HOSTPATH/media:/media
x-portals:
  - host: HOSTIP
    name: Jellyfin
    path: /
    port: 8096
    scheme: http

After creating the app edit the /mnt/.ix-apps/app_configs/jellyfin/metadata.yaml file in the Truenas Shell (File is not shared) and add the icon line like this:

custom_app: true
human_version: 1.0.0_custom
metadata:
  app_version: custom
  capabilities: []
  description: This is a custom app where user can use his/her own docker compose
    file for deploying services
  home: ''
  host_mounts: []
  icon: https://static-00.iconduck.com/assets.00/jellyfin-icon-2048x2048-tf5ztk6m.png
  maintainers: []
  name: custom-app
  run_as_context: []
  sources: []
  title: Custom App
  train: stable
  version: 1.0.0
migrated: false
notes: null
portals:
  Jellyfin: http://HOSTIP:8096/
version: 1.0.0

Just replace TIMEZONE, HOSTPATH and HOSTIP for your country and system. After that save the app in the UI again and the icon should show up.

2 Likes

Hello, thank you for your response. I did as you explained and it is OK for the web portal. But the icon does not appear unfortunately. I have rebooted container and PC but without success.



No luck with adding icon or portal to a custom app (MeTube)

root@truenas:/mnt/.ix-apps/app_configs/metube# cat metadata.yaml 
custom_app: true
human_version: 1.0.0_custom
metadata:
  app_version: custom
  capabilities: []
  description: This is a custom app where user can use his/her own docker compose
    file for deploying services
  home: ''
  host_mounts: []
  maintainers: []
  name: custom-app
  run_as_context: []
  sources: []
  title: Custom App
  train: stable
  version: 1.0.0
  icon: https://media.sys.truenas.net/apps/metube/icons/icon.svg
migrated: false
notes: null
portals:
  Web UI: http://0.0.0.0:30094/
version: 1.0.0`Preformatted text`

No luck with the server’s 192.168.2 IP either.

Well, a week later, logged into Scale to check for app updates… both the icon I added and the web ui button showed up.

Update:

I was switching out how some of my custom compose apps and replacing one of the community ones, when I did the install of the first one, icons & web ui showed up for the previous one(s). But the last app I migrated did not.

Must be something to do with middlewared refreshing after an app update/deletion/change/creation?

Thank you all for this thread. :purple_heart:

I kept digging - and it looks as if the middlewared flow is as follows:

  • Initialization of app (enter the compose YAML syntax)
  • Create:
    • /mnt/.ix-apps/app_config/<app-name> structure:
      • metadata.yml
      • versions
        • 1.0.0
          • README.md
          • app.yaml
          • user_config.yaml
  • Update:
    • /mnt/.ix-apps/metadata.yaml
    • /mnt/.ix-apps/user_config.yaml

Then, when it’s time to render, it reads /mnt/.ix-apps/metadata.yaml and generates the Web UI.

Saving changes to notes, portals and/or metadata -> icon in the /mnt/.ix-apps/metadata.yaml and then refreshing the browser page, the changes appear immediately.

I started with the following test app, hoping it will show up in the UI:

services:
  a-link:
    healthcheck:
      disable: True
    image: tianon/sleeping-beauty
    restart: unless-stopped
x-portals:
  - name: Open
    host: example.com
   #port: <optional port #>
    path: /
    schema: https
x-metadata:
  icon: https://media.sys.truenas.net/apps/storj/icons/icon.svg
x-notes: &|
  # Link
  
  some description
 

This didn’t show up. I then manually entered into /mnt/.ix-apps/metadata.yaml the missing entries (making sure to remove the x- prefix), refreshed and got the UI I was expecting.

It looks like user_config.yaml files are the raw input, and metadata.yaml is the ‘middlwared ready data’ version of it, unsure when user_config.yaml is parsed though. Clearly, re-editing the yaml in the UI doesn’t affect the metadata.

I’ll keep playing with this, and if I find anything interesting - I’ll share.

1 Like