Compare commits

..
4 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
bl e7c6ac6124 Merge pull request 'gdo from the registry again: 0.4.0 is published' (#20) from gdo-0-4 into main
deploy / deploy (push) Successful in 58s
2026-11-24 19:13:14 +01:00
blandClaude eab1f55cf7 gdo from the registry again: 0.4.0 is published
The stack built gdo from a commit while the gdo that dials a 1.0 site
was held back from the [uhhm] registry. It is there now, so the image
installs the package as before and the deploy no longer compiles gdo.
The build checks that the installed version is the one GDO_RELEASE
names.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5fbDjTQg4CJsNqEo7hhE7
2026-11-24 19:13:04 +01:00
bl 3763271852 Merge pull request 'The stack for portal 1.0 (merging this is the switch)' (#19) from stack-1-0 into main
deploy / deploy (push) Successful in 13m51s
2026-11-24 18:30:59 +01:00
5 changed files with 132 additions and 38 deletions

No files matched your search

+23
View File
@@ -39,6 +39,12 @@ jobs:
PORTAL_RELEASE: ${{ vars.PORTAL_RELEASE }}
GDO_RELEASE: ${{ vars.GDO_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 }}
CONTENT_REPO: ${{ vars.CONTENT_REPO }}
CONTENT_BRANCH: ${{ vars.CONTENT_BRANCH }}
@@ -126,6 +132,15 @@ jobs:
[ -z "$missing" ] || { echo "COMPOSE_PROFILES has pay, but not set:$missing"; exit 1; }
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
mkdir -p "$STAGE"
# Interpolated by compose: hosts, versions, profiles. No secret.
@@ -137,6 +152,8 @@ jobs:
PORTAL_DHD=$PORTAL_DHD
COMPOSE_PROFILES=$COMPOSE_PROFILES
PAY_HOST=$PAY_HOST
CHAT_HOST=$CHAT_HOST
KINO_RELEASE=$KINO_RELEASE
RAUTHY_HOST=$RAUTHY_HOST
OIDC_ISSUER=$OIDC_ISSUER
EOF
@@ -186,6 +203,12 @@ jobs:
if [ -n "${!name}" ]; then echo "$name=${!name}"; fi
done
} > "$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.
cat > "$STAGE/rauthy.env" <<EOF
ENC_KEYS=$RAUTHY_ENC_KEY
+36 -3
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.
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
with it; the one that dials a 1.0 site (uhhm/kino) has no image yet.
`move-1.0/` is. The chat it had (cnats) spoke to portal over NATS and went
with it; uhhm/kino, which dials a 1.0 site, takes its place ("The chat").
## First start
@@ -47,6 +47,7 @@ it, and `host-caddy/tomtervel.no` is its file for them
- portal → `127.0.0.1:3050`
- kron → `127.0.0.1:3080`
- kino → `127.0.0.1:3070`
- rauthy → `127.0.0.1:8090`
## Accounts and groups
@@ -128,7 +129,7 @@ Run workflow**. Set them with `gt` (`gt variable set NAME --body ...`,
|---|---|---|---|
| `PORTAL_HOST`, `RAUTHY_HOST` | variable | repo | the site, the login; each needs DNS (`dns/`) and a kasse Caddy block |
| `PORTAL_RELEASE` | variable | **org** | a uhhm/portal tag; the content repo's lint reads the same one |
| `GDO_RELEASE`, `KRON_RELEASE` | variable | repo | the mailer, a tag or a commit of uhhm/gdo that the image is built from (`gdo/Dockerfile` says why), and the money service's image tag (`0.3.0` and on): the ones that dial a 1.0 site |
| `GDO_RELEASE`, `KRON_RELEASE` | variable | repo | the mailer's version as the [uhhm] registry has it (`v0.4.0` and on; the build fails when the registry's is another), and the money service's image tag (`0.3.0` and on): the ones that dial a 1.0 site |
| `COMPOSE_PROFILES` | variable | repo | `pay` |
| `DHD_KEYS`, `PORTAL_DHD` | variable | repo | the programs' keys and what each may do, and the site's key and address ([The site's own network](#the-sites-own-network)) |
| `PORTAL_BACKUP_TO`, `GARAGE_BACKUPS_BUCKET` | variable | repo | optional: an age public key and a bucket, for sealed copies of the store ([Backups](#backups)) |
@@ -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_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`) |
| `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) |
| `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 |
@@ -217,6 +220,36 @@ Going live, in order:
Nothing here touches the Vippsnummer (500396): people may keep paying
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](https://github.com/sebadob/rauthy) at `RAUTHY_HOST`
+37 -3
View File
@@ -111,6 +111,8 @@ services:
- "127.0.0.1:3050:3000"
# kron (betaling.tomtervel.no -> here).
- "127.0.0.1:3080:3080"
# kino (samtaler.tomtervel.no -> here).
- "127.0.0.1:3070:3070"
portal:
build:
@@ -228,9 +230,40 @@ services:
# content repo's reload reaches the site over HTTPS, so no in-compose
# 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
# ran here (cnats) spoke to portal over NATS, and the one that dials a
# 1.0 site (uhhm/kino) is not published as an image yet.
# The vel's conversations (uhhm/kino): every group the content names is
# a room, and the site decides who gets in. kino dials the site over
# 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
# `portal import` brings in. One node on this host, reachable only inside
@@ -249,6 +282,7 @@ volumes:
portal_data:
gdo_data:
kron_data:
kino_data:
caddy_data:
caddy_config:
nats_data:
+2 -2
View File
@@ -19,8 +19,8 @@ root=/srv/tomtervel/infrastructure
stage=/var/lib/gitea-runner/tomtervel-env
files=(.env portal.env)
# Written only when the site runs what needs it (Rauthy, the money
# service under the pay profile).
optional=(rauthy.env kron.env)
# service under the pay profile, the chat under the chat profile).
optional=(rauthy.env kron.env kino.env)
[ -d "$root/.git" ] || { echo "no checkout at $root - bootstrap it first" >&2; exit 1; }
for f in "${files[@]}"; do
+34 -30
View File
@@ -1,37 +1,41 @@
# gdo, the mailer, built from uhhm/gdo at GDO_RELEASE: a tag, or a commit.
# gdo, the mailer, from the [uhhm] Arch registry - the same package the
# bare-metal hosts install. Arch base rather than Debian because that is
# how every uhhm binary is published; portal ships a release tarball and
# is built from that instead.
#
# Built here rather than installed from the [uhhm] Arch registry, as it
# was while the site ran portal 0.19: the gdo that dials a portal 1.0
# site (0.4, which reads no NATS) is not in the registry yet, and is
# held back from it on purpose. A host that upgraded to it while it
# still has a 0.x site would stop sending that site's mail. Once 0.4 is
# published, this can install the package again (uhhm-registry.asc
# beside this file is the registry's key, kept for then).
#
# Arch for both stages, because that is what every uhhm binary is built
# on and run on: the runtime's glibc is then never older than the
# builder's.
FROM archlinux:base AS build
ARG GDO_RELEASE
# -Syu, never -Sy: a partial upgrade pulls a library newer than what the
# base image's own pacman was built against and refuses to install.
RUN pacman -Syu --noconfirm --needed git rust gcc \
&& pacman -Scc --noconfirm
WORKDIR /src
# The ref by name, so a tag and a commit both do; --locked, so the build
# is the one the repo's own lock file describes.
RUN test -n "$GDO_RELEASE" \
&& git init -q . \
&& git fetch -q --depth 1 https://project.uhhm.no/uhhm/gdo.git "$GDO_RELEASE" \
&& git checkout -q FETCH_HEAD \
&& cargo build --release --locked \
&& install -Dm755 target/release/gdo /out/gdo
# GDO_RELEASE is the version the site runs (v0.4.0 or later: 0.4 is the
# first that dials a portal 1.0 site). The registry serves one version,
# its newest, so the build checks that what it installed is the one
# named, and fails when the variable has fallen behind the registry.
FROM archlinux:base
RUN pacman -Syu --noconfirm --needed ca-certificates \
ARG GDO_RELEASE
# The registry's signing key, vendored beside this file. A fresh
# container trusts nothing, and the key is on no public keyserver, so
# `pacman-key --recv-keys` cannot find it - which is why this is here
# rather than fetched. It is a public key: checked in, not a secret.
#
# Vendored rather than turning the signature check off: the packages
# come over HTTPS from a host we run, and it would be easy to call that
# good enough, but then nothing would notice a package that host did
# not sign. Locally signed, the check stays real.
COPY uhhm-registry.asc /tmp/uhhm-registry.asc
RUN test -n "$GDO_RELEASE" \
&& pacman-key --init \
&& pacman-key --populate archlinux \
&& pacman-key --add /tmp/uhhm-registry.asc \
&& pacman-key --lsign-key 1BCBE90F04AD9859D7BCC9BB53CBF90AA4C56211 \
&& rm /tmp/uhhm-registry.asc \
&& printf '%s\n' \
'[uhhm]' \
'SigLevel = Required DatabaseOptional' \
'Server = https://project.uhhm.no/api/packages/bl/arch/$repo/$arch' \
>> /etc/pacman.conf \
&& pacman -Syu --noconfirm --needed ca-certificates gdo \
&& have=$(pacman -Q gdo | cut -d' ' -f2 | cut -d- -f1) \
&& { [ "$have" = "${GDO_RELEASE#v}" ] || { echo "the registry has gdo $have, GDO_RELEASE says $GDO_RELEASE" >&2; exit 1; }; } \
&& pacman -Scc --noconfirm \
&& rm -rf /var/cache/pacman/pkg/* /var/lib/pacman/sync/*
COPY --from=build /out/gdo /usr/bin/gdo
# A non-root user. gdo keeps its key on dhd/1 in /var/lib/gdo, a volume
# (GDO_KEY in compose.yml); what it has not yet delivered waits with the