Add the coreapp skill; fix /data ownership; deploy --recreate, shell <cmd>

skills/coreapp/SKILL.md teaches a Claude Code agent to make or port an
app for Federated Core: coreapp.toml, the needs, porting an existing app,
the deploy and test loop, troubleshooting, what isn't supported yet and
how to report back. update.sh links it into ~/.claude/skills/coreapp;
uninstall.sh removes the link. Rehearsed with a small app (memo-board)
ported by a fresh agent using only the skill.

The installer now gives /data to the image's user before starting the
container: Docker created it as root, so non-root apps couldn't write.
coreapp deploy --recreate always starts a new container (to test that
data survives); coreapp shell '<command>' runs one command without a
terminal.

PLAN.md: what would change on the Core to put the installer in
/federated/bin/coreapps/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 13:50:10 -07:00
co-authored by Claude Opus 5.5
parent b4d47fb1c5
commit fdb57d260d
8 changed files with 464 additions and 24 deletions
+74 -3
View File
@@ -157,6 +157,9 @@ What we learned:
reaches `https://authelia.<domain>` through traefik (`extra_hosts` to
traefik's address; Federated's apps use the public IP, which here would
loop out through the relay)
- `/data` is a bind mount Docker creates as root, so an app running as
another user couldn't write there. The installer gives it to the image's
user (`Config.User`, resolved with `id` in the image if it's a name)
- Image names must include the registry: `coreapp/x` means Docker Hub, so a
Core that had to pull it (after its boot-time prune, say) would get
whatever is published there. Dev images are `localhost/coreapp/<name>`,
@@ -220,9 +223,12 @@ Steps:
image). Show the source and what the app needs before installing
4. [ ] Email and AI needs (findings below), then other services: PowerDNS
records beyond the wildcard, if an app needs other hostnames
5. [ ] The skill: a Claude Code skill in coreapp-dev (installed by
`update.sh`) that teaches `coreapp.toml`, the needs, the `coreapp`
commands and testing against the VM
5. The skill (moved ahead of 2-4, 2026-12-03): `skills/coreapp/SKILL.md`,
linked into `~/.claude/skills/coreapp` by `update.sh`, so any Claude Code
agent on this computer can use it. Rehearsed with a small app
(`memo-board`)
- [ ] Test it with David's candidate app: an agent in that repository
uses the skill; what it struggles with becomes fixes
6. [ ] The Coreapps screen in Superpanel (Federated's code: needs their
agreement). Until then, the installer could run as a small web app behind
Authelia, for admins only
@@ -235,6 +241,71 @@ Later:
Superpanel for others
- [ ] Monitoring for published apps (dev apps aren't registered)
### The installer in /federated/bin/coreapps/ (wanted, 2026-12-03)
David wants the installer on the Core in `/federated/bin/coreapps/`
instead of `/opt/coreapps`. What may need to change on the Core, for
Federated (checked on dev.fedcom.net):
1. **It has to come from the Core repo.** `/federated` is a git checkout
that `upgrade` pulls nightly. An untracked `bin/coreapps/` survives pulls
until the repo gets files of the same name; then `git pull` refuses, and
the upgrade fails (`bin/upgrade` already has a workaround for exactly
this with `bin/sync-calcomusers`). So Federated commits `bin/coreapps/`
to the Core repo, and Cores get it and its updates through `upgrade`
2. **coreapp-dev stops copying it there.** `coreapp deploy` replaces
`/opt/coreapps` on every deploy. Doing that in `/federated/bin/coreapps/`
would modify tracked files and break the next `git pull` the same way.
Instead coreapp-dev would use the Core's copy, and keep `/opt/coreapps`
only as an override for testing installer changes
3. **Layout.** Everything else in `/federated/bin` is a single executable
that Federated's scripts call by full path. A folder there means the
command is `/federated/bin/coreapps/coreapps`. Alternatives: the
command as `/federated/bin/coreapps` with its templates and needs in
`/federated/lib/coreapps/` (where Federated keeps shared files), or a
wrapper. Decide with Federated
4. **Python.** The installer needs Python 3.11 or newer (`tomllib`); the
Core's scripts are otherwise bash. The image has 3.14 today; Federated
would have to keep python3 in the image
5. **Superpanel has to run it as root on the host.** Superpanel runs
`installapp`/`uninstallapp` already (strings in its binary) but its
container only mounts `/federated/lib` (read-only), `/federated/apps`,
`/federated/logs` and the Docker socket, not `/federated/bin` or
`/federated/services`. How it reaches the host now is still to find out.
The Coreapps screen would call `coreapps plan`, `install`, `remove` and
`list` the same way
6. **Where the apps' files go.** The installer writes
`/federated/services/<name>/` (untracked, like the test apps now show in
`git status`). It works, and Superpanel's catalog and
`installapp`/`uninstallapp` find them there, but they're untracked files
in Federated's checkout. Federated may prefer a separate folder (e.g.
`/federated/coreapps/<name>/`) with `installapp`, `uninstallapp` and
`superpanel-generate-catalog` taught to look there too, and `.gitignore`
covering whatever stays in `services/`
7. **Starting and stopping.** `bin/start` and `bin/stop` only know the
fixed `CORE_APPS`/`EXTRA_APPS` lists, so `installapp` doesn't start a
coreapp and `start all`/`stop` skip them (the installer starts them
itself). They should also handle apps marked `.coreapp`
8. **The nightly upgrade.** `upgrade_federated` goes through installed
apps; for a coreapp `VERSION` equals `IMAGE_VERSION`, so nothing happens,
which is right (coreapps updates them). But `upgrade_app` reads the
current image with `cut -d: -f2`, which breaks on an image whose registry
has a port (`gitea.example.com:5000/owner/app`): it would think the image
changed and rewrite the compose file wrongly. Either skip apps marked
`.coreapp`, or parse the image properly
9. **free-up-space.** Its `docker image prune -a --filter until=24h` deletes
images of stopped apps. Published apps can be pulled again; a
`localhost/` dev image can't. Fine for published apps; for dev it means
a stopped test app may need `coreapp deploy` again
10. **Monitoring, billing.** `installapp` records non-hidden apps in
`ADDON_APPS` on non-enterprise tiers, and would register `MONITOR` URLs
(the installer writes none). Federated decides whether third-party apps
are billed as add-ons, and whether published apps get monitored
11. **Logs.** The installer keeps the Core scripts' output (which contains
secrets because of their `set -x`) in `/federated/logs/coreapps/`
(mode 700). Federated may want that elsewhere, or fewer secrets in the
traces (see "Tell Federated")
### What the Core offers apps (studied 2026-12-03)
Superpanel (`federatedcomputer/superpanel` 26.12.01, a Go binary, at