A template overlay (templates/sso) registers the app as an OpenID Connect client in Authelia's idproviders.yml (between markers, secret hashed by the running Authelia), checks the configuration before restarting Authelia and restores it if the check fails; uninstall removes the client. The app reaches Authelia's https address through traefik (@TRAEFIK_IP@, provided by the template's install and by redeploys). The example is a standard-library Python OIDC client (code flow with PKCE). Tested by install, redeploy, remove and reinstall, and a real sign-in in a browser. Also: the postgres overlay appends to the base install, uninstall and env.in; database names get a coreapp_ prefix (PostgreSQL reserves pg_*); deploy waits until the app answers on its own address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 KiB
Plan
coreapp-dev is a software development kit for building apps that run as
Docker containers on Federated Core. It is a CoreDesktop sibling project:
people install it with sibling add <url>, and CoreDesktop's update keeps
it current (format: ~/Projects/coredesktop/skills/sibling-project-format.md).
Delete an item once it's done; git history keeps the record.
Now: a working Core in a local VM
What we know about the CoreServer image (2026-12-02): it's Arch Linux, boots
with BIOS or UEFI, and needs a display device (it stalls at "Loading initial
ramdisk" with --graphics none). All passwords are locked; cloud-init
(NoCloud) installs root's SSH keys. / is a fixed 10 GiB btrfs partition;
the extra disk space goes to /federated, which the image's own
grow-federated.service grows on first boot.
The Core dev.fedcom.net was provisioned on 2026-12-03 in the VM
(10.123.0.10). It's reachable from the internet at 77.216.180.150
through corerelay, which also carries its outbound traffic.
What we learned provisioning (2026-12-02/03):
-
Federated Core finds its public IP with
dig @resolver4.opendns.com myip.opendns.comand publishes it in DNS, so the Core's outbound traffic must leave through the relay (first attempt published the home IP) -
The Core is the authoritative DNS server for its domain (ns1/ns2. point at
ip), so 53 tcp/udp must be forwarded, plus 25 143 465 587 993 4190 9980 besides 22 80 443 -
The domain is picked round-robin (dev.federatedcomputer.cloud, dev.federatedcomputer.net, dev.fedcom.net, ...)
-
The progress stream from core-create is server-sent events; it takes 5+ minutes, a full install about 40
-
Deleting a Core makes the platform SSH into its IP and tear it down, so never put a new VM behind an IP whose old Core still exists. A failed Core has no delete button; Federated has to remove it
-
The Core's containers use 192.168.0.0/16 and send replies for any 192.168.x.x address onto their own bridge, so the VM network is 10.123.0.0/24 (moved there on 2026-12-03 from 192.168.123.0/24)
-
libvirt's DHCP
<host>reservations are ignored on this workstation: libvirt writes the hosts file readable by root only and dnsmasq reads it asnobody. The reservation is adnsmasq:optionin the network instead -
Before core-create on a fresh VM:
systemctl is-active docker, opendns sees the VPS IP, and the hairpin (/dev/tcp/<vps-ip>/22from the VM) -
The Core shows as Active in the dashboard
-
Tell Federated (2026-12-03): - On this image, disabling systemd-resolved isn't enough: networkd's
systemd-networkd-resolve-hook.socketstarts it at boot, it takes port 53 and pdns can't start after a reboot. coreapp-dev masks it through cloud-init; the installer should mask it too - Every Core timer (upgrade-federated, free-up-space, backuptool, dumpcerts, fix-nextcloud, nextcloud-maintenance) hasRequires=<its service>in[Unit], so its job also runs at every boot, about 5 s in, not just on its schedule. Evidence (2026-12-03): boots at 18:01:20 and 18:14:08 UTC; all four checked jobs started at 18:01:25 and 18:14:13. Consequences: - upgrade-federated runs before the network is online (it has noAfter=network-online.target):git pullfails with "Could not resolve host: gitea.federated.computer", thensend_alert_upgradeemails ALERTS_EMAIL ("upgrade failed to run on - couldn't pull from git") and posts a Matrix alert, and it exits 2 (/federated/logs/upgrade.log). So every reboot sends a false alert - free-up-space runsdocker system prune -fanddocker image prune -a --filter until=24hwhile containers are still starting: at 18:01:25 it deleted the pdns container that had failed to start (port 53) and its image (/federated/logs/freeupspace.log). Any app container that is stopped at boot time goes the same way -/federated/bin/upgradehas an API token in it, readable by anyone with the image;lib/functions.shhas the monitoring registrar's bearer token, anduninstallapp'sset -xprints it -bin/startdoesn't know apps outside its fixed lists, so a new app in the generic format isn't started byinstallapp
Next: the SDK (build, deploy and test an app on the Core)
How the Core runs apps (studied 2026-12-03 on dev.fedcom.net)
/federatedis a git checkout of Federated'sCorerepo, updated by/federated/bin/upgrade(git pull). Untracked folders survive pulls.- Installed apps live in
/federated/apps/<app>/:docker-compose.yml,.env(mode 600), secrets in files, data underdata/. - Every container is on the external Docker network
core(192.168.0.0/16) with a fixedipv4_address. Federated's apps use 192.168.0.7 to .121. - traefik (
providers.docker,exposedByDefault=false) routes by labels:traefik.enable=true,routers.<app>.rule=Host(.),entrypoints=websecure,tls.certresolver=letsencrypt(DNS challenge through the Core's own pdns, so any hostname gets a certificate), andservices.<app>.loadbalancer.server.portwhen the port isn't 80. - DNS: the zone has
*.<domain>CNAMEwww.<domain>(the public IP), so every app hostname already resolves. Some apps also add their own A record. /federated/bin/installapp [-n] <app>installs an app from eitherlib/<app>.shwithconfig_<app>,start_<app>,uninstall_<app>and optionallyconfigsso_<app>(Authelia OIDC) andemail_<app>; or- the newer generic format,
services/<app>/:service:NAME,DESCRIPTION,DOCS,CONTAINER,VERSION,INTERNAL_IP,DEPENDS,PORTS,MONITOR="https://<app>.@DOMAIN@|http_2xx"docker-compose.yml.inandenv.in: templates.@DOMAIN@and other variables from/etc/federated;@IMAGE_VERSION@;@NAME:RANDOM:LLLL...@makes a random value (L = letter or digit)icon.pnginstall:. /federated/lib/helpers.shandinstallGeneric <app>(fills in the templates into/federated/apps/<app>/); installapp then runs/federated/bin/start <app>- optional
uninstall,timers/,services/(systemd units)
- installapp installs
DEPENDSfirst;uninstallapp <app>reverses it. - superpanel's catalog lists
services/*/service, so an app installed this way shows up in the Core's dashboard.
Design (proposed)
An app is a folder in the generic format, kept anywhere on the workstation
(its own git repo). A coreapp command, run inside that folder, works
against the Core in the local VM (coreapp-vm ip):
coreapp new <name>: scaffold the folder:service,docker-compose.yml.inwith the traefik labels,env.in,install, a placeholdericon.png, aDockerfilewith a minimal web server, and a README. ItsINTERNAL_IPcomes from 192.168.200.0/24, well away from Federated's 192.168.0.x, and different for each app made on this machine.coreapp deploy: build the image locally (docker build), copy it to the Core (docker save | ssh docker load, no registry needed), copy the folder to/federated/services/<name>/, theninstallapp -n <name>the first time. Later deploys re-renderdocker-compose.ymlbut keep.env(its random secrets), and restart the app.coreapp status,coreapp logs [-f],coreapp shell: on the Core.coreapp check: the app answers athttps://<name>.<domain>/as itsMONITORline says, with a valid certificate.coreapp remove:uninstallapp <name>and remove its services folder.
Built and tested 2026-12-03 with a test app hello (busybox httpd):
new, deploy (first install and redeploy), check, status, logs, remove all
work against dev.fedcom.net; https://hello.dev.fedcom.net/ answers through
the relay.
What we learned:
-
/federated/bin/start <app>only starts apps in the fixedCORE_APPS/EXTRA_APPSlists inlib/functions.sh; for anything else it prints its usage. Soinstallappinstalls a new app but doesn't start it, andstart allskips it.coreapp deploystarts it with the samedocker compose ... up -d;restart: alwayscovers reboots -
installapp/uninstallappcallupdate_monitors, which registers or removes the app'sMONITORURL with Federated's external monitoring (blackboxregistrar.monitoreast.fedcom.net). Dev apps get registered too -
uninstallappruns withset -x; its trace includes the monitoring registrar's bearer token (in plain text inlib/functions.sh) and the Core's email addresses. coreapp keeps the trace in~/.local/share/coreapp-dev/logs/(mode 600) -
uninstallapponly stops a generic app if the app has anuninstallscript (sourced, so noexit); the template has one -
Decided 2026-12-03: apps in development are not registered with Federated's monitoring.
coreapp deploydropsMONITORfrom the copy ofserviceon the Core -
Document the app format fully in the README (done in each app's README) Databases (2026-12-03):
coreapp new --postgres <name>addsDEPENDS="postgresql", DB_* settings inenv.in(random password), aninstallthat creates the user and database on the Core's PostgreSQL (docker exec postgresql psql -U postgres, as Federated's own installers do) and anuninstallthat drops them, and a Python example (psycopg) that counts visits. Tested withguest-book: deploy, the count goes up, a redeploy and a reboot of the Core keep the data, remove drops the database and user.postgresql.<domain>resolves to the PostgreSQL container on thecorenetwork (Docker's DNS); outside it, it's the public IP.
Sign-in (2026-12-03): coreapp new --sso <name>. Its install registers
the OIDC client coreapp-<name> in Authelia's idproviders.yml between
### coreapp-<name> begin/end markers (secret from .env, hashed with the
running Authelia's authelia crypto hash generate pbkdf2), checks the
result with authelia validate-config, restores the old file if that fails,
and restarts Authelia; uninstall removes the block. installapp's
apply_authelia_2fa_policy then applies the Core's 2FA policy to it.
The app reaches https://authelia.<domain> through traefik
(extra_hosts to @TRAEFIK_IP@, which the template's install and
coreapp's redeploy both provide; Federated's apps use the public IP, which
here would loop out through the relay). The example is a standard-library
Python OIDC client (code flow with PKCE).
Tested with sso-demo: install, redeploy, remove and reinstall each leave
one (or no) client block, a valid config, and the other clients and
Nextcloud working; /login redirects to Authelia with PKCE.
A real sign-in to sso-demo with a Core account in a browser worked (2026-12-03, tested by David).
bin/stopandbin/startdon't know apps outside Federated's lists, so when a dependency (postgresql, authelia) is upgraded, coreapp apps keep running instead of being stopped and restarted; they reconnect--postgresand--ssotogether (each has its own example app)- Later: apps published for other Cores (registry, submitting to Federated)
SDK packaging
- Tag the first release once install and VM creation work end to end