coreapp new --sso: sign-in through the Core's Authelia

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>
This commit is contained in:
2026-12-03 12:34:27 -07:00
co-authored by Claude Opus 5.5
parent 74bdc13f0f
commit 284f52fc29
19 changed files with 419 additions and 37 deletions
-11
View File
@@ -1,11 +0,0 @@
# Filled in once, when the app is installed (see README.md). Redeploying
# keeps the result, so secrets don't change.
IMAGE_VERSION=@VERSION@
APP_URL=https://{{NAME}}.@DOMAIN@
APP_SECRET=@APP_SECRET:RANDOM:LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL@
# Its database on the Core's PostgreSQL, made by install
DB_HOST=postgresql.@DOMAIN@
DB_PORT=5432
DB_NAME={{DBNAME}}
DB_USER={{DBNAME}}
DB_PASSWORD=@DB_PASSWORD:RANDOM:LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL@
+6
View File
@@ -0,0 +1,6 @@
# Its database on the Core's PostgreSQL, made by install
DB_HOST=postgresql.@DOMAIN@
DB_PORT=5432
DB_NAME={{DBNAME}}
DB_USER={{DBNAME}}
DB_PASSWORD=@DB_PASSWORD:RANDOM:LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL@
-4
View File
@@ -1,7 +1,3 @@
. /federated/lib/helpers.sh
installGeneric {{NAME}}
# .env holds secrets
chmod 600 /federated/apps/{{NAME}}/.env
# Its own database and user on the Core's PostgreSQL (DEPENDS=postgresql),
# with the password from .env. Safe to run again: an existing user gets the
-6
View File
@@ -1,6 +0,0 @@
# Sourced by the Core's uninstallapp (so no `exit` here): stop the app and
# delete its settings, data and database
docker compose -f /federated/apps/{{NAME}}/docker-compose.yml -p {{NAME}} down
rm -rf /federated/apps/{{NAME}}
docker exec postgresql psql -U postgres -qc "DROP DATABASE IF EXISTS {{DBNAME}}"
docker exec postgresql psql -U postgres -qc "DROP USER IF EXISTS {{DBNAME}}"
+3
View File
@@ -0,0 +1,3 @@
# ...and its database
docker exec postgresql psql -U postgres -qc "DROP DATABASE IF EXISTS {{DBNAME}}"
docker exec postgresql psql -U postgres -qc "DROP USER IF EXISTS {{DBNAME}}"