Compare commits

..
1 Commits
Author SHA1 Message Date
blandClaude 9c9164f8c0 kino in the stack: the vel's chat beside the 1.0 site
The chat left with NATS at the move to 1.0. uhhm/kino 0.1.2 has an
image now, so it comes back as a service under the profile `chat`: it
shares the site's network namespace like gdo and kron, dials the site
over dhd/1, signs people in at Rauthy as the client `chat`, listens on
3070 (the host Caddy's samtaler.tomtervel.no block already points
there) and keeps its history in kino_data.

The deploy takes CHAT_HOST, KINO_RELEASE and the secret
CHAT_OAUTH2_CLIENT_SECRET, refuses the profile without them, and writes
kino.env; deploy-tomtervel puts that file in place. README.md, "The
chat", has the four steps, the last being kino's key into DHD_KEYS.

Nothing changes until COMPOSE_PROFILES has `chat`: the profile keeps
the service out, and the new published port (3070) has nothing behind
it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5fbDjRr9xfrtcDzcdJNr2
2026-11-25 07:15:24 +01:00
4 changed files with 97 additions and 7 deletions

No files matched your search

+23
View File
@@ -39,6 +39,12 @@ jobs:
PORTAL_RELEASE: ${{ vars.PORTAL_RELEASE }} PORTAL_RELEASE: ${{ vars.PORTAL_RELEASE }}
GDO_RELEASE: ${{ vars.GDO_RELEASE }} GDO_RELEASE: ${{ vars.GDO_RELEASE }}
KRON_RELEASE: ${{ vars.KRON_RELEASE }} KRON_RELEASE: ${{ vars.KRON_RELEASE }}
# The chat (README.md, "The chat"): where it answers, which kino,
# and the secret of the Rauthy client `chat`. With the profile
# `chat` all three must be set.
CHAT_HOST: ${{ vars.CHAT_HOST }}
KINO_RELEASE: ${{ vars.KINO_RELEASE }}
CHAT_OAUTH2_CLIENT_SECRET: ${{ secrets.CHAT_OAUTH2_CLIENT_SECRET }}
COMPOSE_PROFILES: ${{ vars.COMPOSE_PROFILES }} COMPOSE_PROFILES: ${{ vars.COMPOSE_PROFILES }}
CONTENT_REPO: ${{ vars.CONTENT_REPO }} CONTENT_REPO: ${{ vars.CONTENT_REPO }}
CONTENT_BRANCH: ${{ vars.CONTENT_BRANCH }} CONTENT_BRANCH: ${{ vars.CONTENT_BRANCH }}
@@ -126,6 +132,15 @@ jobs:
[ -z "$missing" ] || { echo "COMPOSE_PROFILES has pay, but not set:$missing"; exit 1; } [ -z "$missing" ] || { echo "COMPOSE_PROFILES has pay, but not set:$missing"; exit 1; }
fi fi
chat=
case ",$COMPOSE_PROFILES," in *,chat,*) chat=1;; esac
if [ -n "$chat" ]; then
for v in CHAT_HOST KINO_RELEASE CHAT_OAUTH2_CLIENT_SECRET; do
[ -n "${!v}" ] || missing="$missing $v"
done
[ -z "$missing" ] || { echo "COMPOSE_PROFILES has chat, but not set:$missing"; exit 1; }
fi
umask 077 umask 077
mkdir -p "$STAGE" mkdir -p "$STAGE"
# Interpolated by compose: hosts, versions, profiles. No secret. # Interpolated by compose: hosts, versions, profiles. No secret.
@@ -137,6 +152,8 @@ jobs:
PORTAL_DHD=$PORTAL_DHD PORTAL_DHD=$PORTAL_DHD
COMPOSE_PROFILES=$COMPOSE_PROFILES COMPOSE_PROFILES=$COMPOSE_PROFILES
PAY_HOST=$PAY_HOST PAY_HOST=$PAY_HOST
CHAT_HOST=$CHAT_HOST
KINO_RELEASE=$KINO_RELEASE
RAUTHY_HOST=$RAUTHY_HOST RAUTHY_HOST=$RAUTHY_HOST
OIDC_ISSUER=$OIDC_ISSUER OIDC_ISSUER=$OIDC_ISSUER
EOF EOF
@@ -186,6 +203,12 @@ jobs:
if [ -n "${!name}" ]; then echo "$name=${!name}"; fi if [ -n "${!name}" ]; then echo "$name=${!name}"; fi
done done
} > "$STAGE/kron.env" } > "$STAGE/kron.env"
# kino: the secret it signs people in with. Only with the
# profile, so a stack without the chat gets no file.
if [ -n "$chat" ]; then
echo "OAUTH2_CLIENT_SECRET=$CHAT_OAUTH2_CLIENT_SECRET" > "$STAGE/kino.env"
sed -i 's/\$/$$/g' "$STAGE/kino.env"
fi
# Rauthy's secrets. The first admin is the vel's first person. # Rauthy's secrets. The first admin is the vel's first person.
cat > "$STAGE/rauthy.env" <<EOF cat > "$STAGE/rauthy.env" <<EOF
ENC_KEYS=$RAUTHY_ENC_KEY ENC_KEYS=$RAUTHY_ENC_KEY
+35 -2
View File
@@ -19,8 +19,8 @@ Nothing about the vel's members or records depends on anyone else's
host: the login and the site are the vel's own. host: the login and the site are the vel's own.
The site ran portal 0.19 on NATS until the move to 1.0, which The site ran portal 0.19 on NATS until the move to 1.0, which
`move-1.0/` is. The chat (cnats) spoke to portal over NATS and went `move-1.0/` is. The chat it had (cnats) spoke to portal over NATS and went
with it; the one that dials a 1.0 site (uhhm/kino) has no image yet. with it; uhhm/kino, which dials a 1.0 site, takes its place ("The chat").
## First start ## First start
@@ -47,6 +47,7 @@ it, and `host-caddy/tomtervel.no` is its file for them
- portal → `127.0.0.1:3050` - portal → `127.0.0.1:3050`
- kron → `127.0.0.1:3080` - kron → `127.0.0.1:3080`
- kino → `127.0.0.1:3070`
- rauthy → `127.0.0.1:8090` - rauthy → `127.0.0.1:8090`
## Accounts and groups ## Accounts and groups
@@ -150,6 +151,8 @@ Run workflow**. Set them with `gt` (`gt variable set NAME --body ...`,
| `RAUTHY_BOOTSTRAP_API_KEY`, `RAUTHY_BOOTSTRAP_API_KEY_SECRET` | secret | repo | optional, Rauthy's first start only: a short-lived key (base64 of `{"name","exp","access"}`, secret 64+ alphanumerics) that makes the OIDC clients through the API; read into an empty database, ignored after | | `RAUTHY_BOOTSTRAP_API_KEY`, `RAUTHY_BOOTSTRAP_API_KEY_SECRET` | secret | repo | optional, Rauthy's first start only: a short-lived key (base64 of `{"name","exp","access"}`, secret 64+ alphanumerics) that makes the OIDC clients through the API; read into an empty database, ignored after |
| `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` | | `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` |
| `VIPPS_LOGIN_CLIENT_ID`, `VIPPS_LOGIN_CLIENT_SECRET` | variable, secret | repo | Vipps Login (the login sales unit's keys from portal.vippsmobilepay.no): the deploy keeps Vipps as a sign-in provider in Rauthy with them (`rauthy-providers.sh`) | | `VIPPS_LOGIN_CLIENT_ID`, `VIPPS_LOGIN_CLIENT_SECRET` | variable, secret | repo | Vipps Login (the login sales unit's keys from portal.vippsmobilepay.no): the deploy keeps Vipps as a sign-in provider in Rauthy with them (`rauthy-providers.sh`) |
| `CHAT_HOST`, `KINO_RELEASE` | variable | repo | the chat: where it answers (`samtaler.tomtervel.no`, DNS in `dns/`, a kasse Caddy block) and which kino image (`0.1.2`). Needed once `COMPOSE_PROFILES` has `chat` |
| `CHAT_OAUTH2_CLIENT_SECRET` | secret | repo | the secret of the Rauthy client `chat` ("Rauthy" below), which kino signs people in with |
| `PAY_HOST` | variable | repo | where the money service answers: `betaling.tomtervel.no` (DNS in `dns/`, a kasse Caddy block) | | `PAY_HOST` | variable | repo | where the money service answers: `betaling.tomtervel.no` (DNS in `dns/`, a kasse Caddy block) |
| `VIPPS_MSN` | variable | repo | the Medlemskap sales unit's merchant serial number, `1192072` | | `VIPPS_MSN` | variable | repo | the Medlemskap sales unit's merchant serial number, `1192072` |
| `VIPPS_CLIENT_ID`, `VIPPS_CLIENT_SECRET`, `VIPPS_SUBSCRIPTION_KEY` | secret | repo | the Medlemskap sales unit's ePayment keys (For developers, API keys, production), read by kron alone. With all four set kron asks the site for nothing | | `VIPPS_CLIENT_ID`, `VIPPS_CLIENT_SECRET`, `VIPPS_SUBSCRIPTION_KEY` | secret | repo | the Medlemskap sales unit's ePayment keys (For developers, API keys, production), read by kron alone. With all four set kron asks the site for nothing |
@@ -217,6 +220,36 @@ Going live, in order:
Nothing here touches the Vippsnummer (500396): people may keep paying Nothing here touches the Vippsnummer (500396): people may keep paying
there, and the treasurer marks those by hand as before. there, and the treasurer marks those by hand as before.
## The chat
The vel's conversations are uhhm/kino at `samtaler.tomtervel.no`: every
group the content names is a room, and the site decides who gets in.
kino signs people in at Rauthy as the client `chat`, dials the site
over dhd/1 beside gdo and kron, and keeps what is said in a file of its
own (`kino_data`). What was said in the old chat did not come along.
To turn it on:
1. Set the variables `CHAT_HOST` (`samtaler.tomtervel.no`) and
`KINO_RELEASE` (`0.1.2`), and the secret `CHAT_OAUTH2_CLIENT_SECRET`:
the Rauthy client `chat` exists from the old chat, with the redirect
`https://samtaler.tomtervel.no/auth/callback`; its secret is in
Rauthy's admin, under the client.
2. Install the `deploy-tomtervel` from this repo on kasse (its first
lines say how): the one before this does not put `kino.env` in
place.
3. Add `chat` to `COMPOSE_PROFILES` (`pay,chat`) and run the deploy.
kino starts and says its key in its log (`podman logs
infrastructure_kino_1`). The site does not know that key yet, so
kino has no rooms to show until the next step.
4. Add that key to the variable `DHD_KEYS` as `<key>=rooms,watch,may`,
beside gdo's and kron's, and run the deploy again. Portal starts with
the new key, and kino's next dial is taken.
`https://samtaler.tomtervel.no/` then asks for a sign-in, and a member
of a group finds its room. The host Caddy's block and the DNS record
are the old chat's, on the same port.
## Rauthy ## Rauthy
[Rauthy](https://github.com/sebadob/rauthy) at `RAUTHY_HOST` [Rauthy](https://github.com/sebadob/rauthy) at `RAUTHY_HOST`
+37 -3
View File
@@ -111,6 +111,8 @@ services:
- "127.0.0.1:3050:3000" - "127.0.0.1:3050:3000"
# kron (betaling.tomtervel.no -> here). # kron (betaling.tomtervel.no -> here).
- "127.0.0.1:3080:3080" - "127.0.0.1:3080:3080"
# kino (samtaler.tomtervel.no -> here).
- "127.0.0.1:3070:3070"
portal: portal:
build: build:
@@ -228,9 +230,40 @@ services:
# content repo's reload reaches the site over HTTPS, so no in-compose # content repo's reload reaches the site over HTTPS, so no in-compose
# runner - and no docker.sock/podman.sock mount - is needed here. # runner - and no docker.sock/podman.sock mount - is needed here.
# The vel's conversations are not in this stack for now: the chat that # The vel's conversations (uhhm/kino): every group the content names is
# ran here (cnats) spoke to portal over NATS, and the one that dials a # a room, and the site decides who gets in. kino dials the site over
# 1.0 site (uhhm/kino) is not published as an image yet. # dhd/1 as gdo and kron do, and keeps its history in a file of its own
# in kino_data; what was said in the old chat (cnats, on NATS) did not
# come along. Reached by kasse's host Caddy on the published 3070
# (samtaler.tomtervel.no). A profile, since it needs its sign-in
# secret: COMPOSE_PROFILES has `chat` once CHAT_HOST, KINO_RELEASE and
# CHAT_OAUTH2_CLIENT_SECRET are set.
#
# The site must name kino's key in DHD_KEYS as `<key>=rooms,watch,may`;
# kino says its key as it starts (README.md, "The chat").
kino:
profiles: ["chat"]
image: project.uhhm.no/uhhm/kino:${KINO_RELEASE:-no-tag-set}
restart: unless-stopped
network_mode: "service:net"
env_file:
- path: kino.env
required: false
environment:
PORTAL_DHD: ${PORTAL_DHD:-}
# Must be the portal's own: a room names its site.
SITE_NAME: tomtervel
# Rauthy, and the client it knows the chat as.
OIDC_ISSUER: ${OIDC_ISSUER}
OAUTH2_CLIENT_ID: chat
PUBLIC_URL: https://${CHAT_HOST:-no-host-set}
COOKIE_SECURE: "true"
# 3070, not 3000: in the shared network 3000 is portal's.
LEPTOS_SITE_ADDR: 0.0.0.0:3070
volumes:
- kino_data:/var/lib/kino
depends_on:
- portal
# Where uploads go: the pictures and documents a desk attaches, and what # Where uploads go: the pictures and documents a desk attaches, and what
# `portal import` brings in. One node on this host, reachable only inside # `portal import` brings in. One node on this host, reachable only inside
@@ -249,6 +282,7 @@ volumes:
portal_data: portal_data:
gdo_data: gdo_data:
kron_data: kron_data:
kino_data:
caddy_data: caddy_data:
caddy_config: caddy_config:
nats_data: nats_data:
+2 -2
View File
@@ -19,8 +19,8 @@ root=/srv/tomtervel/infrastructure
stage=/var/lib/gitea-runner/tomtervel-env stage=/var/lib/gitea-runner/tomtervel-env
files=(.env portal.env) files=(.env portal.env)
# Written only when the site runs what needs it (Rauthy, the money # Written only when the site runs what needs it (Rauthy, the money
# service under the pay profile). # service under the pay profile, the chat under the chat profile).
optional=(rauthy.env kron.env) optional=(rauthy.env kron.env kino.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