Fixes from the second Supermarket run: database versions, health host
The rerun found Supermarket needs PostgreSQL 18 while the Core runs 17.6, which nothing had shown. The skill now gives the version and says to check the app's; coreapp status shows the Core's PostgreSQL/MariaDB version. Deploy's health check sends the app's Host, as traefik does; a same-version deploy says so. The skill covers making the owner at startup, building settings in the app's config loader, and checking mail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+28
-9
@@ -94,8 +94,10 @@ that are read by shell and YAML:
|
||||
- `version`: letters, digits, `.`, `_`, `-`.
|
||||
- `port`: a number, not a string. Use whatever port the app already
|
||||
listens on; for a new app, 8080. It's only reachable inside the Core.
|
||||
- `health`: a path starting with `/`. Deploy waits until it answers with
|
||||
any status below 500 (so `/` is fine for an app without a health
|
||||
- `health`: a path starting with `/`. Deploy asks for it on the app's
|
||||
address with the app's host name (`Host: <name>.<domain>`,
|
||||
`X-Forwarded-Proto: https`, as traefik sends), and waits until it answers
|
||||
with any status below 500 (so `/` is fine for an app without a health
|
||||
endpoint, even if it redirects to a sign-in page); `coreapp check` wants a
|
||||
2xx there, so prefer a path that returns 200 without signing in.
|
||||
- Unknown settings are refused, so a typo doesn't go unnoticed.
|
||||
@@ -115,8 +117,13 @@ The Core makes a PostgreSQL user and database just for this app, and adds:
|
||||
| `DB_NAME`, `DB_USER` | `coreapp_<name>` with `-` as `_` (e.g. `coreapp_my_app`) |
|
||||
| `DB_PASSWORD` | random |
|
||||
|
||||
The server is PostgreSQL shared with the Core's other apps; the app owns its
|
||||
database and nothing else. There's no superuser access, so the app creates
|
||||
The server is PostgreSQL 17 (17.6 today; `coreapp status` shows the Core's
|
||||
version), shared with the Core's other apps; the app owns its database and
|
||||
nothing else. Check what version the app needs before choosing this (its
|
||||
docs, its own compose file's `postgres:` image, its migrations): features
|
||||
of a newer PostgreSQL fail only when the code that uses them runs, so a
|
||||
deploy, `coreapp check` and a sign-in can all pass on the wrong version.
|
||||
If it needs a newer one, see "Not available yet". There's no superuser access, so the app creates
|
||||
its own tables (migrations at startup are the usual way). At boot the
|
||||
database may come up after the app: retry the connection instead of
|
||||
exiting. Many apps want a URL; build it from these variables in the
|
||||
@@ -201,7 +208,10 @@ may log; it should retry).
|
||||
the app, its next Core sign-in gives it back.
|
||||
|
||||
If the app has its own first-run setup (an owner to create, a setup
|
||||
link), skip it on a Core: the Core's admin is the owner. The example app
|
||||
link), skip it on a Core: the Core's admin is the owner. If the app can't
|
||||
run without an owner (its pages say "not set up" until there is one),
|
||||
make `CORE_ADMIN_EMAIL` the owner at startup, without a password; it
|
||||
signs in with the Core. The example app
|
||||
(`coreapp new --sso`) shows the check in `oidc.py`. `coreapp signin`
|
||||
signs in as the test account, not the admin, so ask the user to sign in
|
||||
once as `admin@<domain>` in a browser and check it gets the admin pages.
|
||||
@@ -238,11 +248,16 @@ Most apps have SMTP settings; map these onto them. Mail to `SMTP_FROM`
|
||||
isn't delivered anywhere (the account has no mailbox), so set a reply-to
|
||||
if people should be able to answer. The account can't sign in to anything
|
||||
else on the Core. `coreapp new --email` adds the need (there's no example
|
||||
app for it).
|
||||
app for it). There's no inbox to check that a test message arrived: send
|
||||
one the app's usual way (e.g. a password reset for `coreapp.test@<domain>`)
|
||||
and check `coreapp logs` for mail errors; ask the user to confirm delivery
|
||||
to a real address.
|
||||
|
||||
### Not available yet
|
||||
|
||||
The Core's AI features (offering
|
||||
A newer database server than the Core's (an app that needs PostgreSQL 18:
|
||||
if the app also supports SQLite, that in `/data` is a fine choice, and say
|
||||
so in your report), the Core's AI features (offering
|
||||
tools to its AI agent, or using its model), extra services such as Redis or
|
||||
a second container, extra hostnames, and public ports other than HTTPS.
|
||||
If the app can't work without one of these, say so plainly in your report
|
||||
@@ -296,7 +311,11 @@ and make the Dockerfile fit the Core:
|
||||
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.
|
||||
`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=...`). Set the app's own
|
||||
@@ -399,7 +418,7 @@ pages, and that the admin gets the admin role).
|
||||
|
||||
| Command | Shows |
|
||||
|---|---|
|
||||
| `coreapp status` | Its container, address, port, needs, URL |
|
||||
| `coreapp status` | Its container, address, port, needs, the Core's database version, URL |
|
||||
| `coreapp logs` / `coreapp logs -f` | The app's own log |
|
||||
| `coreapp signin [path]` | Signs in with the Core's test account and shows each step |
|
||||
| `coreapp shell '<command>'` | Run one command in its container, e.g. `coreapp shell 'id; env; ls -l /data'` (without a command it opens an interactive shell, which needs a terminal) |
|
||||
|
||||
Reference in New Issue
Block a user