Fixes from the listmonk rehearsal; porting checklist in its own file

A rehearsal porting listmonk (postgres, sso, email) deployed it, signed
in, and read its opt-in mail with coreapp inbox. The name refusal said the
Core "already has" listmonk when it's Federated's uninstalled app; it now
says so, and coreapp core lists the names apps can't use. The porting
checklist moves to references/porting.md, adding settings kept in the
app's database, upstream entrypoints that assume root, and min_version
from the app's documented minimum. sign-in.md: the admin rule in an
upstream image, and when --form isn't needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 21:05:11 -07:00
co-authored by Claude Opus 5.5
parent f0468c43f2
commit 5d90c246a1
7 changed files with 177 additions and 91 deletions
+11 -82
View File
@@ -84,7 +84,10 @@ that are read by shell and YAML:
- `name`: 2-31 lowercase letters, digits and `-`, starting with a letter,
not ending with `-`. Names of Federated's own apps (nextcloud, gitea,
...) and the Core's hostnames (www, mail, ...) are refused.
listmonk, ..., including ones not installed) and the Core's hostnames
(www, mail, ...) are refused: check `coreapp core`'s "Names apps can't
use" before choosing one. For an app Federated also offers, use another
name (e.g. `listmonk-app`) and keep its usual `title`.
- `title`: up to 40 letters, digits, spaces and `. , ! ? ( ) & + _ -`.
- `description`: up to 200 characters, no `"`, `$`, backtick, `\`, `@` or
line breaks.
@@ -323,87 +326,13 @@ Replace the example with the real app.
### 2b. An existing app (porting)
Work in the app's repository. Add `coreapp.toml` (copy the example above),
and make the Dockerfile fit the Core:
- **Listen on `0.0.0.0` and on `port`**, plain HTTP. No TLS in the app.
- **Know its public address**: `APP_URL` (many apps need a "base URL" or
"trusted host" setting). It's behind traefik, which sends
`X-Forwarded-Proto: https` and `X-Forwarded-For`: set the app's "trusted
proxies" to `CORE_PROXY` (so it logs and rate-limits by the real client
address), and turn on its "behind HTTPS" or secure-cookie setting if it
has one, since it sees plain HTTP itself.
- **Keep state in `/data`**: point upload folders, SQLite files and
generated keys there. If the app needs a directory structure under `/data`,
create it at startup (it starts empty).
- **Send mail with `needs = ["email"]`**, if the app sends any (password
resets, notifications): map `SMTP_*` onto its mail settings.
- **If the app also runs elsewhere** (a desktop or another server edition
sharing the Dockerfile), keep those working: choose the Core's behaviour
in the app when `CORE_DOMAIN` is set (the Core's variables become
defaults; the app's own explicit settings still win), not by changing
the Dockerfile's `ENV` or `ENTRYPOINT` for everyone. The Core builds the
`Dockerfile` at the repository's root. Where the app's settings have
another shape (a mail URL instead of `SMTP_*`, a database URL, a hex
key), build them from the Core's variables where the app loads its
settings, so its command-line tools (`coreapp shell '<app> ...'`) get
them too, not only the server started by the entrypoint.
- **Read settings from the environment**, mapping the Core's names to the
app's in an entrypoint script or config file if they differ
(`SECRET_KEY="$APP_SECRET"`, `DATABASE_URL=...`). In an entrypoint for
an upstream image, set the app's variables outright rather than "only if
unset": the image's own `ENV` defaults (a SQLite path, a port) would win
otherwise, and on a Core nobody else sets them. (In the app's own code,
as above, the Core's values are defaults that the app's explicit
settings override: that's for its other editions, not upstream `ENV`.)
Before writing the entrypoint, look at how the upstream image starts
(`docker inspect -f '{{json .Config.Entrypoint}} {{json .Config.Cmd}}'
<image>`): end yours by running what it ran (`exec` its entrypoint with
`"$@"`, or `exec "$@"` when it only has a `CMD`).
- **Wait for what it needs at startup** if it only checks once: the
database may come up after the app on a reboot, and Authelia restarts
when the app's sign-in client is registered (on the first deploy, and
when `[sso]` changes). An app that fetches Authelia's discovery only at
startup then has no sign-in until restarted, so wait in the entrypoint,
with a time limit, e.g.
`until wget -qO /dev/null "$OIDC_ISSUER/.well-known/openid-configuration"; do sleep 2; done`
(and `nc -z "$DB_HOST" "$DB_PORT"` for the database).
- **Images without a shell** (built `FROM scratch` or distroless) can't run
an entrypoint script, and `coreapp shell` can't open one. Copy a static
busybox in and run the script with it:
```dockerfile
FROM busybox:1.37-musl AS busybox
FROM upstream/image:1.2.3
COPY --from=busybox /bin/busybox /bin/busybox
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/busybox", "sh", "/entrypoint.sh"]
```
(end it with `exec` and the upstream entrypoint; call tools as
`/bin/busybox mkdir ...`). Prefer this to a program of your own.
- **Run as a non-root user** if the image allows. `/data` is given to
whatever user the image runs as, so this is enough:
```dockerfile
RUN useradd --system --uid 1000 --home-dir /data app # Debian-based images
USER app
```
(`adduser -S -u 1000 -h /data app` on Alpine.) Many upstream images
already have a user; use it.
- **Give it its own `icon.png`**: the project's logo, square, as a PNG
(convert an SVG or ICO; 256x256 is good). The template's is a
placeholder. `coreapp deploy` and `publish` say if it's unusable, not
square or under 80 pixels; `publish` refuses one the Core can't use.
- **Answer on `health`** once ready (a dedicated health endpoint, or `/` if
it returns 2xx-4xx without signing in).
- **One container.** If the upstream project ships a compose file with
several services, keep only the app, use `needs = ["postgres"]` (or
`["mysql"]` for MySQL/MariaDB) for its database, and stop if it needs other services (see "Not available yet").
Keep the app's other files as they are; add `.dockerignore` entries for
`coreapp.toml`, `icon.png` and `.git` so they don't bust the build cache.
Read [references/porting.md](references/porting.md) first: the checklist
for making the app's Dockerfile fit the Core. In short: plain HTTP on `0.0.0.0:port`; its public
address from `APP_URL`, trusting `CORE_PROXY`; state in `/data`; the Core's
variables mapped onto the app's settings, outright in an entrypoint that
ends by running the upstream one (and written at every start, for settings
the app keeps in its database); waiting for the database and Authelia at
startup; a non-root user; its own `icon.png`; one container.
### 3. Deploy and test