Put the site behind NPM via proxynet, add Strato DynDNS updater
- eb-blazor joins the external network proxynet and publishes no host port; NPM forwards to eb-blazor:8080 by name - Stack network gets the fixed name eb-internal (Compose Manager derives the project name from the stack folder); the dev overlay resets it and turns proxynet into a local network - eb-ddns keeps the A record of elternbeirat-igmh.info at Strato current - docs/unraid-infrastructure.md records the actual Unraid state Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
53cee04396
commit
4968b62f06
6 files changed
+267
-28
No files matched your search
@@ -12,9 +12,10 @@ nachlesen, bevor eine davon in Frage gestellt wird.
|
||||
|
||||
| Thema | Datei |
|
||||
|---|---|
|
||||
| Warum SSR statt WASM, warum PocketBase als Datenschicht (AE-1 bis AE-4) | `docs/architektur.md` |
|
||||
| Warum SSR statt WASM, warum PocketBase als Datenschicht, DynDNS und Proxy (AE-1 bis AE-6) | `docs/architektur.md` |
|
||||
| Stack lokal starten, Tests, compose-Overlays | `docs/entwicklung.md` |
|
||||
| Unraid, compose, NPM-Proxy-Host, Registry, Rollback | `docs/deployment.md` |
|
||||
| Ist-Zustand auf Unraid: Container, Netzwerke, Ports | `docs/unraid-infrastructure.md` |
|
||||
| Inhalte anlegen und ändern (PocketBase-Admin) | `docs/redaktion.md` |
|
||||
| Impressum, Datenschutz, Fotos | `docs/recht.md` |
|
||||
| Offene Arbeit, Meilensteine, offene Punkte | Gitea-Issues (Milestone „Elternbeirat-Website") |
|
||||
|
||||
@@ -42,5 +42,21 @@ services:
|
||||
ports:
|
||||
- "5000:8080" # web app at http://localhost:5000
|
||||
|
||||
eb-ddns:
|
||||
# Never update the public DNS from a dev machine. A profile nobody enables keeps
|
||||
# the service out of `up`.
|
||||
profiles: [disabled]
|
||||
|
||||
networks:
|
||||
default:
|
||||
# Back to the project-derived name (eb-stack_default, eb-test-stack_default), so
|
||||
# the dev and test stacks don't share one network and the tests' `down` does not
|
||||
# try to remove the network the dev stack still uses.
|
||||
name: !reset null
|
||||
proxynet:
|
||||
# The base expects NPM's network on Unraid. Locally there is no NPM, so compose
|
||||
# creates a project-local network instead of failing on the missing external one.
|
||||
external: false
|
||||
|
||||
volumes:
|
||||
pb_data_dev: # throwaway local volume; remove with `docker volume rm`
|
||||
+43
-17
@@ -1,15 +1,13 @@
|
||||
# Base compose: production-like. Both services; only PocketBase's data is a volume,
|
||||
# everything else lives inside the images.
|
||||
#
|
||||
# The two `ports:` blocks below are TEMPORARY. The target state is NPM in front:
|
||||
# NPM terminates TLS and is the only path to the web app, and the editors reach
|
||||
# PocketBase through an NPM subdomain (#9). NPM still needs a target address and
|
||||
# port, so a port stays reachable either way -- the plan is to reach the containers
|
||||
# by name over a shared Docker network (e.g. eb-blazor:8080) instead of publishing
|
||||
# them on the LAN, and to drop these host mappings that expose the site and admin UI
|
||||
# to anyone on the LAN. While NPM is not set up yet, these mappings are the only way
|
||||
# onto the site and the admin UI.
|
||||
# Base compose: production-like. PocketBase, the web app and the DynDNS updater;
|
||||
# only PocketBase's data is a volume, everything else lives inside the images or
|
||||
# in this file.
|
||||
#
|
||||
# NPM runs outside this stack (the `nginx` container on Unraid) and reaches the web
|
||||
# app by name over the external Docker network `proxynet` (eb-blazor:8080), so the
|
||||
# web app publishes no host port. The `ports:` block on PocketBase is TEMPORARY: it
|
||||
# is the editors' way onto the admin UI until they reach it through an NPM subdomain
|
||||
# (#9). Unraid setup: docs/unraid-infrastructure.md.
|
||||
|
||||
# For local development use the dev overlay on top, which adds host ports and builds
|
||||
# the web image from source:
|
||||
# docker compose -f compose.yaml -f compose.dev.yaml up --build
|
||||
@@ -58,9 +56,37 @@ services:
|
||||
TZ: Europe/Berlin
|
||||
# The web app reads content from PocketBase over the compose network.
|
||||
PocketBase__BaseUrl: http://eb-pocketbase:8090
|
||||
ports:
|
||||
# TEMPORARY: reach the site on the LAN (http://<unraid>:5000) while NPM is not
|
||||
# in front yet. Replace once NPM terminates TLS and fronts the site (#9): join
|
||||
# the external NPM network and let NPM point at eb-blazor:8080 by name, so this
|
||||
# host mapping can go and the site is no longer open on the LAN.
|
||||
- "5000:8080"
|
||||
networks:
|
||||
# default: reach eb-pocketbase. proxynet: be reached by NPM as eb-blazor:8080.
|
||||
- default
|
||||
- proxynet
|
||||
|
||||
eb-ddns:
|
||||
# Keeps the A record of elternbeirat-igmh.info at Strato pointed at the current
|
||||
# public IP of the connection. The FritzBox can't do it: its single DynDNS slot
|
||||
# already serves anticarnist.de. www is a CNAME on the domain and follows on its
|
||||
# own. The whole config lives here in CONFIG, so the container needs no config
|
||||
# file and no volume -- only the password comes from the stack's env
|
||||
# (STRATO_DYNDNS_PASSWORD, never in the repo). The ":-" default keeps dev and
|
||||
# tests quiet, where the service is disabled. Setup: docs/deployment.md.
|
||||
image: qmcgaw/ddns-updater:2.10
|
||||
container_name: eb-ddns
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
TZ: Europe/Berlin
|
||||
PERIOD: 5m
|
||||
CONFIG: >-
|
||||
{"settings":[
|
||||
{"provider":"strato","domain":"elternbeirat-igmh.info","password":"${STRATO_DYNDNS_PASSWORD:-}","ip_version":"ipv4"}
|
||||
]}
|
||||
|
||||
networks:
|
||||
default:
|
||||
# A fixed name instead of the project-derived one: the Compose Manager names the
|
||||
# project after the stack folder (elternbeirat_default otherwise). Changing it
|
||||
# needs Compose Down + Up; a plain Up leaves containers on the old network.
|
||||
name: eb-internal
|
||||
proxynet:
|
||||
# Created once on Unraid (`docker network create proxynet`) and shared with NPM.
|
||||
# The dev overlay turns it into a local network, so no machine but Unraid needs it.
|
||||
external: true
|
||||
@@ -82,6 +82,44 @@ to the outside. NPM terminates TLS and is the only path to the container.
|
||||
`UseForwardedHeaders` with emptied `KnownNetworks`/`KnownProxies` is correct because
|
||||
the container has no port mapping and is reachable only through NPM.
|
||||
|
||||
## AE-5: DynDNS as a container in the stack (ddns-updater)
|
||||
|
||||
**Decision:** The A record of `elternbeirat-igmh.info` at Strato is kept current by
|
||||
`eb-ddns` ([ddns-updater](https://github.com/qdm12/ddns-updater)), a third service
|
||||
in `compose.yaml`. Its whole configuration is the `CONFIG` environment variable in
|
||||
that file; only the DynDNS password comes from the stack's env
|
||||
(`STRATO_DYNDNS_PASSWORD`).
|
||||
|
||||
**Rationale:** The site runs on the private connection, whose public IP changes.
|
||||
The FritzBox has a single DynDNS slot and it already serves `anticarnist.de`, so
|
||||
the update has to run elsewhere. Putting it in the stack means it moves with the
|
||||
site. ddns-updater was chosen over ddclient because of where the config lives:
|
||||
ddclient needs a config file, which would have to sit next to the stack on the
|
||||
server (the Unraid stack is maintained by hand, not from a checkout) and be set up
|
||||
again whenever the container or its folder is deleted. ddns-updater takes the whole
|
||||
config from one environment variable, so `compose.yaml` alone describes it and the
|
||||
container can be deleted and recreated without any setup — only the one secret
|
||||
stays outside the repo.
|
||||
|
||||
**Consequence:** No volume, so ddns-updater keeps no update history across
|
||||
recreations; it just checks the IP again on start. The dev overlay disables the
|
||||
service, so a local `up` never changes the public DNS. Setup:
|
||||
`deployment.md`.
|
||||
|
||||
## AE-6: No proxy in the stack
|
||||
|
||||
**Decision:** NPM is **not** part of `eb-stack`. The site uses the NPM that already
|
||||
runs on Unraid.
|
||||
|
||||
**Rationale:** A host has only one 80/443, and the router forwards it to one target.
|
||||
A second NPM in the stack would collide with the existing one, which also serves
|
||||
`anticarnist.de`. Which proxy owns 80/443 is a property of the host, not of the
|
||||
site.
|
||||
|
||||
**Consequence:** Moving the site to another host means setting up a proxy there and
|
||||
recreating one proxy host (domain → app, Let's Encrypt). The steps are in
|
||||
`deployment.md`.
|
||||
|
||||
## Rejected alternatives (for AE-1)
|
||||
|
||||
| Alternative | Why not |
|
||||
|
||||
+79
-10
@@ -4,9 +4,10 @@ How a new version of the website ends up on Unraid. Current state:
|
||||
**manual** — build the image locally, push it to the Gitea registry, pull it on
|
||||
Unraid. Automation via Gitea Actions comes later.
|
||||
|
||||
The site runs as a **two-container stack** (project `eb-stack`): the Blazor app
|
||||
(`eb-blazor`) plus a PocketBase container (`eb-pocketbase`) that holds the
|
||||
content. The stack is described by `compose.yaml` (the production base) with
|
||||
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
|
||||
@@ -34,6 +35,78 @@ permission** (`package: Read and Write`) — **not** the account password.
|
||||
|
||||
The Docker login then stores the token locally, so it only has to be entered once.
|
||||
|
||||
### 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](https://github.com/qdm12/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.
|
||||
|
||||
1. **Strato** customer area → domain `elternbeirat-igmh.info` → DNS settings →
|
||||
**Dynamic DNS** → activate. `www` needs nothing: it is a CNAME on the domain
|
||||
and follows on its own.
|
||||
2. **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.
|
||||
3. **Compose Manager Plus** → stack **eb-stack** → env file: add
|
||||
|
||||
```ini
|
||||
STRATO_DYNDNS_PASSWORD=<DynDNS password>
|
||||
```
|
||||
|
||||
**No quotes** — Compose Manager Plus passed them on as part of the password,
|
||||
which Strato answered with `badauth`. The password ends up inside JSON, so it
|
||||
must not contain `"` or `\`; avoid `$` and `#` as well.
|
||||
4. **Compose Down**, then **Compose Up** (a plain restart keeps the old env).
|
||||
`docker logs eb-ddns` shows `Updating record … to use <IP>` with no `ERROR`
|
||||
after it.
|
||||
5. Check: the Strato nameservers answer with the public IP of the connection
|
||||
right away; public resolvers follow once their cache expires.
|
||||
|
||||
```bash
|
||||
dig +short @docks05.rzone.de elternbeirat-igmh.info
|
||||
```
|
||||
|
||||
**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:
|
||||
|
||||
```bash
|
||||
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 in the stack's
|
||||
> env on the server, 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 disables
|
||||
> `eb-ddns`, so a local `up` never 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 (`unraid-infrastructure.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.
|
||||
|
||||
---
|
||||
|
||||
## Way of working: branches, never directly on main
|
||||
@@ -113,19 +186,15 @@ In the **Compose Manager Plus** plugin (Unraid web interface):
|
||||
## The compose files
|
||||
|
||||
`compose.yaml` is the **production** base and is the file Unraid uses. It defines
|
||||
both services with no host port mappings — in production NPM is the only path to
|
||||
the web app, and the editors reach PocketBase through an NPM subdomain (see #9).
|
||||
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` still publishes
|
||||
`8090` for the editors until they reach it through an NPM subdomain (see #9).
|
||||
`eb-pocketbase` keeps its data on the bind mount
|
||||
`/mnt/user/appdata/pocketbase/pb_data`, which only exists on the server.
|
||||
|
||||
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`.
|
||||
|
||||
> **NPM network (still open).** The base does not yet attach `eb-blazor` to the
|
||||
> external NPM Docker network; while the domain has not moved, add a temporary
|
||||
> `ports:` mapping (e.g. `5000:8080`) to reach the app on the LAN, and swap it for
|
||||
> the `npm` external network once NPM sits in front. Tracked with #9.
|
||||
|
||||
---
|
||||
|
||||
## Outage: PocketBase unreachable
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# Unraid infrastructure
|
||||
|
||||
What runs on the Unraid host and how the website stack fits in. This is the
|
||||
**actual state** on the server. How to deploy a new version: `deployment.md`.
|
||||
|
||||
## Host
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| LAN IP | `192.168.1.14` |
|
||||
| Web UI | `https://unraid.server:44302` |
|
||||
| Version | Unraid OS 7.0.1 |
|
||||
| Stack management | Compose Manager plugin, stack `elternbeirat` |
|
||||
| Docker network for NPM | `proxynet` (created with `docker network create proxynet`) |
|
||||
|
||||
**Settings → Docker → Advanced View → Preserve user defined networks: Yes.**
|
||||
Without it Unraid deletes `proxynet` on every Docker restart, and every container
|
||||
attached to it fails to start.
|
||||
|
||||
## Website stack
|
||||
|
||||
The stack is created in the Compose Manager under the name `elternbeirat`. Its
|
||||
compose content is a copy of `compose.yaml` **without the comments**, pasted
|
||||
into the stack's config in the Unraid UI.
|
||||
|
||||
> **The project name comes from the stack folder, not from `name:`.** The
|
||||
> Compose Manager starts the stack with `-p elternbeirat`, which overrides
|
||||
> `name: eb-stack`. Renaming the stack in the UI does not change it. That is why
|
||||
> `compose.yaml` gives the stack's network the fixed name `eb-internal` instead of
|
||||
> the derived `elternbeirat_default`. Changing a network name needs **Compose Down**
|
||||
> and then **Compose Up**; a plain Up fails because the existing containers still
|
||||
> point at the old network.
|
||||
|
||||
| Container | Network | Container port | Host port |
|
||||
|---|---|---|---|
|
||||
| `eb-blazor` | `eb-internal`, `proxynet` | `8080` | – |
|
||||
| `eb-pocketbase` | `eb-internal` | `8090` | `8090` |
|
||||
| `eb-ddns` | `eb-internal` | – | – |
|
||||
|
||||
Persistent data: `/mnt/user/appdata/pocketbase/pb_data` → `/pb_data`.
|
||||
|
||||
## Nginx Proxy Manager
|
||||
|
||||
The container is called **`nginx`** and runs on the network `proxynet`.
|
||||
|
||||
| Container port | Host port |
|
||||
|---|---|
|
||||
| `8080` (HTTP) | `80` |
|
||||
| `4443` (HTTPS) | `443` |
|
||||
| admin UI | `7818` (`http://192.168.1.14:7818`) |
|
||||
| config | `/mnt/cache/appdata/nginx` → `/config` |
|
||||
|
||||
> **Why `proxynet` and not `bridge`:** Docker's default `bridge` has no name
|
||||
> resolution. On `proxynet` NPM reaches `eb-blazor:8080` by name, so the site needs
|
||||
> no host port.
|
||||
|
||||
### Active proxy hosts
|
||||
|
||||
Except for the website, destinations use LAN host names (`unraid.server`),
|
||||
resolved by the LAN DNS, never container IPs. That is why they kept working when
|
||||
NPM moved from `bridge` to `proxynet`.
|
||||
|
||||
| Source | Destination | SSL |
|
||||
|---|---|---|
|
||||
| `elternbeirat-igmh.info`, `www.elternbeirat-igmh.info` | `http://eb-blazor:8080` | Let's Encrypt |
|
||||
| `gitea.anticarnist.de` | `http://unraid.server:3005` | Let's Encrypt |
|
||||
| `cloud.anticarnist.de` | `https://unraid.server:44304` | Let's Encrypt |
|
||||
| `home.anticarnist.de` | `http://unraid.server:44303` | Let's Encrypt |
|
||||
| `assistant.anticarnist.de` | `http://192.168.1.15:8123` | Let's Encrypt |
|
||||
|
||||
Further hosts (`*.katzenfunk.de`, `anticarnist.de` → `arch.server` / SearXNG)
|
||||
exist but are offline and unused.
|
||||
|
||||
## Other containers on the host
|
||||
|
||||
Except for AdGuard, all of these run on `bridge` and have nothing to do with the
|
||||
website. They are listed so it is clear which ports are taken.
|
||||
|
||||
| Container | Host ports |
|
||||
|---|---|
|
||||
| AdGuard-Home | own IP `192.168.1.7` (`br0`) |
|
||||
| flame | `44303` |
|
||||
| Gitea | `2205` (SSH), `3005` (HTTP) |
|
||||
| Gitea-Runner | – |
|
||||
| nextcloud | `44304` |
|
||||
| piper | `10200` |
|
||||
| postgresql15 | `5432` |
|
||||
| SearXNG | `1234` (stopped) |
|
||||
| UptimeKuma | `3001` |
|
||||
Reference in new issue
Block a user