Author SHA1 Message Date
adamfandClaude Opus 5.5 d843b0baf1 Make the stamps wall bounce at every page size
The wall was a wrapping flex row with a fixed 4-stamp min-width, so it only
overflowed (and so only bounced) when its cell was narrower than that. At
tablet widths the cell is wider, the wall fitted, and horizontal motion
stopped.

Lay it out as a fixed-track grid whose column and row counts come from the
cell's own size via a ResizeObserver, always one to two stamps larger than
the cell on both axes, cycling the stamps to fill every slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 15:04:04 +01:00
adamfandClaude Opus 5.5 8d7606bbe8 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]>
2026-10-01 14:58:17 +01:00
adamf e25fbbab96 Merge pull request 'Replace Quartz with a read-only SilverBullet for public /notes/' (#6) from silverbullet-public-notes into main
Deploy with Docker Compose / deploy (push) Successful in 29s
Reviewed-on: https://www.adam-french.co.uk/gitea/adamf/web_server/pulls/6
2026-10-01 14:47:54 +01:00
19 changed files with 219 additions and 165 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
+78 -21
View File
@@ -5,10 +5,15 @@
* The order is shuffled on module load so the wall looks different each visit.
* The rAF loop then drifts the scroll position diagonally and bounces off each
* edge — it drives the DOM's scrollLeft/scrollTop directly rather than any
* reactive state, and reads scrollWidth/clientWidth each frame because images
* load in progressively and change the bounds.
* reactive state, and reads scrollWidth/clientWidth each frame because the
* wall is re-sized whenever the cell is.
*
* The wall is a fixed-track grid whose column and row counts are derived from
* the cell's own size (see fitWall), so it always overflows on both axes. A
* wrapping flex row only overflowed when the cell happened to be narrower than
* the wall, which left it motionless at tablet widths.
*/
import { ref, onMounted, onUnmounted } from "vue";
import { ref, computed, onMounted, onUnmounted } from "vue";
import Touchscreen from "@/components/util/Touchscreen.vue";
import Link from "@/components/text/Link.vue";
@@ -34,7 +39,56 @@ let srcs = [
// page load but stable while the widget is mounted. Mutates in place.
shuffleArray(srcs);
// The two linked stamps stay first; the shuffled local ones follow.
const stamps = [
{
src: "https://www.adam-french.co.uk/img/stamps/mine.gif",
alt: "adam-french.co.uk",
href: "https://www.adam-french.co.uk",
},
{
src: "https://jacobbarron.xyz/Banneh.gif",
alt: "jacobbarron.xyz",
href: "https://jacobbarron.xyz",
},
...srcs.map((src) => ({ src, alt: src.split("/").pop().split(".")[0] })),
];
// Must match the grid track sizes in the <style> block.
const STAMP_W = 89;
const STAMP_H = 59;
const touchscreen = ref(null);
const cols = ref(4);
const rows = ref(4);
// Every grid slot is filled, cycling through the stamps when the wall needs
// more slots than there are stamps — a ragged last row would leave a blank
// strip drifting into view.
const cells = computed(() =>
Array.from(
{ length: cols.value * rows.value },
(_, i) => stamps[i % stamps.length],
),
);
/**
* Size the wall to between one and two stamps larger than the cell on each
* axis, so there is always something to bounce across whatever the page size.
* Rows are also raised, if need be, until every stamp appears at least once.
*/
function fitWall() {
const el = touchscreen.value?.$el;
if (!el) return;
cols.value = Math.ceil(el.clientWidth / STAMP_W) + 1;
rows.value = Math.max(
Math.ceil(el.clientHeight / STAMP_H) + 1,
Math.ceil(stamps.length / cols.value),
);
}
let resizeObserver = null;
let animId = null;
let posX = 0;
let posY = 0;
@@ -46,7 +100,7 @@ let dy = 0.12;
*
* Writes scrollLeft/scrollTop on the DOM node directly (no reactive state, so
* no re-render per frame), and re-reads scrollWidth/clientWidth every frame
* because the stamp images load in progressively and keep changing the bounds.
* because fitWall changes the bounds whenever the cell is resized.
*/
function bounce() {
const el = touchscreen.value?.$el;
@@ -82,43 +136,46 @@ function bounce() {
}
onMounted(() => {
fitWall();
// The cell's size follows the home grid's breakpoints (and the scrollbars
// appearing inside it), not just window resizes, so observe the element.
resizeObserver = new ResizeObserver(fitWall);
resizeObserver.observe(touchscreen.value.$el);
animId = requestAnimationFrame(bounce);
});
onUnmounted(() => {
if (animId) cancelAnimationFrame(animId);
resizeObserver?.disconnect();
});
</script>
<template>
<Touchscreen ref="touchscreen">
<div class="flex flex-wrap tst">
<Link bare href="https://www.adam-french.co.uk">
<img
src="https://www.adam-french.co.uk/img/stamps/mine.gif"
alt="adam-french.co.uk"
/>
<div class="wall" :style="{ '--cols': cols }">
<template v-for="(stamp, i) in cells" :key="i">
<Link v-if="stamp.href" bare :href="stamp.href">
<img :src="stamp.src" :alt="stamp.alt" />
</Link>
<Link bare href="https://jacobbarron.xyz">
<img src="https://jacobbarron.xyz/Banneh.gif" alt="jacobbarron.xyz" />
</Link>
<img
v-for="src in srcs"
:src="src"
:alt="src.split('/').pop().split('.')[0]"
loading="lazy"
/>
<img v-else :src="stamp.src" :alt="stamp.alt" loading="lazy" />
</template>
</div>
</Touchscreen>
</template>
<style scoped>
img {
display: block;
width: 89px;
height: 59px;
}
.tst {
min-width: calc(89px * 4);
/* Fixed tracks rather than flex-wrap: the wall's size comes from --cols (set
by fitWall), never from how much room the cell happens to have. */
.wall {
display: grid;
grid-template-columns: repeat(var(--cols), 89px);
grid-auto-rows: 59px;
width: max-content;
}
</style>