Add the mysql need: its own database on the Core's MariaDB

needs = ["mysql"] (coreapp new --mysql) makes a user and database
coreapp_<name> on pdnsmysql, with the same DB_* settings as postgres
(so an app has one or the other). Root's password is read inside the
container, so it stays out of installapp's set -x log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 15:15:23 -07:00
co-authored by Claude Opus 5.5
parent 6ab1db839b
commit 8ef2112e3c
12 changed files with 93 additions and 14 deletions
+22 -3
View File
@@ -67,7 +67,7 @@ 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)
health = "/health" # a path that answers once it's up
needs = ["postgres", "sso"] # what it needs from the Core, or [] ("email" too)
needs = ["postgres", "sso"] # what it needs from the Core, or [] ("mysql", "email" too)
```
The installer is strict, because these values end up in files on the Core
@@ -115,6 +115,25 @@ exiting. Many apps want a URL; build it from these variables in the
entrypoint or the app's config (e.g.
`postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME`).
### `mysql`: its own MySQL database (MariaDB)
For apps that need MySQL or MariaDB instead of PostgreSQL (use `postgres`
when the app supports both; an app can't have both). The Core makes a user
and database on its MariaDB 12 (the `pdnsmysql` container, shared with
PowerDNS and the Core's other apps), and adds the same variables:
| Variable | Value |
|---|---|
| `DB_HOST` | `pdnsmysql.<domain>` (resolves only on the Core's network) |
| `DB_PORT` | `3306` |
| `DB_NAME`, `DB_USER` | `coreapp_<name>` with `-` as `_` |
| `DB_PASSWORD` | random |
The database is `utf8mb4`; the app has all privileges on it and nothing
else. The rest is as for `postgres` (migrations, retrying at boot; a URL
is `mysql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME`).
`coreapp new --mysql` adds the need (there's no example app for it).
### `sso`: sign-in with Core accounts
The Core registers the app as an OpenID Connect client with its Authelia,
@@ -231,8 +250,8 @@ and make the Dockerfile fit the Core:
- **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"]` for its
database, and stop if it needs other services (see "Not available yet").
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.