2 Commits
Author SHA1 Message Date
blandClaude Opus 5.5 961d090b7d Rauthy as a compose profile: sign-in in Norwegian, off until asked for
dns / dns (push) Successful in 4s
A rauthy service under the profile of the same name, its config here
without secrets, and rauthy.env written by the deploy from Actions
secrets. OIDC_ISSUER moves portal's and the chat's sign-in to it,
RAUTHY_API_KEY lets portal make accounts there. konto.tomtervel.no in
DNS and kasse's Caddy, beside id. Nothing runs until RAUTHY_HOST, the
three secrets and the profile are set.

Tried locally: the config starts, the issuer is https://<host>/auth/v1/,
and a Norwegian browser gets the pages in nb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5fbDmSQSb6u27EiEuwzoM
2026-11-07 22:33:46 +01:00
bl 5524b1be01 Merge pull request 'Kart: MAPBOX_TOKEN og MAPBOX_STYLE, og kasses Caddy for tomtervel.no' (#3) from mapbox into main
deploy / deploy (push) Successful in 24s
Reviewed-on: #3
2026-11-07 18:04:36 +01:00
8 changed files with 163 additions and 0 deletions

No files matched your search

+34
View File
@@ -21,6 +21,7 @@ on:
- gdo/** - gdo/**
- nats/nats.conf - nats/nats.conf
- kanidm/server.toml.tpl - kanidm/server.toml.tpl
- rauthy/config.toml
- deploy-tomtervel - deploy-tomtervel
- .gitea/workflows/deploy.yml - .gitea/workflows/deploy.yml
workflow_dispatch: workflow_dispatch:
@@ -63,6 +64,17 @@ jobs:
# location field is two numbers). # location field is two numbers).
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
MAPBOX_STYLE: ${{ vars.MAPBOX_STYLE }} MAPBOX_STYLE: ${{ vars.MAPBOX_STYLE }}
# Optional: Rauthy beside or instead of Kanidm (README.md, "Rauthy").
# RAUTHY_HOST and the three secrets run it (with `rauthy` in
# COMPOSE_PROFILES); OIDC_ISSUER moves portal's and the chat's
# sign-in to it; RAUTHY_API_KEY lets portal make accounts there.
RAUTHY_HOST: ${{ vars.RAUTHY_HOST }}
RAUTHY_ENC_KEY: ${{ secrets.RAUTHY_ENC_KEY }}
RAUTHY_SECRET_RAFT: ${{ secrets.RAUTHY_SECRET_RAFT }}
RAUTHY_SECRET_API: ${{ secrets.RAUTHY_SECRET_API }}
OIDC_ISSUER: ${{ vars.OIDC_ISSUER }}
RAUTHY_API_KEY: ${{ secrets.RAUTHY_API_KEY }}
RAUTHY_LANGUAGE: ${{ vars.RAUTHY_LANGUAGE }}
steps: steps:
# A missing value stops here, by name, before anything on the host # A missing value stops here, by name, before anything on the host
# is touched. Only names are printed: the log is public. # is touched. Only names are printed: the log is public.
@@ -91,6 +103,8 @@ jobs:
CNATS_TAG=$CNATS_TAG CNATS_TAG=$CNATS_TAG
KRON_RELEASE=$KRON_RELEASE KRON_RELEASE=$KRON_RELEASE
COMPOSE_PROFILES=$COMPOSE_PROFILES COMPOSE_PROFILES=$COMPOSE_PROFILES
RAUTHY_HOST=$RAUTHY_HOST
OIDC_ISSUER=$OIDC_ISSUER
EOF EOF
cat > "$STAGE/portal.env" <<EOF cat > "$STAGE/portal.env" <<EOF
NATS_URL=nats://portal:$NATS_PASSWORD@nats:4222 NATS_URL=nats://portal:$NATS_PASSWORD@nats:4222
@@ -115,6 +129,10 @@ jobs:
GARAGE_UPLOADS_BUCKET=$GARAGE_UPLOADS_BUCKET GARAGE_UPLOADS_BUCKET=$GARAGE_UPLOADS_BUCKET
MAPBOX_TOKEN=$MAPBOX_TOKEN MAPBOX_TOKEN=$MAPBOX_TOKEN
MAPBOX_STYLE=$MAPBOX_STYLE MAPBOX_STYLE=$MAPBOX_STYLE
OIDC_ISSUER=$OIDC_ISSUER
RAUTHY_URL=${RAUTHY_HOST:+https://$RAUTHY_HOST}
RAUTHY_API_KEY=$RAUTHY_API_KEY
RAUTHY_LANGUAGE=$RAUTHY_LANGUAGE
EOF EOF
# NATS itself (nats.conf reads NATS_PASSWORD), gdo and the chat. # NATS itself (nats.conf reads NATS_PASSWORD), gdo and the chat.
cat > "$STAGE/nats.env" <<EOF cat > "$STAGE/nats.env" <<EOF
@@ -125,6 +143,22 @@ jobs:
OAUTH2_CLIENT_ID=$CHAT_OAUTH2_CLIENT_ID OAUTH2_CLIENT_ID=$CHAT_OAUTH2_CLIENT_ID
OAUTH2_CLIENT_SECRET=$CHAT_OAUTH2_CLIENT_SECRET OAUTH2_CLIENT_SECRET=$CHAT_OAUTH2_CLIENT_SECRET
EOF EOF
# Rauthy's secrets, only where it runs. The first admin is the
# vel's first person.
if [ -n "$RAUTHY_ENC_KEY" ]; then
for v in RAUTHY_HOST RAUTHY_SECRET_RAFT RAUTHY_SECRET_API; do
[ -n "${!v}" ] || { echo "RAUTHY_ENC_KEY is set, but not $v"; exit 1; }
done
cat > "$STAGE/rauthy.env" <<EOF
ENC_KEYS=$RAUTHY_ENC_KEY
ENC_KEY_ACTIVE=${RAUTHY_ENC_KEY%%/*}
HQL_SECRET_RAFT=$RAUTHY_SECRET_RAFT
HQL_SECRET_API=$RAUTHY_SECRET_API
BOOTSTRAP_ADMIN_EMAIL=$SEED_ADMIN_EMAIL
RAUTHY_ADMIN_EMAIL=$SEED_ADMIN_EMAIL
EVENT_EMAIL=$SEED_ADMIN_EMAIL
EOF
fi
- name: Pull and bring the stack up - name: Pull and bring the stack up
run: sudo /usr/local/bin/deploy-tomtervel run: sudo /usr/local/bin/deploy-tomtervel
+1
View File
@@ -8,3 +8,4 @@ gitea-oauth.secret
dns/cloudflare.env dns/cloudflare.env
nats.env nats.env
kanidm-setup.secrets kanidm-setup.secrets
rauthy.env
+45
View File
@@ -163,6 +163,10 @@ Run workflow**. Set them with `gt` (`gt variable set NAME --body ...`,
| `MAPBOX_TOKEN` | secret | repo | optional: the map tiles portal proxies (the landing hero, location fields); unset, maps are off | | `MAPBOX_TOKEN` | secret | repo | optional: the map tiles portal proxies (the landing hero, location fields); unset, maps are off |
| `MAPBOX_STYLE` | variable | repo | optional: `<owner>/<style>`; unset, `mapbox/streets-v12` | | `MAPBOX_STYLE` | variable | repo | optional: `<owner>/<style>`; unset, `mapbox/streets-v12` |
| `DNSCONTROL_VERSION` | variable | repo | the DNS workflow's dnscontrol | | `DNSCONTROL_VERSION` | variable | repo | the DNS workflow's dnscontrol |
| `RAUTHY_HOST` | variable | repo | optional, Rauthy (see [Rauthy](#rauthy)): `konto.tomtervel.no` |
| `RAUTHY_ENC_KEY`, `RAUTHY_SECRET_RAFT`, `RAUTHY_SECRET_API` | secret | repo | optional, Rauthy's own: made once, never changed (the key encrypts its database) |
| `OIDC_ISSUER` | variable | repo | optional: `https://konto.tomtervel.no/auth/v1/` moves the site's and the chat's sign-in to Rauthy; unset, Kanidm |
| `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | optional: portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` |
A variable is printed wherever a workflow echoes it, and this repo's run A variable is printed wherever a workflow echoes it, and this repo's run
logs are public: a value that must not be read is a secret. logs are public: a value that must not be read is a secret.
@@ -172,6 +176,47 @@ and internal certificate (`bootstrap.sh`), and Garage's node secret.
`kanidm/server.toml` takes `ID_HOST` once: Kanidm's domain is renamed on `kanidm/server.toml` takes `ID_HOST` once: Kanidm's domain is renamed on
purpose, not by a variable changed (see dns/README.md). purpose, not by a variable changed (see dns/README.md).
## Rauthy
Kanidm has no Norwegian: its sign-in, its account pages and its mail
are in English. [Rauthy](https://github.com/sebadob/rauthy) has
Norwegian (`nb`) in all three, and portal (from the release after
0.14.2) and the chat can sign in through it. It is here as a compose
profile, off until it is asked for, so the vel can try it beside
Kanidm and move when it is ready. Portal keeps the groups either way
(`PEOPLE_BACKEND=memberships`), so moving takes no groups along.
Trying it, beside Kanidm:
1. The secrets, made once and never changed:
```sh
echo "$(openssl rand -hex 4)/$(openssl rand -base64 32)" | gt secret set RAUTHY_ENC_KEY -R tomtervel/infrastructure
openssl rand -hex 24 | gt secret set RAUTHY_SECRET_RAFT -R tomtervel/infrastructure
openssl rand -hex 24 | gt secret set RAUTHY_SECRET_API -R tomtervel/infrastructure
gt variable set RAUTHY_HOST --body konto.tomtervel.no -R tomtervel/infrastructure
gt variable set COMPOSE_PROFILES --body chat,rauthy -R tomtervel/infrastructure
```
2. DNS: `konto` is in `dns/dnsconfig.js`; run the dns workflow. Install
`host-caddy/tomtervel.no` on kasse (it has the `konto` block) and
reload Caddy. Reinstall `deploy-tomtervel` on kasse too: it now puts
`rauthy.env` in place.
3. Deploy. The first admin is `SEED_ADMIN_EMAIL`; its password is in the
log once: `podman compose logs rauthy | grep -A2 -i password`.
4. In Rauthy's admin (`https://konto.tomtervel.no/auth/v1/admin`): a
client for the site (`authorization_code`, `S256`, scopes `openid
profile email`, redirect `https://tomtervel.no/auth/callback`) and
one for the chat (also `refresh_token`, redirect
`https://chat.tomtervel.no/auth/callback`), and an API key with read
and create on users.
5. Moving the sign-in over is then values: `OIDC_ISSUER`,
`OAUTH2_CLIENT_ID`/`OAUTH2_CLIENT_SECRET` and the chat's pair set to
Rauthy's clients, `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE=nb`, and a
portal release that knows them. Back is the same values unset.
Rauthy's mail leaves through kasse's postfix like gdo's, and Rauthy
stops if it cannot reach it. Its database is in the `rauthy_data`
volume, which wants the same backups as NATS.
## Backups ## Backups
- Kanidm writes a nightly backup into its volume (`/data/backups`, - Kanidm writes a nightly backup into its volume (`/data/backups`,
+30
View File
@@ -81,6 +81,32 @@ services:
ports: ports:
- "127.0.0.1:8443:8443" - "127.0.0.1:8443:8443"
# Rauthy: sign-in, account pages and account mail in Norwegian, as an
# alternative to Kanidm (which has no Norwegian). A profile, off unless
# COMPOSE_PROFILES has `rauthy`; with it, portal and the chat sign in
# here when OIDC_ISSUER is set, and portal makes accounts here with
# RAUTHY_API_KEY. Its database is embedded (hiqlite), in rauthy_data.
# Host-published for kasse's host Caddy (RAUTHY_HOST -> here).
rauthy:
profiles: ["rauthy"]
image: ghcr.io/sebadob/rauthy:${RAUTHY_TAG:-0.37.2}
restart: unless-stopped
env_file:
- path: rauthy.env
required: false
environment:
PUB_URL: ${RAUTHY_HOST:-no-host-set}
RP_ID: ${RAUTHY_HOST:-no-host-set}
# Rauthy wants the port spelled out.
RP_ORIGIN: https://${RAUTHY_HOST:-no-host-set}:443
extra_hosts:
- "host.containers.internal:host-gateway"
volumes:
- ./rauthy/config.toml:/app/config.toml:ro
- rauthy_data:/app/data
ports:
- "127.0.0.1:8090:8080"
portal: portal:
build: build:
context: ./portal context: ./portal
@@ -163,6 +189,9 @@ services:
# Must be the portal's own: a new name is a new, empty chat. # Must be the portal's own: a new name is a new, empty chat.
SITE_NAME: tomtervel SITE_NAME: tomtervel
KANIDM_URL: https://${ID_HOST} KANIDM_URL: https://${ID_HOST}
# Set, the chat signs in through it instead of Kanidm (Rauthy:
# https://<RAUTHY_HOST>/auth/v1/). Empty is unset.
OIDC_ISSUER: ${OIDC_ISSUER:-}
PUBLIC_URL: https://${CHAT_HOST} PUBLIC_URL: https://${CHAT_HOST}
COOKIE_SECURE: "true" COOKIE_SECURE: "true"
ports: ports:
@@ -189,6 +218,7 @@ volumes:
caddy_config: caddy_config:
nats_data: nats_data:
kanidm_data: kanidm_data:
rauthy_data:
learn_cache: learn_cache:
# Pin the project network subnet inside 172.16/12 so Kanidm's X-Forwarded-For # Pin the project network subnet inside 172.16/12 so Kanidm's X-Forwarded-For
+7
View File
@@ -18,6 +18,8 @@ set -euo pipefail
root=/srv/tomtervel/infrastructure root=/srv/tomtervel/infrastructure
stage=/var/lib/gitea-runner/tomtervel-env stage=/var/lib/gitea-runner/tomtervel-env
files=(.env portal.env nats.env chat.env) files=(.env portal.env nats.env chat.env)
# Written only when the site runs what needs it (Rauthy).
optional=(rauthy.env)
[ -d "$root/.git" ] || { echo "no checkout at $root - bootstrap it first" >&2; exit 1; } [ -d "$root/.git" ] || { echo "no checkout at $root - bootstrap it first" >&2; exit 1; }
for f in "${files[@]}"; do for f in "${files[@]}"; do
@@ -32,6 +34,11 @@ for f in "${files[@]}"; do
install -m 0600 -o root -g root "$stage/$f" "$root/$f" install -m 0600 -o root -g root "$stage/$f" "$root/$f"
rm -f "$stage/$f" rm -f "$stage/$f"
done done
for f in "${optional[@]}"; do
[ -s "$stage/$f" ] || continue
install -m 0600 -o root -g root "$stage/$f" "$root/$f"
rm -f "$stage/$f"
done
# --build so a bumped PORTAL_RELEASE or GDO_RELEASE is actually fetched. # --build so a bumped PORTAL_RELEASE or GDO_RELEASE is actually fetched.
podman compose up -d --build podman compose up -d --build
+2
View File
@@ -32,6 +32,8 @@ D("tomtervel.no", REG_NONE, DnsProvider(DSP_CLOUDFLARE),
CNAME("www", "tomtervel.no.", CF_PROXY_OFF), CNAME("www", "tomtervel.no.", CF_PROXY_OFF),
A("id", KASSE, CF_PROXY_OFF), A("id", KASSE, CF_PROXY_OFF),
A("chat", KASSE, CF_PROXY_OFF), A("chat", KASSE, CF_PROXY_OFF),
// Rauthy, the Norwegian sign-in, beside Kanidm while the vel tries it.
A("konto", KASSE, CF_PROXY_OFF),
// The old website, kept for now so the move can be undone: what the // The old website, kept for now so the move can be undone: what the
// apex and web. pointed at before (Netlify, through Cloudflare). The // apex and web. pointed at before (Netlify, through Cloudflare). The
+7
View File
@@ -40,3 +40,10 @@ id.tomtervel.no {
chat.tomtervel.no { chat.tomtervel.no {
reverse_proxy 127.0.0.1:3070 reverse_proxy 127.0.0.1:3070
} }
# Rauthy (compose profile `rauthy`): sign-in and account pages in
# Norwegian, beside Kanidm until the vel moves over (README.md, "Rauthy").
# Plain http on a loopback port; Caddy holds the certificate.
konto.tomtervel.no {
reverse_proxy 127.0.0.1:8090
}
+37
View File
@@ -0,0 +1,37 @@
# Rauthy, the vel's sign-in in Norwegian: what is not secret. The
# secrets (the encryption key, the cluster secrets) and the names that
# differ per site come from rauthy.env, which the deploy workflow writes
# from the Actions secrets and variables (README.md). A profile: only
# with `rauthy` in COMPOSE_PROFILES does it run.
[bootstrap]
# The first admin's address, from BOOTSTRAP_ADMIN_EMAIL (rauthy.env).
# Its password is printed once in the log on the very first start:
# podman compose logs rauthy | grep -A2 -i password
[cluster]
# One node, on its own.
node_id = 1
nodes = ["1 localhost:8100 localhost:8200"]
[email]
# Through kasse's postfix, like gdo: the host signs the vel's mail
# (DKIM for tomtervel.no) on the way out.
smtp_url = "host.containers.internal"
smtp_port = 25
smtp_tls_mode = "danger-insecure"
smtp_from = "Tomter Vel <post@tomtervel.no>"
sub_prefix = "Tomter Vel"
[i18n]
# Norwegian first, and English for whoever's browser asks for it.
filter_lang_common = ["nb", "en"]
filter_lang_admin = ["nb", "en"]
[server]
# Behind kasse's host Caddy, which holds the certificate.
scheme = "http"
proxy_mode = true
# Caddy reaches the published port from the host, which the container
# sees as the project network's gateway (compose.yml pins 172.18/16).
trusted_proxies = ["172.16.0.0/12"]