- docs/unraid-infrastructure.md goes; host, network pattern, NPM, monitoring and the other containers now live in Tom/Infrastructure, referenced by its Gitea URL instead of a local path - deployment.md stays self-contained: new prerequisite for proxynet and NPM, dig by IP (AdGuard blocks rzone.de), no docker login needed on Unraid, drops the finished Compose Manager switch and the generic NPM/runner pitfalls - architektur.md AE-5 reflects the deploy from the repo and the Gitea secret - entwicklung.md lists all three services of compose.yaml - CLAUDE.md drops the obsolete YamlDotNet note (#50) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 KiB
Deployment
How a new version of the website ends up on Unraid: a merge to main runs
.gitea/workflows/deploy.yml, which builds the image, pushes it to the Gitea
registry and starts the stack on Unraid from the repo's compose.yaml. Nothing is
copied or pasted by hand.
The site runs as a three-container stack (project eb-stack): the Blazor app
(eb-blazor), a PocketBase container (eb-pocketbase) that holds the content,
and a DynDNS updater (eb-ddns) that keeps the domain pointed at the
connection. The stack is described by compose.yaml (the production base) with
overlays layered on top.
Running it locally is a separate document. For starting the stack on your own machine and for how the tests run, see
entwicklung.md. This document is only about getting a built image onto Unraid.
Prerequisites (one-time)
Everything needed to deploy is in this repo. Background on the server as a whole (other containers, the network pattern, NPM) is in the Infrastructure repo, https://gitea.anticarnist.de/Tom/Infrastructure — helpful, not required.
Server: proxynet and NPM
The deploy expects two things on Unraid that the stack does not create itself:
-
The external Docker network
proxynet, created once in the Unraid terminal:docker network create proxynetIt survives Docker restarts only with Settings → Docker → Advanced View → Preserve user defined networks: Yes; otherwise
compose upfails with "network proxynet not found". -
Nginx Proxy Manager attached to it (its container: Network Type → Custom: proxynet), so it reaches
eb-blazorandeb-pocketbaseby name. The proxy hosts themselves are below ("NPM proxy host", "Editor subdomain").
Gitea registry token
The push to the registry needs a Gitea access token with package write
permission (package: Read and Write) — not the account password.
- Gitea → top right profile picture → Settings → Applications.
- Manage Access Tokens section: assign a name (e.g.
registry-push). - Under Select scopes: set
packageto Read and Write. - Click Generate Token, copy the string immediately (shown only once).
The token is a secret. Never store it in plain text in Git, chats, screenshots, or tickets. If one does become visible: delete it in Gitea and generate a new one. A
packagetoken allows uploading arbitrary images to the registry.
The token goes into the repo secret REGISTRY_TOKEN (see "Automation"); the deploy
logs in with it on every run, so Unraid needs no docker login of its own. Only
the fallback scripts/release.sh needs a one-time docker login gitea.anticarnist.de on the machine it runs on.
DynDNS for elternbeirat-igmh.info (Strato)
The domain is registered at Strato; the site runs on the private connection,
whose public IP changes. eb-ddns (ddns-updater)
reports the current IP to Strato every five minutes. Why a container and why
ddns-updater: architektur.md, AE-5.
The whole updater config sits in compose.yaml (CONFIG), so deleting and
recreating the container needs no setup. The only thing outside the repo is the
DynDNS password.
-
Strato customer area → domain
elternbeirat-igmh.info→ DNS settings → Dynamic DNS → activate.wwwneeds nothing: it is a CNAME on the domain and follows on its own. -
Strato password: DynDNS accepts the package password or a separate DynDNS password, set under Security → Set passwords (not under Dynamic DNS). Use the separate one — the package password also opens the webspace.
-
Gitea → repo → Settings → Actions → Secrets: add
STRATO_DYNDNS_PASSWORD. The deploy hands it to compose, which fills it intoCONFIG. The password ends up inside JSON, so it must not contain"or\; avoid$and#as well. -
Run the workflow (Actions → Build and deploy → Run workflow).
docker logs eb-ddnsshowsUpdating record … to use <IP>with noERRORafter it. -
Check: the Strato nameservers answer with the public IP of the connection right away; public resolvers follow once their cache expires.
dig +short @217.160.80.132 elternbeirat-igmh.info217.160.80.132isdocks05.rzone.de; the name itself does not resolve in the LAN because AdGuard blocksrzone.de(Infrastructure repo,docs/lan.md).
Testing the credentials without the container — passing the IP the record
already has, so a successful login changes nothing (nochg); badauth means
domain or password are wrong:
curl -u elternbeirat-igmh.info "https://dyndns.strato.com/nic/update?hostname=elternbeirat-igmh.info&myip=<current IP>"
The DynDNS password is a secret like the registry token: only as a Gitea secret, never in Git. A missing value does not stop the stack; it shows up as a failed update in
docker logs eb-ddns. The dev overlay disableseb-ddns, so a localupnever touches the public DNS.
NPM proxy host
The NPM that already runs on Unraid fronts the site (why not one in the stack:
architektur.md, AE-6). The router forwards 80/443 to it.
Hosts → Proxy Hosts → Add Proxy Host:
| Tab | Field | Value |
|---|---|---|
| Details | Domain Names | elternbeirat-igmh.info, www.elternbeirat-igmh.info |
| Scheme / Forward Hostname / Port | http / eb-blazor / 8080 |
|
| Block Common Exploits | on | |
| Cache Assets, Websockets Support | off | |
| SSL | SSL Certificate | Request a new SSL Certificate (Let's Encrypt) |
| Force SSL, HTTP/2, HSTS | on | |
| HSTS Subdomains, DNS Challenge | off |
NPM and eb-blazor share the Docker network proxynet, so NPM reaches the app by
container name; the app publishes no host port (Infrastructure repo,
docs/networks.md).
Let's Encrypt asks the Strato nameservers directly,
so the certificate works as soon as DynDNS has updated, even while public
resolvers still cache the old IP.
Editor subdomain (redaktion.elternbeirat-igmh.info)
The editors reach the PocketBase admin at https://redaktion.elternbeirat-igmh.info/_/.
-
Strato → Domainverwaltung → Subdomain anlegen
redaktion→ its DNS → CNAME-Recordelternbeirat-igmh.info. Likewww, it follows the DynDNS IP on its own. -
eb-pocketbasejoinsproxynet(compose.yaml), so NPM reaches it by name. -
NPM proxy host:
Tab Field Value Details Domain Names redaktion.elternbeirat-igmh.infoonlyScheme / Forward Hostname / Port http/eb-pocketbase/8090Block Common Exploits, Websockets Support on SSL SSL Certificate Request a new SSL Certificate (Let's Encrypt) Force SSL, HTTP/2 on Advanced (gear icon) Custom Nginx Configuration see below PocketBase has nothing at
/; this sends the bare subdomain to the admin:location = / { return 302 https://$host/_/; }The full URL is needed: with a bare path (
return 302 /_/;) nginx adds its container port and the redirect lands on:4443.
General NPM pitfalls hit while setting this up (an extra www.redaktion… in
Domain Names, an empty custom location, the :4443 redirect) are in the
Infrastructure repo, docs/proxy.md.
The whole PocketBase API is public on this subdomain, not just the admin. That is fine as long as the collection API rules only allow reading; writing is for superusers, who bypass the rules (
redaktion.md).
Way of working: branches, never directly on main
main is the published state — only :latest is built from it, and only
:latest is pulled by Unraid. That is why we never commit directly to main:
- Create a feature branch:
git switch -c <area>/<short>(e.g.deployment/sha-tagging,content/pipeline). - Commit there, push the branch:
git push -u origin <branch>. - Open a Pull Request against
mainin Gitea and merge it there. - Only then build the release image from
main(below).
Dev builds stay local. For trying things out on your own machine, run the
dev stack (entwicklung.md) — it builds the web image from source and pushes
nothing, so a development state can never accidentally land in the registry as
:latest.
Rolling out a new version
Merge the pull request into main. The workflow then:
- builds the image and pushes it as
:latestand:<short-sha>(rollback), - pulls it on Unraid and runs
docker compose up -dwith the repo'scompose.yaml— only containers whose image or config changed are recreated, - checks
http://eb-blazor:8080/healthfrom insideproxynet(health gate). A red run means the new version is live but not healthy: roll back (below). - removes untagged images (
docker image prune -f) — the previous:latestloses its tag on every deploy and would pile up on Unraid otherwise.
Pushes that only touch docs/ or Markdown files trigger nothing. A manual run
(Actions → Build and deploy → Run workflow) redeploys the current
main.
The image path
gitea.anticarnist.de/tom/elternbeiratis lowercase — container registries require that in the path, even though the user (Tom) and the repo (Elternbeirat) are capitalized.
scripts/release.sh still builds and pushes by hand from main, as a fallback
when the runner is down. It does not deploy.
The compose files
compose.yaml is the production base; the workflow deploys it to Unraid as
is. It defines all services. eb-blazor publishes no host port and joins the
external network proxynet, so NPM is the only path to the web app.
eb-pocketbase joins proxynet too, for the editor subdomain, and publishes no
host port either. eb-pocketbase keeps its data on the bind mount
/mnt/user/appdata/pocketbase/pb_data, which only exists on the server.
The stack's own network has the fixed name eb-internal. Changing a network name
needs docker compose down and then up; a plain up fails because the existing
containers still point at the old network. proxynet, the network pattern and NPM
itself are server-wide and documented in the Infrastructure repo
(https://gitea.anticarnist.de/Tom/Infrastructure, docs/networks.md, docs/proxy.md).
The two overlays (compose.dev.yaml, compose.test.yaml) are for local
development and the tests and are not used on Unraid — see entwicklung.md.
Outage: PocketBase unreachable
If eb-pocketbase is down while eb-blazor runs, the app does not render
half-empty pages (the menu comes from PocketBase too). A gate in Program.cs
answers every page request with the static wwwroot/maintenance.html:
| Request | Answer while PocketBase is down |
|---|---|
Any page (/, /board, /posts/…, unknown slugs) |
503, Retry-After: 60, maintenance page |
/health |
503 PocketBase unreachable (for Uptime Kuma) |
/events.ics |
200 with an empty calendar, so subscriptions keep working |
/events/{id}.ics |
503 |
Static files (CSS, fonts, PDFs, /maintenance.html) |
served as usual |
The gate caches the health check for 10 seconds (PocketBaseHealthCache). So
after PocketBase stops, pages can render for up to 10 s more (the components
degrade on their own in that window: empty menu, a short note, 503), and after it
starts again the maintenance page can stay up for up to 10 s. No restart of the
web app is needed — the site comes back by itself.
maintenance.html carries its styles inline, as a copy of the tokens from
app.css. When colours change there, copy them over.
Rollback
Every image is also tagged with the short commit SHA, which — unlike the moving
:latest — never shifts. To roll back, pin that SHA in compose.yaml on a branch,
merge it and let the workflow deploy it:
image: gitea.anticarnist.de/tom/elternbeirat:99dd052 # instead of :latest
Which SHA tags are in the registry is shown by Gitea under
Tom/-/packages → elternbeirat.
Automation
Build and deploy (done)
.gitea/workflows/deploy.yml has two jobs: build (image → registry) and
deploy (compose up on Unraid + health gate). The deploy job works because the
act_runner runs on Unraid and passes its Docker socket into the job, so every
docker command there talks to the Unraid daemon.
Requires three repository secrets (Gitea → repo → Settings → Actions → Secrets):
REGISTRY_USER— the registry username (e.g.Tom).REGISTRY_TOKEN— a Gitea access token withpackage: write, not the login password.STRATO_DYNDNS_PASSWORD— the DynDNS password foreb-ddns(see above).
A failed health gate does not roll back on its own; that stays a deliberate step
(see "Rollback"). The runner itself (Docker socket, ubuntu-latest label) is
server-wide: Infrastructure repo, docs/apps/gitea.md.