Retire quartz, hasura and autoheal into .deprecated/
Deploy with Docker Compose / deploy (push) Successful in 1m1s

Quartz was already replaced by silverbullet-public; its build context moves
to .deprecated/quartz. Hasura and autoheal are removed from the stack, with
their compose services (and Hasura's nginx blocks) kept verbatim under
.deprecated/ alongside a README on how to bring each back.

Removes the /hasura/ route from both nginx templates and the envsubst
allow-list, and updates the docs and comments that referred to the three
services. With autoheal gone nothing restarts an unhealthy container; the
healthchecks are now informational only, and the docs say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-01 14:58:17 +01:00
co-authored by Claude Opus 5.5
parent e25fbbab96
commit 8d7606bbe8
18 changed files with 140 additions and 143 deletions
+34
View File
@@ -0,0 +1,34 @@
# .deprecated
STATUS: nothing in here is live. No compose file, nginx template or script
references this directory. It is kept, not deleted, in line with the repo's
"legacy is kept" convention; the full history is also in git.
## quartz/
The static-site build that used to serve `/notes/`. Replaced by the read-only
`silverbullet-public` service (PR #6). Its compose service and nginx route were
removed at that point; only the build context survives here.
## hasura/
Admin-only DB console that was proxied at `/hasura/`.
- `docker-compose.hasura.yml` — the service, verbatim.
- `nginx-locations.conf` — the upstream variable and `location` blocks that
were in both `nginx.conf.template` and `nginx_dev_common.conf.template`.
To bring it back: layer the compose file
(`docker compose -f docker-compose.yml -f .deprecated/hasura/docker-compose.hasura.yml up`),
paste the nginx blocks back into both templates, re-add `${HASURA_HOST}
${HASURA_PORT}` to `ENVSUBST_VARS` in `nginx/entrypoint.sh`, and set
`HASURA_HOST`, `HASURA_PORT` and `HASURA_GRAPHQL_ADMIN_SECRET` in `.env`. Dev
mode additionally set `HASURA_GRAPHQL_ENABLE_CONSOLE` and
`HASURA_GRAPHQL_DEV_MODE` to `"true"`.
## autoheal/
Watchdog that restarted any container docker marked `unhealthy` (only `backend`
and `python` define healthchecks). It mounts the docker socket, which is
effectively root on the host. To bring it back, layer
`docker-compose.autoheal.yml` the same way as above.
@@ -0,0 +1,27 @@
# STATUS: deprecated — not part of the stack. See ../README.md for how to bring
# it back. Kept verbatim from docker-compose.yml.
services:
# Watchdog: docker itself marks a container `unhealthy` but never acts on it.
# autoheal polls the docker socket and restarts anything that goes unhealthy.
# AUTOHEAL_CONTAINER_LABEL=all means "watch every container that defines a
# healthcheck" (i.e. backend and python) rather than only labelled ones.
# It mounts the docker socket, which is effectively root on the host — that
# is the price of the feature. Because of that the image is pinned BY DIGEST,
# not by a floating tag: `:latest` meant any future push to Docker Hub would
# silently gain root on the Pi at the next `docker compose pull`/`up`. The
# digest below is a multi-arch index (it includes linux/arm64, which is what
# the Pi pulls) and was the content of `willfarrell/autoheal:latest` at the
# time of pinning. To bump it: pull the new tag, `docker image inspect
# willfarrell/autoheal:<tag> --format '{{index .RepoDigests 0}}'`, and paste
# the digest here — never go back to a bare tag.
# Deliberately NOT on app-network: it talks only to the socket.
autoheal:
image: willfarrell/autoheal@sha256:4ce976e9033b41426d44633295d6a08f9bc5929b27866352d91b31d4f6b26447
container_name: autoheal
restart: always
environment:
- AUTOHEAL_CONTAINER_LABEL=all
- AUTOHEAL_INTERVAL=30
- AUTOHEAL_START_PERIOD=60
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@@ -0,0 +1,23 @@
# STATUS: deprecated — not part of the stack. See ../README.md for how to bring
# it back. Kept verbatim from docker-compose.yml, so it still relies on that
# file's `db` service and `app-network`, and must be layered on top of it.
services:
# Admin-only DB browser, reached at /hasura/. Console and dev mode are OFF in
# production (turned on by the dev override). It is additionally gated in
# nginx by an `auth_request` subrequest to the backend's /auth/validate-admin,
# so an admin cookie is required before the request ever reaches Hasura —
# the admin secret alone is not the only line of defence.
hasura:
image: hasura/graphql-engine:v2.44.0
container_name: "${HASURA_HOST}"
restart: always
depends_on:
- db
networks:
- app-network
environment:
HASURA_GRAPHQL_DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
HASURA_GRAPHQL_ENABLE_CONSOLE: "false"
HASURA_GRAPHQL_DEV_MODE: "false"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: "startup, http-log, webhook-log, websocket-log, query-log"
+21
View File
@@ -0,0 +1,21 @@
# STATUS: deprecated. The /hasura/ blocks removed from nginx.conf.template and
# nginx_dev_common.conf.template (identical in both). See ../README.md.
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
location /hasura {
return 301 /hasura/;
}
location /hasura/ {
auth_request /internal/auth/admin-validate;
error_page 401 403 = @auth_denied;
rewrite ^/hasura/(.*)$ /$1 break;
proxy_pass $upstream_hasura;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
+1 -8
View File
@@ -5,7 +5,7 @@
# same file, and it is worth knowing which is which:
# 1. ${VAR} interpolation in docker-compose.yml. Done by the compose CLI when
# it parses the file, before any container exists. This is how container
# names, published ports and the Hasura database URL are built.
# names and published ports are built.
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
# variables inside that container. nginx, backend, db, icecast2,
# certbot and gitea all do this.
@@ -158,13 +158,6 @@ CLAUDE_API_KEY=
STEAM_API_KEY=
STEAM_ID=
# --- Hasura (admin-only DB console at /hasura/) ------------------------------
# Additionally gated by an nginx auth_request against the backend's admin check,
# so the admin secret is not the only barrier.
HASURA_GRAPHQL_ADMIN_SECRET=
HASURA_HOST=hasura
HASURA_PORT=8080
# --- Development-only switch -------------------------------------------------
# Leave EMPTY/false in production. docker-compose.dev.yml sets SEED_DB=true for
# local work; setting it on the Pi would inject test data into the live site.
+13 -18
View File
@@ -29,13 +29,13 @@ Only three things are reachable from outside the Pi: nginx on 80/443, Gitea on
--------------------------------------------- | (same container
| | | | | | | as icecast2)
v v v v v v | |
/api/ /radio/ /gitea/ /hasura/ /notes/ /py/ | |
backend icecast2 gitea hasura sb-pub python | |
| ^ | | |
| | | | |
| +------------------|--------------------|---------------+
| | |
+----------+-----------------+--------------------+
/api/ /radio/ /gitea/ /sb/ /notes/ /py/ | |
backend icecast2 gitea sb sb-pub python | |
| ^ | |
| | | |
| +---------------------------------------|---------------+
| |
+----------+--------------------------------------+
v
+------+
| db | postgres:16
@@ -43,7 +43,6 @@ backend icecast2 gitea hasura sb-pub python | |
vue one-shot build container -> writes vue_dist volume -> nginx serves it
certbot no ports; shares ./certbot/conf and ./certbot/www with nginx
autoheal no network; watches the docker socket and restarts unhealthy containers
```
### Who listens where
@@ -53,7 +52,6 @@ backend icecast2 gitea hasura sb-pub python | |
| nginx | `nginx` | 80, 443 | — | **80, 443** |
| backend (Go) | `${BACKEND_HOST}` | `${BACKEND_PORT}` (8080) | `${BACKEND_ENDPOINT}` = `/api/` | no |
| db (Postgres 16) | `${POSTGRES_HOST}` | 5432 | none | no |
| hasura | `${HASURA_HOST}` | `${HASURA_PORT}` | `/hasura/` (admin-gated) | no |
| silverbullet (editor) | `${SILVERBULLET_HOST}` | `${SILVERBULLET_PORT}` | `/sb/` (admin-gated) | no |
| silverbullet-public (notes site) | `${SILVERBULLET_PUBLIC_HOST}` | `${SILVERBULLET_PUBLIC_PORT}` | `/notes/` (**public**, read-only) | no |
| silverbullet-git | n/a | n/a | none (timer loop) | no |
@@ -62,7 +60,6 @@ backend icecast2 gitea hasura sb-pub python | |
| gitea | `${GITEA_HOST}` | 3000, 2222 | `/gitea/` | **3000, 2222** |
| vue | `vue` | 5173 (dev only) | `/` (dev only) | no |
| certbot | `certbot` | — | — | no |
| autoheal | `autoheal` | — | — | no |
Container names come from `.env`, and nginx builds its upstreams from the same
variables. **Renaming a `*_HOST` value renames the container and repoints nginx
@@ -80,7 +77,7 @@ in one step — never change one without the other.**
- **Per-request DNS.** Upstreams go through `set $upstream_* ...` variables with
`resolver 127.0.0.11`, so names resolve per request. nginx boots fine with a
backend down (502s until it appears) instead of refusing to start.
- **Admin gate.** `/hasura/`, `/sb/`, `/radio/admin/` and `/uploads/private/` are protected by an `auth_request`
- **Admin gate.** `/sb/`, `/radio/admin/` and `/uploads/private/` are protected by an `auth_request`
subrequest to the backend's `/auth/validate-admin`; a failure redirects to the
SPA login. None of these services has any auth of its own at that path.
- **Public notes privacy boundary.** `/notes/` is public, and the only thing
@@ -139,7 +136,6 @@ The override layer changes five services and disables one:
`:443` serve the whole site, no HSTS, no HTTP→HTTPS redirect.
- **backend** — `DEV_MODE`, GraphQL playground and introspection on, a localhost
Spotify redirect URI, and **`SEED_DB=true`**.
- **hasura** — console and dev mode on.
- **python** — `uvicorn --reload` with `python/app` bind-mounted.
- **certbot** — put in the `disabled` profile, so it never starts. Let's Encrypt
cannot validate localhost anyway.
@@ -235,7 +231,7 @@ All configuration lives in **`./.env`** at the repo root, which is gitignored.
Two distinct mechanisms read it, and services use both:
- **`${VAR}` in `docker-compose.yml`** — substituted by the compose CLI at parse
time. Builds container names, published ports, the Hasura database URL.
time. Builds container names and published ports.
- **`env_file: ./.env`** — injects the whole file into the container. Used by
nginx, backend, db, icecast2, certbot.
@@ -377,9 +373,10 @@ icecast source password. liquidsoap pre-empts the fallback playlist immediately
silence. Adding MP3s to `icecast2/fallback_music/` is picked up live
(`reload_mode="watch"`) with no restart.
**Unhealthy containers** are restarted automatically by `autoheal`, which polls
the docker socket every 30s. Only `backend` and `python` define healthchecks, so
only they are covered.
**Unhealthy containers are not restarted automatically.** `backend` and `python`
define healthchecks, but the `autoheal` watchdog that acted on them was retired
(`.deprecated/autoheal`), so `unhealthy` is only visible in `docker ps`.
`restart: always` still brings back a container whose process exits.
---
@@ -405,5 +402,3 @@ Documented, not fixed — each would change deploy behaviour.
today (neither contains whitespace) but a latent quoting bug.
7. **`UPTIMEKUMA_*` and `WALLABAG_*` are substituted by nginx but no compose
service provides them** — leftovers from removed services.
8. **`autoheal` mounts the docker socket**, which is effectively root on the
host, and uses the `:latest` tag.
+3 -11
View File
@@ -27,8 +27,6 @@ silverbullet (3000) ── Obsidian Notes Editor (SilverBullet 2.11.0)
silverbullet-public (3000) ── Public read-only notes site (same image, SB_READ_ONLY)
silverbullet-git ── Commits/pushes notes edits to the notes repo
python (8000) ── Python API (FastAPI)
hasura (8080) ── Hasura GraphQL Engine (Docker profile: hasura)
autoheal ── Auto-restart unhealthy containers
certbot ── SSL Certificate Management (disabled in dev)
```
@@ -57,11 +55,10 @@ certbot ── SSL Certificate Management (disabled in dev)
- Printable CV with role-specific sections
- Job application tracker with status workflow and CSV export (admin-only, `/cv/jobs`)
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
- Hasura GraphQL console (admin-only)
- Admin-gated routes: `/notes`, `/sb`, `/hasura` require admin JWT via Nginx `auth_request`
- Admin-gated routes: `/notes`, `/sb` require admin JWT via Nginx `auth_request`
- Landing page with animated stamps section
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
- Backend healthcheck with autoheal container for automatic recovery
- Backend healthcheck (reported in `docker ps`; nothing restarts on it)
## Pages
@@ -183,13 +180,12 @@ Access tokens are valid for 7 days; refresh tokens for 365 days. `ValidateAdmin`
| `/api` | backend:8080 | API (rate limited: 30r/s) |
| `/radio` | icecast:8000 | Audio streaming |
| `/gitea` | gitea:3000 | Git service |
| `/hasura` | hasura:8080 | GraphQL console + WebSocket (admin-only) |
| `/notes` | silverbullet-public:3000 | Obsidian notes (public, read-only) |
| `/sb` | silverbullet:3000 | Obsidian notes editor (admin-only) |
| `/py` | python:8000 | Python API (FastAPI; docs at `/py/docs`) |
| `/uploads` | local alias | User-uploaded files |
`/hasura` and `/sb` are protected by `auth_request` to `GET /api/auth/validate-admin`. Requests without a valid admin JWT are rejected with 401.
`/sb` is protected by `auth_request` to `GET /api/auth/validate-admin`. Requests without a valid admin JWT are rejected with 401.
### Deprecated Endpoints
@@ -249,9 +245,6 @@ Create a `.env` file in the project root. All services read from this file.
| `CLAUDE_API_KEY` | Anthropic Claude API key |
| `STEAM_API_KEY` | Steam Web API key |
| `STEAM_ID` | Steam user ID |
| `HASURA_GRAPHQL_ADMIN_SECRET` | Hasura admin secret |
| `HASURA_HOST` | Hasura hostname (use `hasura` for Docker) |
| `HASURA_PORT` | Hasura port (typically `8080`) |
| `PYTHON_HOST` | Python API hostname (defaults to `python`) |
| `PYTHON_PORT` | Python API port (defaults to `8000`) |
| `SEED_DB` | Set to `true` to seed test data on startup |
@@ -319,7 +312,6 @@ This:
- Disables certbot
- Seeds the database with test data (`SEED_DB=true`)
- Enables GraphQL playground and introspection
- Enables Hasura console and dev mode
Visit `http://localhost` to test.
+2 -2
View File
@@ -46,8 +46,8 @@ FROM debian:bookworm-slim
# wget is not just for humans: the compose healthcheck probes the server with
# `wget -qO- http://localhost:8080/`, and without it in the image every probe
# fails as "executable file not found" — Docker then marks the container
# unhealthy and autoheal kills it in a ~90s restart loop.
# fails as "executable file not found" and Docker marks the container
# unhealthy.
RUN apt-get update \
&& apt-get install --yes --no-install-recommends ca-certificates wget \
&& rm -rf /var/lib/apt/lists/*
-5
View File
@@ -14,7 +14,6 @@
# - backend : dev flags on, including database seeding.
# - nginx : DEV_MODE=true, which makes its entrypoint render
# nginx_dev.conf.template and self-sign a localhost certificate.
# - hasura : console and dev mode enabled so the GraphQL console is usable.
# - python : uvicorn --reload with the app source bind-mounted.
# - certbot : disabled entirely.
#
@@ -68,10 +67,6 @@ services:
ports:
- 80:80
- 443:443
hasura:
environment:
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
python:
# Same command as the Dockerfile's CMD plus --reload, paired with the
# source bind mount below so editing python/app/ restarts uvicorn.
+7 -51
View File
@@ -21,7 +21,7 @@
# app config from env_file.
#
# Required by this file: POSTGRES_{USER,PASSWORD,DB,PORT,HOST},
# POSTGRES_GITEA_DB, BACKEND_HOST, HASURA_HOST, HASURA_GRAPHQL_ADMIN_SECRET,
# POSTGRES_GITEA_DB, BACKEND_HOST,
# ICECAST_HOST, GITEA_HOST, OBSIDIAN_DIR, and the GITEA_*
# secrets. PYTHON_HOST/PYTHON_PORT/TFL_APP_KEY/LIQUIDSOAP_HARBOR_PORT have
# inline defaults.
@@ -36,7 +36,7 @@
# WHAT IS PUBLISHED TO THE HOST
# Only nginx (80, 443), gitea (3000 HTTP, 2222 SSH) and the liquidsoap harbor
# port. Everything else is reachable only from inside app-network, which is
# why the backend, db, hasura, silverbullet and python have no `ports:` — they are
# why the backend, db, silverbullet and python have no `ports:` — they are
# deliberately not exposed and are reached through nginx.
# =============================================================================
@@ -111,7 +111,6 @@ services:
- backend
- icecast2
- gitea
- hasura
- silverbullet
- silverbullet-public
- python
@@ -187,9 +186,11 @@ services:
# Shared with icecast2, which plays these as the radio fallback playlist;
# the backend reads them to report what is queued.
- ./icecast2/fallback_music:/backend/fallback_music
# Reported to docker (and therefore to autoheal, below), which restarts the
# container after 3 consecutive failures ~90s apart. start_period gives the
# Go process 10s to bind before failures start counting.
# Reported to docker only: nothing acts on `unhealthy` since the autoheal
# watchdog was retired (.deprecated/autoheal), so this just shows up in
# `docker ps`. `restart: always` covers a crashed process, not a hung one.
# start_period gives the Go process 10s to bind before failures start
# counting.
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8080/"]
interval: 30s
@@ -197,31 +198,6 @@ services:
retries: 3
start_period: 10s
# Watchdog: docker itself marks a container `unhealthy` but never acts on it.
# autoheal polls the docker socket and restarts anything that goes unhealthy.
# AUTOHEAL_CONTAINER_LABEL=all means "watch every container that defines a
# healthcheck" (i.e. backend and python) rather than only labelled ones.
# It mounts the docker socket, which is effectively root on the host — that
# is the price of the feature. Because of that the image is pinned BY DIGEST,
# not by a floating tag: `:latest` meant any future push to Docker Hub would
# silently gain root on the Pi at the next `docker compose pull`/`up`. The
# digest below is a multi-arch index (it includes linux/arm64, which is what
# the Pi pulls) and was the content of `willfarrell/autoheal:latest` at the
# time of pinning. To bump it: pull the new tag, `docker image inspect
# willfarrell/autoheal:<tag> --format '{{index .RepoDigests 0}}'`, and paste
# the digest here — never go back to a bare tag.
# Deliberately NOT on app-network: it talks only to the socket.
autoheal:
image: willfarrell/autoheal@sha256:4ce976e9033b41426d44633295d6a08f9bc5929b27866352d91b31d4f6b26447
container_name: autoheal
restart: always
environment:
- AUTOHEAL_CONTAINER_LABEL=all
- AUTOHEAL_INTERVAL=30
- AUTOHEAL_START_PERIOD=60
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Single Postgres instance serving TWO databases: ${POSTGRES_DB} for the Go
# backend and ${POSTGRES_GITEA_DB} for Gitea. The postgres image only creates
# POSTGRES_DB on first init, so the Gitea database was created by hand once;
@@ -259,26 +235,6 @@ services:
retries: 10
start_period: 90s
# Admin-only DB browser, reached at /hasura/. Console and dev mode are OFF in
# production (turned on by the dev override). It is additionally gated in
# nginx by an `auth_request` subrequest to the backend's /auth/validate-admin,
# so an admin cookie is required before the request ever reaches Hasura —
# the admin secret alone is not the only line of defence.
hasura:
image: hasura/graphql-engine:v2.44.0
container_name: "${HASURA_HOST}"
restart: always
depends_on:
- db
networks:
- app-network
environment:
HASURA_GRAPHQL_DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
HASURA_GRAPHQL_ENABLE_CONSOLE: "false"
HASURA_GRAPHQL_DEV_MODE: "false"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: "startup, http-log, webhook-log, websocket-log, query-log"
# Internet radio: one container running BOTH icecast2 (the streaming server
# listeners connect to, proxied at /radio/) and liquidsoap (the source that
# feeds it). See icecast2/entrypoint.sh.
+1 -2
View File
@@ -67,7 +67,6 @@
# BACKEND_ENDPOINT URL prefix the API is mounted at (e.g. /api)
# ICECAST_HOST / ICECAST_PORT radio stream upstream
# GITEA_HOST / GITEA_PORT git server upstream
# HASURA_HOST / HASURA_PORT Hasura console upstream
# SILVERBULLET_HOST / _PORT notes editor upstream (defaulted below)
# SILVERBULLET_PUBLIC_HOST / _PORT
# public notes viewer upstream (defaulted below)
@@ -96,7 +95,7 @@ export SILVERBULLET_PUBLIC_PORT="${SILVERBULLET_PUBLIC_PORT:-3000}"
# The envsubst allow-list, defined once and reused by both full-config branches
# so the two lists cannot drift apart. It MUST stay single-quoted here and be
# passed as "$ENVSUBST_VARS" (one argument) below.
ENVSUBST_VARS='${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${HASURA_HOST} ${HASURA_PORT} ${SILVERBULLET_HOST} ${SILVERBULLET_PORT} ${SILVERBULLET_PUBLIC_HOST} ${SILVERBULLET_PUBLIC_PORT} ${PYTHON_HOST} ${PYTHON_PORT}'
ENVSUBST_VARS='${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${SILVERBULLET_HOST} ${SILVERBULLET_PORT} ${SILVERBULLET_PUBLIC_HOST} ${SILVERBULLET_PUBLIC_PORT} ${PYTHON_HOST} ${PYTHON_PORT}'
# Check if DEV_MODE
if [ "$DEV_MODE" = "true" ]; then
+4 -23
View File
@@ -11,7 +11,7 @@
# TEMPLATING
# Only the names in the envsubst allow-list in nginx/entrypoint.sh are
# substituted: DOMAIN, BACKEND_HOST/PORT/ENDPOINT, ICECAST_*, GITEA_*,
# HASURA_*, SILVERBULLET_*, PYTHON_*, UPTIMEKUMA_*, WALLABAG_*. Every other dollar
# SILVERBULLET_*, PYTHON_*, UPTIMEKUMA_*, WALLABAG_*. Every other dollar
# token in this file is an nginx RUNTIME variable (host, remote_addr, uri,
# http_upgrade, proxy_add_x_forwarded_for, binary_remote_addr, request_uri,
# scheme, http_cookie) and must be left alone — that restriction is the whole
@@ -164,7 +164,6 @@ http {
set $upstream_backend http://$BACKEND_HOST:$BACKEND_PORT;
set $upstream_icecast http://$ICECAST_HOST:$ICECAST_PORT;
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
set $upstream_silverbullet http://$SILVERBULLET_HOST:$SILVERBULLET_PORT;
set $upstream_silverbullet_public http://$SILVERBULLET_PUBLIC_HOST:$SILVERBULLET_PUBLIC_PORT;
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
@@ -205,7 +204,7 @@ http {
# PRIVATE attachments (admin-only). Attachments on *private* chat
# messages are written by the backend to /backend/uploads/private/ and
# must not be readable by the public, so this subpath is put behind the
# same admin `auth_request` used for /hasura/ and /sb/. nginx picks
# same admin `auth_request` used for /sb/. nginx picks
# the LONGEST matching prefix location, so this block wins over the
# public /uploads/ block below for /uploads/private/* regardless of
# ordering. Same three hardening headers as the public block, because
@@ -376,7 +375,7 @@ http {
# surface — kick sources, change metadata — protected only by the
# icecast admin password, and it was reachable from the public
# internet through this proxy. Put it behind the same admin
# `auth_request` as /hasura/ and /sb/ so an admin session cookie is
# `auth_request` as /sb/ so an admin session cookie is
# required before the request ever reaches icecast. Longest-prefix
# matching means this wins over /radio/ below; listener traffic
# (/radio/$ICECAST_MOUNT, /radio/status.xsl) is untouched.
@@ -413,24 +412,6 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
}
location /hasura {
return 301 /hasura/;
}
location /hasura/ {
auth_request /internal/auth/admin-validate;
error_page 401 403 = @auth_denied;
rewrite ^/hasura/(.*)$ /$1 break;
proxy_pass $upstream_hasura;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /notes {
return 301 /notes/;
}
@@ -551,7 +532,7 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
}
# ---- Admin gate (/hasura/, /sb/, /radio/admin/, /uploads/private/) ----
# ---- Admin gate (/sb/, /radio/admin/, /uploads/private/) ----
# `auth_request` makes nginx fire a subrequest here before serving the
# real one; a 2xx lets it through, 401/403 triggers error_page ->
# @auth_denied -> redirect to the SPA login. This puts the Go backend's
+2 -21
View File
@@ -27,7 +27,6 @@
set $upstream_backend http://$BACKEND_HOST:$BACKEND_PORT;
set $upstream_icecast http://$ICECAST_HOST:$ICECAST_PORT;
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
set $upstream_silverbullet http://$SILVERBULLET_HOST:$SILVERBULLET_PORT;
set $upstream_silverbullet_public http://$SILVERBULLET_PUBLIC_HOST:$SILVERBULLET_PUBLIC_PORT;
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
@@ -35,7 +34,7 @@
# PRIVATE attachments (admin-only). Attachments on *private* chat
# messages are written by the backend to /backend/uploads/private/ and
# must not be readable by the public, so this subpath is put behind the
# same admin `auth_request` used for /hasura/ and /sb/. nginx picks
# same admin `auth_request` used for /sb/. nginx picks
# the LONGEST matching prefix location, so this block wins over the
# public /uploads/ block below for /uploads/private/* regardless of
# ordering. Same three hardening headers as the public block, because
@@ -118,7 +117,7 @@
# surface — kick sources, change metadata — protected only by the
# icecast admin password, and it was reachable from the public
# internet through this proxy. Put it behind the same admin
# `auth_request` as /hasura/ and /sb/ so an admin session cookie is
# `auth_request` as /sb/ so an admin session cookie is
# required before the request ever reaches icecast. Longest-prefix
# matching means this wins over /radio/ below; listener traffic
# (/radio/$ICECAST_MOUNT, /radio/status.xsl) is untouched.
@@ -155,24 +154,6 @@
proxy_set_header X-Forwarded-Proto $scheme;
}
location /hasura {
return 301 /hasura/;
}
location /hasura/ {
auth_request /internal/auth/admin-validate;
error_page 401 403 = @auth_denied;
rewrite ^/hasura/(.*)$ /$1 break;
proxy_pass $upstream_hasura;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /notes {
return 301 /notes/;
}
+2 -2
View File
@@ -4,7 +4,7 @@
*
* The `?redirect=` is set by two different gates: the SPA router guard
* (`meta.requiresAdmin`) and nginx's `auth_request` gate in front of the
* proxied containers (/notes/, /sb/, /hasura/). The latter means the
* proxied containers (/notes/, /sb/). The latter means the
* destination is frequently NOT a Vue route, so see goTo() below.
*
* auth.logIn() never throws — it swallows the error — so success is detected by
@@ -26,7 +26,7 @@ const errorMsg = ref("");
// Send the browser to `dest`, choosing SPA navigation vs. a real page load.
//
// nginx bounces /notes/, /sb/ and /hasura/ here when the admin cookie is
// nginx bounces /notes/ and /sb/ here when the admin cookie is
// missing; those paths belong to other containers, so router.push() would just
// match the catch-all 404 route and never leave the SPA. Resolving the path
// first tells us which it is: the catch-all matches everything, so landing on