Portal 1.0 keeps everything in one file (portal_data) and has no NATS. gdo and kron dial it over dhd/1 from loopback, so the three share one network namespace, held by a container of its own: held by portal, a restart of portal cut the other two off. NATS stays behind a profile nothing turns on, for going back; the chat (cnats) is out. The deploy writes DHD_KEYS and the hash of LOAD_TOKEN, and no NATS or chat settings. gdo is built from uhhm/gdo at GDO_RELEASE, since the gdo that dials a site is not in the registry. move.sh reads the programs' keys and prints what the deploy wants. Run on kasse beside the live stack, on other ports, with made-up records: mail out, a payment settled, content loaded over /dhd/1/load, and both programs back after portal was restarted and made anew. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5fbDjTQg4CJsNqEo7hhE7
266 lines
10 KiB
YAML
266 lines
10 KiB
YAML
# Tomter Vel's own platform: portal, its own Rauthy, and the programs
|
|
# beside the site (gdo for mail, kron for Vipps) as podman containers.
|
|
# The content (pages, forms, desks) is not here: portal fetches it from
|
|
# tomtervel/questions on prosjekt.klingenbergbygg.no, at start and when
|
|
# that repo's CI asks it to (POST /dhd/1/load). This repo owns identity,
|
|
# which portal version runs, and where the site keeps what is its own:
|
|
# one file, in the volume portal_data. TLS depends on where it runs: on a
|
|
# standalone host the bundled Caddy (`--profile edge`) terminates it; on
|
|
# kasse the host Caddy already owns 80/443 and reverse-proxies
|
|
# tomtervel.no -> portal (127.0.0.1:3050).
|
|
#
|
|
# Everything it runs with is an Actions variable or secret, written by
|
|
# the deploy workflow (README.md); `podman compose up -d --build` is
|
|
# what deploy-tomtervel runs.
|
|
|
|
name: tomtervel
|
|
|
|
services:
|
|
caddy:
|
|
# Bundled TLS for a standalone host only: `podman compose --profile edge up`.
|
|
# On kasse the host Caddy already owns 80/443 (it reverse-proxies
|
|
# vel.klingenbergbygg.no -> 127.0.0.1:3050, the portal port below), so this
|
|
# is profiled off there to avoid the port clash. Default `up` skips it.
|
|
profiles: ["edge"]
|
|
image: caddy:2
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
- "443:443/udp"
|
|
environment:
|
|
PORTAL_HOST: ${PORTAL_HOST}
|
|
RAUTHY_HOST: ${RAUTHY_HOST}
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
depends_on:
|
|
- portal
|
|
- rauthy
|
|
|
|
# The NATS portal 0.19 kept everything on. Nothing of the 1.0 stack
|
|
# reads it: it is here, behind a profile nothing turns on, so its
|
|
# container and its volume (nats_data) stay as they are for as long as
|
|
# going back to 0.19 should be possible (move-1.0/README.md). Take it
|
|
# out, and the volume, once it is not.
|
|
nats:
|
|
profiles: ["nats-0-19"]
|
|
image: nats:2.14.6-alpine
|
|
restart: unless-stopped
|
|
command: ["-c", "/etc/nats/nats.conf"]
|
|
env_file:
|
|
- path: nats.env
|
|
required: false
|
|
volumes:
|
|
- ./nats/nats.conf:/etc/nats/nats.conf:ro
|
|
- nats_data:/data
|
|
ports:
|
|
- "127.0.0.1:4223:4222"
|
|
|
|
# Rauthy: who is who. Sign-in, account pages and account mail, in
|
|
# Norwegian; portal signs in here (OIDC_ISSUER) and portal
|
|
# makes accounts here (RAUTHY_API_KEY). Its database is embedded
|
|
# (hiqlite), in rauthy_data. Host-published for kasse's host Caddy
|
|
# (RAUTHY_HOST -> here).
|
|
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"
|
|
|
|
# The network the site and the programs beside it share. gdo and kron
|
|
# dial the site from loopback to loopback (DHD_BIND, 127.0.0.1:4300
|
|
# unless set), so the three must be in one network namespace, and it
|
|
# must outlive each of them: held by portal itself, a restart of portal
|
|
# left gdo and kron in the namespace it had, cut off, until they were
|
|
# made anew. This container does nothing but hold it. What any of the
|
|
# three needs of the network is said here: the published ports, the
|
|
# way to the host's mail server, and the name `portal` on the project's
|
|
# network.
|
|
net:
|
|
image: docker.io/library/alpine:3.22
|
|
restart: unless-stopped
|
|
command: ["sleep", "infinity"]
|
|
# sleep as the first process hears no SIGTERM.
|
|
stop_signal: SIGKILL
|
|
extra_hosts:
|
|
- "host.containers.internal:host-gateway"
|
|
networks:
|
|
default:
|
|
aliases:
|
|
- portal
|
|
ports:
|
|
# Host-published for kasse's host Caddy (tomtervel.no -> portal).
|
|
# With --profile edge the bundled Caddy proxies portal:3000
|
|
# internally instead, but publishing loopback-only is harmless
|
|
# there.
|
|
- "127.0.0.1:3050:3000"
|
|
# kron (betaling.tomtervel.no -> here).
|
|
- "127.0.0.1:3080:3080"
|
|
|
|
portal:
|
|
build:
|
|
context: ./portal
|
|
args:
|
|
PORTAL_RELEASE: ${PORTAL_RELEASE}
|
|
# Named, so the content repo's preview (tomtervel/questions,
|
|
# lint-and-reload.yml) runs the very image this site runs.
|
|
image: localhost/tomtervel-portal:${PORTAL_RELEASE}
|
|
restart: unless-stopped
|
|
# Written by the deploy workflow from the Actions variables and
|
|
# secrets (README.md has the table).
|
|
env_file: portal.env
|
|
environment:
|
|
LEPTOS_SITE_ADDR: 0.0.0.0:3000
|
|
LEPTOS_SITE_ROOT: site
|
|
LEPTOS_HASH_FILES: "true"
|
|
LEARN_CACHE: /app/learn-cache
|
|
OLLAMA_HOST: http://100.64.0.1:11434
|
|
# What the site calls itself to the programs beside it. Must not
|
|
# change: kron and the mail name the site by it.
|
|
SITE_NAME: tomtervel
|
|
# Everything the site keeps: its records and their history, the
|
|
# mail and payments that wait, the sessions. One file, opened by
|
|
# this container alone; site.key beside it is the site's key on
|
|
# dhd/1. A new volume is a new, empty site.
|
|
PORTAL_STORE: /data/site.redb
|
|
volumes:
|
|
- learn_cache:/app/learn-cache
|
|
- portal_data:/data
|
|
network_mode: "service:net"
|
|
depends_on:
|
|
net:
|
|
condition: service_started
|
|
rauthy:
|
|
condition: service_started
|
|
|
|
# The mailer. Portal decides what to send - a `mail:` on a state in the
|
|
# content, or an invite - and keeps it in its own `mail` outbox; gdo
|
|
# dials the site over dhd/1 (PORTAL_DHD), is handed what waits there,
|
|
# and hands each to a mail server. It has none of its own: it relays
|
|
# through the host's, which on kasse is Klingenberg Bygg's postfix on
|
|
# port 25. That is the one thing here the vel borrows.
|
|
#
|
|
# The site must name gdo's key in DHD_KEYS as `<key>=mail,note`; gdo
|
|
# says the key as it starts, and move-1.0/move.sh reads it out.
|
|
gdo:
|
|
build:
|
|
context: ./gdo
|
|
args:
|
|
GDO_RELEASE: ${GDO_RELEASE}
|
|
# Named, so move-1.0/move.sh can start it once to read its key.
|
|
image: localhost/tomtervel-gdo:${GDO_RELEASE}
|
|
restart: unless-stopped
|
|
network_mode: "service:net"
|
|
environment:
|
|
PORTAL_DHD: ${PORTAL_DHD:-}
|
|
# Its key on dhd/1, kept across rebuilds: a new key is one the
|
|
# site does not know.
|
|
GDO_KEY: /var/lib/gdo/gdo.key
|
|
# Set, so gdo sends through it and asks the site's owners for
|
|
# nothing. The host, from inside the container: podman resolves
|
|
# this to the gateway (extra_hosts on net); the host's postfix
|
|
# listens on 0.0.0.0:25.
|
|
SMTP_HOST: host.containers.internal
|
|
SMTP_PORT: "25"
|
|
# A strict server refuses a bare container hostname in EHLO.
|
|
SMTP_HELO: ${PORTAL_HOST}
|
|
volumes:
|
|
- gdo_data:/var/lib/gdo
|
|
depends_on:
|
|
- portal
|
|
|
|
# The money service (uhhm/kron): a household that owes its fee waits
|
|
# in portal's `payments` outbox; kron dials the site over dhd/1, takes
|
|
# the request, gives it a link to pay by, talks to Vipps's ePayment API
|
|
# for the Medlemskap sales unit, and tells the site `paid` as a move on
|
|
# the payment. Vipps's keys are in kron.env and nowhere else; portal
|
|
# never calls Vipps. Its ledger is a file of its own in kron_data.
|
|
# Reached by kasse's host Caddy on the published 3080
|
|
# (betaling.tomtervel.no): the pay links, the page people come back to
|
|
# from Vipps, and Vipps's webhooks. A profile, since it needs kron.env:
|
|
# COMPOSE_PROFILES has `pay` once the keys are set.
|
|
#
|
|
# The site must name kron's key in DHD_KEYS as `<key>=payments`.
|
|
kron:
|
|
profiles: ["pay"]
|
|
image: project.uhhm.no/uhhm/kron:${KRON_RELEASE:-no-tag-set}
|
|
restart: unless-stopped
|
|
network_mode: "service:net"
|
|
env_file:
|
|
- kron.env
|
|
environment:
|
|
PORTAL_DHD: ${PORTAL_DHD:-}
|
|
# Must be the portal's own: a request names its site.
|
|
SITE_NAME: tomtervel
|
|
PROVIDER: vipps
|
|
VIPPS_ENV: prod
|
|
PUBLIC_URL: https://${PAY_HOST:-no-host-set}
|
|
# 3080, not 3000: in the shared network 3000 is portal's.
|
|
LISTEN_ADDR: 0.0.0.0:3080
|
|
# Its key on dhd/1 and, beside it, its ledger (kron.redb).
|
|
KRON_KEY: /var/lib/kron/kron.key
|
|
# With the four VIPPS_* in kron.env kron asks the site for
|
|
# nothing, and this identity is not used.
|
|
KRON_IDENTITY_FILE: /var/lib/kron/identity
|
|
KRON_LANG: nb
|
|
volumes:
|
|
- kron_data:/var/lib/kron
|
|
depends_on:
|
|
- portal
|
|
|
|
# The Gitea Actions runner is a host service on kasse (pacman
|
|
# gitea-runner), registered against prosjekt.klingenbergbygg.no. The
|
|
# 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.
|
|
|
|
# Where uploads go: the pictures and documents a desk attaches, and what
|
|
# `portal import` brings in. One node on this host, reachable only inside
|
|
# the project; nothing is published. go-live.sh garage renders
|
|
# garage/garage.toml (gitignored: it holds the node's rpc secret), makes
|
|
# the bucket and the key, and puts the four GARAGE_* in portal.env.
|
|
garage:
|
|
image: docker.io/dxflrs/garage:v2.3.0
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./garage/garage.toml:/etc/garage.toml:ro
|
|
- garage_data:/var/lib/garage
|
|
|
|
volumes:
|
|
garage_data:
|
|
portal_data:
|
|
gdo_data:
|
|
kron_data:
|
|
caddy_data:
|
|
caddy_config:
|
|
nats_data:
|
|
rauthy_data:
|
|
learn_cache:
|
|
|
|
# Pin the project network subnet inside 172.16/12 so Rauthy's trusted
|
|
# proxies (rauthy/config.toml) stay valid under Podman — its default pool
|
|
# hands out 10.89.x addresses that the forwarded client IP can't match.
|
|
networks:
|
|
default:
|
|
ipam:
|
|
config:
|
|
- subnet: 172.18.0.0/16
|