From 14311cee2183bbcc885574e0bdab645167ed01c9 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 3 Dec 2026 15:37:21 -0700 Subject: [PATCH] Keep Superpanel's dashboard current: link, docs and updates The service file gets URL="https://.$DOMAIN/", as Federated's apps on their own hostnames do. Apps from a repository without docs link to it. Updates remake Superpanel's applist and catalog, as removes do, so a new title or icon shows. Co-Authored-By: Claude Opus 5.5 --- PLAN.md | 22 ++++++++++++++++++---- TEST.md | 8 +++++++- core/coreapps | 22 +++++++++++++++------- core/templates/service | 2 ++ skills/coreapp/SKILL.md | 2 +- templates/app/coreapp.toml | 2 ++ 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/PLAN.md b/PLAN.md index 2c7f168..6d385e0 100644 --- a/PLAN.md +++ b/PLAN.md @@ -386,10 +386,24 @@ Their points, and where coreapp-dev stands: Federated what Superpanel needs later - Internal IPs in 192.168.5.0/24: done -Superpanel lists our apps in its catalog (`catalog.json`) but not in its -installed-apps list (`applist.json`, made by -`superpanel-generate-applist-dashboard`), so they probably don't show on -its dashboard or in "Disk Usage by App". [ ] Find out why +Superpanel's dashboard tiles come from `applist.json` +(`superpanel-generate-applist-dashboard`: every folder in +`/federated/apps` with a `services//service`), which `installapp`, +`uninstallapp` and `upgrade` make. Our apps are in it (checked 2026-12-03; +the earlier "not in applist" was wrong or from before installapp ran it). +Done 2026-12-03: +- Updates didn't remake it (or the catalog), so a new title, description + or icon didn't show: coreapps now remakes both after an update, as + after a remove +- The tile's link: without `URL` in `service`, Superpanel makes one from + the app (its binary is stripped, so how isn't known; hyphenated names + like `memo-board` were at risk). Our `service` now has + `URL="https://.$DOMAIN/"`, as Federated's castopod, docuseal and + wordpress do +- Without `docs`, the tile links a search of Federated's documentation; + apps installed from a repository now default to the repository +- [ ] Look at the dashboard signed in as an admin: the tiles' links and + icons, and "Disk Usage by App" ### The installer in /federated/bin/coreapps/ (wanted, 2026-12-03) diff --git a/TEST.md b/TEST.md index d1ec738..07abc6f 100644 --- a/TEST.md +++ b/TEST.md @@ -231,7 +231,13 @@ The Core's own scripts trace secrets, so their output goes to port, the new tag is gone from `docker image ls`, and `coreapp_hello` isn't in PostgreSQL. With the same `version` (and `port = 9999`): "Rolled back hello's settings. It's the same image tag as before". -11. On a Core whose tier isn't enterprise, deploying a new app asks before +11. Superpanel: after deploy, `/federated/apps/superpanel/data/applist.json` + (the dashboard) and `catalog.json` have the app; `service` has + `URL="https://hello.$DOMAIN/"` and applist the same `url`. Change + `title`, raise `version`, deploy: both files have the new title. After + `coreapp remove`, neither has it. An app installed from a repository + with no `docs` has `DOCS=` in `service` and applist. +12. On a Core whose tier isn't enterprise, deploying a new app asks before it's recorded as an add-on; answering no deploys nothing. ### With a database diff --git a/core/coreapps b/core/coreapps index 104c13f..95dd788 100755 --- a/core/coreapps +++ b/core/coreapps @@ -576,7 +576,8 @@ def make_service_folder(m, p, source, origin): """/federated/services// in the Core's generic format, from m.""" values = { "NAME": m["name"], "TITLE": m["title"], "DESCRIPTION": m["description"], - "DOCS": m["docs"], "IMAGE": m["image"], "VERSION": m["version"], + # Without docs, Superpanel links a search of Federated's documentation + "DOCS": m["docs"] or (origin["source"] if origin else ""), "IMAGE": m["image"], "VERSION": m["version"], "IP": p["address"], "PORT": str(m["port"]), "DBNAME": m["dbname"], "DEPENDS": " ".join(read_text(NEEDS_DIR, n, "depends").strip() for n in m["needs"]), } @@ -782,6 +783,8 @@ def install_app(m, p, folder, origin, addon_ok, recreate): check_needs(m) if p["state"] == "update": remove_old_images(m) + # Its title, description, icon or link may have changed + refresh_superpanel(log) say(f"{'Installed' if p['state'] == 'new' else 'Updated'}: {p['url']}") return 0 @@ -961,16 +964,21 @@ def remove(name): if image: remove_images(image) # uninstallapp made superpanel's catalog while the folder was still - # there, so it would still offer the app: make it again, as installapp - # does - if os.path.exists(APPS + "/superpanel/.env"): - run_logged([FEDERATED + "/bin/superpanel-generate-catalog"], log, - "Updating superpanel's app catalog failed") - run(["docker", "exec", "superpanel", "pkill", "-HUP", "superpanel"]) + # there, so it would still offer the app: make it again + refresh_superpanel(log) say(f"Removed {name}.") return 0 +def refresh_superpanel(log): + """Superpanel's lists of installed apps (its dashboard) and of apps it + offers, as installapp and uninstallapp make them.""" + if os.path.exists(APPS + "/superpanel/.env"): + for script in ("superpanel-generate-applist-dashboard", "superpanel-generate-catalog"): + run_logged([f"{FEDERATED}/bin/{script}"], log, f"{script} failed") + run(["docker", "exec", "superpanel", "pkill", "-HUP", "superpanel"]) + + def list_apps(): rows = [] for name in sorted(os.listdir(SERVICES)): diff --git a/core/templates/service b/core/templates/service index e9d81b6..2ec94c9 100644 --- a/core/templates/service +++ b/core/templates/service @@ -6,3 +6,5 @@ VERSION={{VERSION}} INTERNAL_IP={{IP}} DEPENDS="{{DEPENDS}}" PORTS={{PORT}} +# Superpanel's dashboard link, as Federated's apps give it (with $DOMAIN) +URL="https://{{NAME}}.$DOMAIN/" diff --git a/skills/coreapp/SKILL.md b/skills/coreapp/SKILL.md index 21d515a..8198d05 100644 --- a/skills/coreapp/SKILL.md +++ b/skills/coreapp/SKILL.md @@ -62,7 +62,7 @@ What the Core gives every app: name = "my-app" # id and hostname: https://my-app. title = "My App" # shown in the Core's dashboard description = "What it does, in a sentence" -docs = "https://example.com/docs" # optional +docs = "https://example.com/docs" # optional; installed from a repository, defaults to it image = "localhost/coreapp/my-app" # image name; the Core runs image:version version = "0.1.0" # the image tag; raise it for each release port = 8080 # the port the app serves HTTP on (any; 8080 is usual) diff --git a/templates/app/coreapp.toml b/templates/app/coreapp.toml index 7b1bc4e..4f5e282 100644 --- a/templates/app/coreapp.toml +++ b/templates/app/coreapp.toml @@ -6,6 +6,8 @@ name = "{{NAME}}" title = "{{TITLE}}" description = "{{TITLE}}, made with coreapp-dev" +# Its documentation, linked from the Core's dashboard (installed from a +# repository, it defaults to the repository) # docs = "https://..." # The image, as image:version. localhost/... images only exist where