From 8d7606bbe897e5b92e3b4581c7e84d4fa1aef93b Mon Sep 17 00:00:00 2001 From: Adam French Date: Thu, 1 Oct 2026 14:58:17 +0100 Subject: [PATCH] Retire quartz, hasura and autoheal into .deprecated/ 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 --- .deprecated/README.md | 34 +++++++++++ .../autoheal/docker-compose.autoheal.yml | 27 +++++++++ .deprecated/hasura/docker-compose.hasura.yml | 23 ++++++++ .deprecated/hasura/nginx-locations.conf | 21 +++++++ {quartz => .deprecated/quartz}/Dockerfile | 0 {quartz => .deprecated/quartz}/entrypoint.sh | 0 .../quartz}/quartz.config.ts.template | 0 .../quartz}/quartz.layout.ts | 0 .env.example | 9 +-- DEPLOYMENT.md | 31 +++++----- README.md | 14 +---- backend/Dockerfile | 4 +- docker-compose.dev.yml | 5 -- docker-compose.yml | 58 +++---------------- nginx/entrypoint.sh | 3 +- nginx/nginx.conf.template | 27 ++------- nginx/nginx_dev_common.conf.template | 23 +------- vue/src/views/admin/Login.vue | 4 +- 18 files changed, 140 insertions(+), 143 deletions(-) create mode 100644 .deprecated/README.md create mode 100644 .deprecated/autoheal/docker-compose.autoheal.yml create mode 100644 .deprecated/hasura/docker-compose.hasura.yml create mode 100644 .deprecated/hasura/nginx-locations.conf rename {quartz => .deprecated/quartz}/Dockerfile (100%) rename {quartz => .deprecated/quartz}/entrypoint.sh (100%) rename {quartz => .deprecated/quartz}/quartz.config.ts.template (100%) rename {quartz => .deprecated/quartz}/quartz.layout.ts (100%) diff --git a/.deprecated/README.md b/.deprecated/README.md new file mode 100644 index 0000000..50c5aa6 --- /dev/null +++ b/.deprecated/README.md @@ -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. diff --git a/.deprecated/autoheal/docker-compose.autoheal.yml b/.deprecated/autoheal/docker-compose.autoheal.yml new file mode 100644 index 0000000..ca1965a --- /dev/null +++ b/.deprecated/autoheal/docker-compose.autoheal.yml @@ -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: --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 diff --git a/.deprecated/hasura/docker-compose.hasura.yml b/.deprecated/hasura/docker-compose.hasura.yml new file mode 100644 index 0000000..a29a3a3 --- /dev/null +++ b/.deprecated/hasura/docker-compose.hasura.yml @@ -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" diff --git a/.deprecated/hasura/nginx-locations.conf b/.deprecated/hasura/nginx-locations.conf new file mode 100644 index 0000000..e3022b1 --- /dev/null +++ b/.deprecated/hasura/nginx-locations.conf @@ -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"; + } diff --git a/quartz/Dockerfile b/.deprecated/quartz/Dockerfile similarity index 100% rename from quartz/Dockerfile rename to .deprecated/quartz/Dockerfile diff --git a/quartz/entrypoint.sh b/.deprecated/quartz/entrypoint.sh similarity index 100% rename from quartz/entrypoint.sh rename to .deprecated/quartz/entrypoint.sh diff --git a/quartz/quartz.config.ts.template b/.deprecated/quartz/quartz.config.ts.template similarity index 100% rename from quartz/quartz.config.ts.template rename to .deprecated/quartz/quartz.config.ts.template diff --git a/quartz/quartz.layout.ts b/.deprecated/quartz/quartz.layout.ts similarity index 100% rename from quartz/quartz.layout.ts rename to .deprecated/quartz/quartz.layout.ts diff --git a/.env.example b/.env.example index 9e423ee..356d6ad 100644 --- a/.env.example +++ b/.env.example @@ -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. diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index e8b6552..d98559b 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -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. diff --git a/README.md b/README.md index 05ecc00..78fed61 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/backend/Dockerfile b/backend/Dockerfile index c81a1d9..0c28742 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -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/* diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 5432e06..a2ef99b 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -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. diff --git a/docker-compose.yml b/docker-compose.yml index 7500ab1..967a450 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: --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. diff --git a/nginx/entrypoint.sh b/nginx/entrypoint.sh index 5179379..c59892e 100755 --- a/nginx/entrypoint.sh +++ b/nginx/entrypoint.sh @@ -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 diff --git a/nginx/nginx.conf.template b/nginx/nginx.conf.template index 4f3399b..58c80c0 100644 --- a/nginx/nginx.conf.template +++ b/nginx/nginx.conf.template @@ -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 diff --git a/nginx/nginx_dev_common.conf.template b/nginx/nginx_dev_common.conf.template index e678ddf..48d6ab1 100644 --- a/nginx/nginx_dev_common.conf.template +++ b/nginx/nginx_dev_common.conf.template @@ -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/; } diff --git a/vue/src/views/admin/Login.vue b/vue/src/views/admin/Login.vue index c607d07..a6303f7 100644 --- a/vue/src/views/admin/Login.vue +++ b/vue/src/views/admin/Login.vue @@ -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