Infra/hosting #63

Merged
Tom merged 2 commits from infra/hosting into main 2026-10-10 22:29:28 +02:00
5 changed files with 56 additions and 17 deletions
Showing only changes of commit 35073273d1 - Show all commits

No files matched your search

+1 -1
View File
@@ -13,6 +13,6 @@ GITEA_REPO=Tom/Elternbeirat
# PocketBase superuser login, used to read/write records via the REST API # PocketBase superuser login, used to read/write records via the REST API
# (e.g. migrating content) without loosening the collection API rules -- a # (e.g. migrating content) without loosening the collection API rules -- a
# superuser bypasses them. Create the superuser in the dashboard at <PB_URL>/_/. # superuser bypasses them. Create the superuser in the dashboard at <PB_URL>/_/.
PB_URL=http://<unraid-host>:8090 PB_URL=https://redaktion.elternbeirat-igmh.info
PB_ADMIN_EMAIL= PB_ADMIN_EMAIL=
PB_ADMIN_PASSWORD= PB_ADMIN_PASSWORD=
+10 -11
View File
@@ -2,11 +2,11 @@
# only PocketBase's data is a volume, everything else lives inside the images or # only PocketBase's data is a volume, everything else lives inside the images or
# in this file. # in this file.
# #
# NPM runs outside this stack (the `nginx` container on Unraid) and reaches the web # NPM runs outside this stack (the `nginx` container on Unraid) and reaches both the
# app by name over the external Docker network `proxynet` (eb-blazor:8080), so the # web app (eb-blazor:8080) and the PocketBase admin (eb-pocketbase:8090, for
# web app publishes no host port. The `ports:` block on PocketBase is TEMPORARY: it # redaktion.elternbeirat-igmh.info) by name over the external Docker network
# is the editors' way onto the admin UI until they reach it through an NPM subdomain # `proxynet`. No service publishes a host port: NPM is the only way in. Unraid
# (#9). Unraid setup: docs/unraid-infrastructure.md. # setup: docs/unraid-infrastructure.md.
# #
# On Unraid this file is deployed as is by .gitea/workflows/deploy.yml (project # On Unraid this file is deployed as is by .gitea/workflows/deploy.yml (project
# eb-stack), not pasted into the Compose Manager. # eb-stack), not pasted into the Compose Manager.
@@ -39,12 +39,11 @@ services:
volumes: volumes:
# The only state that must survive a restart or redeploy. # The only state that must survive a restart or redeploy.
- /mnt/user/appdata/pocketbase/pb_data:/pb_data - /mnt/user/appdata/pocketbase/pb_data:/pb_data
ports: networks:
# TEMPORARY: exposes the admin UI on the LAN (http://<unraid>:8090/_/) while # default: serve the web app. proxynet: be reached by NPM as eb-pocketbase:8090
# NPM is not in front yet. Replace once the editors reach PocketBase through an # for redaktion.elternbeirat-igmh.info.
# NPM subdomain (#9): NPM points at eb-pocketbase:8090 over a shared network, so - default
# this host mapping can go -- until then the admin has no other way in. - proxynet
- "8090:8090"
healthcheck: healthcheck:
# The image ships this endpoint; the web app waits for it to pass. # The image ships this endpoint; the web app waits for it to pass.
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8090/api/health"] test: ["CMD", "wget", "--spider", "-q", "http://localhost:8090/api/health"]
+41 -2
View File
@@ -103,6 +103,45 @@ Let's Encrypt asks the Strato nameservers directly,
so the certificate works as soon as DynDNS has updated, even while public so the certificate works as soon as DynDNS has updated, even while public
resolvers still cache the old IP. resolvers still cache the old IP.
### Editor subdomain (redaktion.elternbeirat-igmh.info)
The editors reach the PocketBase admin at
<https://redaktion.elternbeirat-igmh.info/_/>.
1. **Strato** → Domainverwaltung → **Subdomain anlegen** `redaktion` → its
**DNS** → **CNAME-Record** `elternbeirat-igmh.info`. Like `www`, it follows the
DynDNS IP on its own.
2. `eb-pocketbase` joins `proxynet` (`compose.yaml`), so NPM reaches it by name.
3. **NPM** proxy host:
| Tab | Field | Value |
|---|---|---|
| Details | Domain Names | `redaktion.elternbeirat-igmh.info` only |
| | Scheme / Forward Hostname / Port | `http` / `eb-pocketbase` / `8090` |
| | Block 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:
```nginx
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`.
Pitfalls: no `www.redaktion…` in Domain Names — it has no DNS record, and one
unknown name makes Let's Encrypt refuse the whole certificate. And no Custom
Location for `/`: an empty one without a forward target breaks the subdomain.
> **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 ## Way of working: branches, never directly on main
@@ -166,8 +205,8 @@ and there is no stale copy left there that could be started by accident.
`compose.yaml` is the **production** base; the workflow deploys it to Unraid as `compose.yaml` is the **production** base; the workflow deploys it to Unraid as
is. It defines is. It defines
all services. `eb-blazor` publishes no host port and joins the external network 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 `proxynet`, so NPM is the only path to the web app. `eb-pocketbase` joins
`8090` for the editors until they reach it through an NPM subdomain (see #9). `proxynet` too, for the editor subdomain, and publishes no host port either.
`eb-pocketbase` keeps its data on the bind mount `eb-pocketbase` keeps its data on the bind mount
`/mnt/user/appdata/pocketbase/pb_data`, which only exists on the server. `/mnt/user/appdata/pocketbase/pb_data`, which only exists on the server.
+1 -1
View File
@@ -22,7 +22,7 @@ Das Admin heißt „Redaktion Elternbeirat" und ist unter der PocketBase-Adresse
erreichbar: erreichbar:
- **Lokal:** <http://localhost:8090/_/> (Dev-Stack, siehe `entwicklung.md`). - **Lokal:** <http://localhost:8090/_/> (Dev-Stack, siehe `entwicklung.md`).
- **Auf dem Server:** über die NPM-Subdomain (Login von außen — noch offen, #9). - **Auf dem Server:** <https://redaktion.elternbeirat-igmh.info/_/>, von überall erreichbar.
Redakteure sind **Superuser**: jede vertraute Person aus dem Vorstand bekommt Redakteure sind **Superuser**: jede vertraute Person aus dem Vorstand bekommt
einen eigenen Superuser-Zugang (unter *Collections → System → `_superusers`*). einen eigenen Superuser-Zugang (unter *Collections → System → `_superusers`*).
+3 -2
View File
@@ -34,7 +34,7 @@ so the workflow's `docker compose` talks to the Unraid daemon directly.
| Container | Network | Container port | Host port | | Container | Network | Container port | Host port |
|---|---|---|---| |---|---|---|---|
| `eb-blazor` | `eb-internal`, `proxynet` | `8080` | – | | `eb-blazor` | `eb-internal`, `proxynet` | `8080` | – |
| `eb-pocketbase` | `eb-internal` | `8090` | `8090` | | `eb-pocketbase` | `eb-internal`, `proxynet` | `8090` | – |
| `eb-ddns` | `eb-internal` | – | – | | `eb-ddns` | `eb-internal` | – | – |
Persistent data: `/mnt/user/appdata/pocketbase/pb_data` → `/pb_data`. Persistent data: `/mnt/user/appdata/pocketbase/pb_data` → `/pb_data`.
@@ -56,13 +56,14 @@ The container is called **`nginx`** and runs on the network `proxynet`.
### Active proxy hosts ### Active proxy hosts
Except for the website, destinations use LAN host names (`unraid.server`), Except for the website stack, destinations use LAN host names (`unraid.server`),
resolved by the LAN DNS, never container IPs. That is why they kept working when resolved by the LAN DNS, never container IPs. That is why they kept working when
NPM moved from `bridge` to `proxynet`. NPM moved from `bridge` to `proxynet`.
| Source | Destination | SSL | | Source | Destination | SSL |
|---|---|---| |---|---|---|
| `elternbeirat-igmh.info`, `www.elternbeirat-igmh.info` | `http://eb-blazor:8080` | Let's Encrypt | | `elternbeirat-igmh.info`, `www.elternbeirat-igmh.info` | `http://eb-blazor:8080` | Let's Encrypt |
| `redaktion.elternbeirat-igmh.info` | `http://eb-pocketbase:8090` (`/` → `/_/`) | Let's Encrypt |
| `gitea.anticarnist.de` | `http://unraid.server:3005` | Let's Encrypt | | `gitea.anticarnist.de` | `http://unraid.server:3005` | Let's Encrypt |
| `cloud.anticarnist.de` | `https://unraid.server:44304` | Let's Encrypt | | `cloud.anticarnist.de` | `https://unraid.server:44304` | Let's Encrypt |
| `home.anticarnist.de` | `http://unraid.server:44303` | Let's Encrypt | | `home.anticarnist.de` | `http://unraid.server:44303` | Let's Encrypt |