Move the retired nginx and certbot into .deprecated
Test and deploy / test (push) Successful in 1m35s
Test and deploy / deploy (push) Successful in 1m10s

Nothing references nginx/ or certbot/ since the cutover to Caddy (daa2a46),
so they join quartz, hasura and autoheal in .deprecated/, with a README
entry on how to bring them back. The rollback steps in DEPLOYMENT.md §7 now
revert this commit and then the cutover. The host keeps ./certbot/conf (the
last certbot certificate, valid until 2027-01-20) and ./logs/nginx until the
rollback is no longer wanted; .gitignore still covers certbot/conf and
certbot/www for that reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-17 23:35:33 +00:00
co-authored by Claude Opus 5.5
parent daa2a465fb
commit 30d6056bc0
18 changed files with 39 additions and 21 deletions
+16 -3
View File
@@ -1,6 +1,6 @@
# .deprecated # .deprecated
STATUS: nothing in here is live. No compose file, nginx template or script STATUS: nothing in here is live. No compose file, Caddyfile or script
references this directory. It is kept, not deleted, in line with the repo's 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. "legacy is kept" convention; the full history is also in git.
@@ -34,5 +34,18 @@ effectively root on the host. To bring it back, layer
`docker-compose.autoheal.yml` the same way as above. `docker-compose.autoheal.yml` the same way as above.
Since 2026-10-19 it is back in `docker-compose.yml`, watching only containers Since 2026-10-19 it is back in `docker-compose.yml`, watching only containers
labelled `autoheal=true` (nginx). This copy is the old `all` variant, kept for labelled `autoheal=true` (caddy; nginx until 2026-11-17). This copy is the old
reference. `all` variant, kept for reference.
## nginx/ and certbot/
The public edge until 2026-11-17, when Caddy (`caddy/`) replaced both:
`nginx/` is the image (three templates chosen at start by `entrypoint.sh`,
the shared route table, the payload log and security-header includes), and
`certbot/entrypoint.sh` obtained and renewed the certificate that nginx
reloaded through a sentinel file. Their compose services were removed in
`daa2a46`. The last certbot certificate is still in `./certbot/conf` on the
host, valid until 2027-01-20.
To bring them back: revert the commit that moved them here and then `daa2a46`;
DEPLOYMENT.md §7 ("Roll back to nginx") has the commands.
+1 -1
View File
@@ -184,7 +184,7 @@ LIQUIDSOAP_HARBOR_PORT=8001
# certificate for it and for www.DOMAIN, and canonicalises to www. # certificate for it and for www.DOMAIN, and canonicalises to www.
# EMAIL was certbot's Let's Encrypt account address. Nothing reads it since # EMAIL was certbot's Let's Encrypt account address. Nothing reads it since
# the move to Caddy, which registers its ACME account without one; it stays # the move to Caddy, which registers its ACME account without one; it stays
# for the nginx/certbot rollback (DEPLOYMENT.md §7). # for the nginx/certbot rollback (.deprecated/, DEPLOYMENT.md §7).
DOMAIN= DOMAIN=
EMAIL= EMAIL=
+2
View File
@@ -1,6 +1,8 @@
icecast2/fallback_music/* icecast2/fallback_music/*
.claude/ .claude/
!icecast2/fallback_music/.gitkeep !icecast2/fallback_music/.gitkeep
# The retired certbot's data (code in .deprecated/certbot/), still on the
# host as the rollback certificate
certbot/conf certbot/conf
certbot/www certbot/www
# Caddy's certificates, keys and ACME account (docker-compose.yml) # Caddy's certificates, keys and ACME account (docker-compose.yml)
+1 -1
View File
@@ -65,7 +65,7 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
**Uploads / Garage** (`garage/`): every stored file goes through one path. Frontend: `vue/src/uploads.js` (`uploadFile(file)` → URL, plus `ACCEPT` for pickers, `kindOf`, `isUploadUrl`, `tagFor`). Backend: `POST /api/uploads` (`handlers/handle_upload.go`), a thin wrapper over `services.Uploads.Save` (`services/uploads.go`), which owns the type table (`UploadTypes`), the 10MB limit, random naming and storage. A new feature that takes a file calls those, never its own endpoint. `GET /api/uploads` (admin only, `Uploads.List`, `listUploads()`) lists what is stored, bucket and disk merged, for `components/util/UploadPicker.vue`, the "choose an existing upload" modal used by the canvas's Background panel, Box editor and admin bar. Public files go to a bucket in a self-hosted Garage container (the `uploads` volume when `S3_ENDPOINT` is unset, or when Garage refuses a write). Caddy serves `/uploads/` from Garage's anonymous website endpoint first and the volume second, so the bucket is the source of truth and a Garage outage only affects bucket-only files. Private attachments (`/uploads/private/`) always stay on disk. `garage-webui` at `/garage/` (admin-gated) manages the bucket. First run on a fresh volume needs `garage/bootstrap.sh`; the full runbook is "Garage" in `DEPLOYMENT.md` §7. **Uploads / Garage** (`garage/`): every stored file goes through one path. Frontend: `vue/src/uploads.js` (`uploadFile(file)` → URL, plus `ACCEPT` for pickers, `kindOf`, `isUploadUrl`, `tagFor`). Backend: `POST /api/uploads` (`handlers/handle_upload.go`), a thin wrapper over `services.Uploads.Save` (`services/uploads.go`), which owns the type table (`UploadTypes`), the 10MB limit, random naming and storage. A new feature that takes a file calls those, never its own endpoint. `GET /api/uploads` (admin only, `Uploads.List`, `listUploads()`) lists what is stored, bucket and disk merged, for `components/util/UploadPicker.vue`, the "choose an existing upload" modal used by the canvas's Background panel, Box editor and admin bar. Public files go to a bucket in a self-hosted Garage container (the `uploads` volume when `S3_ENDPOINT` is unset, or when Garage refuses a write). Caddy serves `/uploads/` from Garage's anonymous website endpoint first and the volume second, so the bucket is the source of truth and a Garage outage only affects bucket-only files. Private attachments (`/uploads/private/`) always stay on disk. `garage-webui` at `/garage/` (admin-gated) manages the bucket. First run on a fresh volume needs `garage/bootstrap.sh`; the full runbook is "Garage" in `DEPLOYMENT.md` §7.
**Caddy** (`caddy/`): the public edge since 2026-11-17 — TLS, the SPA and the reverse proxy in front of every service. It obtains and renews its own certificates (DNS-01 through the Cloudflare API, into `./caddy/data`), so there is no certbot. `caddy/Caddyfile` holds the global options and the shared snippets (`proxy`, `limit`, `admin_gate`, `permission_gate`, the upload headers, logging); `caddy/routes.caddy` is the one route table both modes use — add a new route there, in the right place, because inside its `route` block the first matching `handle` wins; `caddy/sites/prod.caddy` and `sites/dev.caddy` hold what differs (TLS, security headers, the apex, static caching, `/`), picked by `CADDY_SITE`. Every variable the config reads goes through the caddy service's explicit `environment:` list. The image build runs `caddy validate`, so `make check-caddy` (or a failed deploy build) catches a bad config before any container is replaced; the first build on a host compiles Caddy with its two plugins (rate limiting, the Cloudflare DNS provider) and is slow, later ones are cached. Rate limits (`import limit <zone> <events> <window>`) are sliding windows keyed on the real client IP, and a refused request gets 503; a zone name shared by several routes shares one bucket, so it must always carry the same numbers. Every request is also logged as a JSON line, body included (redacted if it mentions a password, token or secret), to `logs/caddy/payloads.log`. The `traffic` container tails that file so it shows up in Dozzle, which is served at `/dozzle/` behind the admin login; the admin panel no longer has a log view. Caddy has a healthcheck (`http://127.0.0.1/caddy-health`); the `autoheal` container restarts it when that fails, since Docker never restarts an unhealthy container itself. Gitea's commit-pinned history views and archives are admin-gated at the edge because a crawler swarm hammers them; the branch views stay public. `caddy/edge_test.sh` checks the privacy denials and every gate against a running edge. `nginx/` and `certbot/` are the pre-cutover edge, kept only as the rollback. **Caddy** (`caddy/`): the public edge since 2026-11-17 — TLS, the SPA and the reverse proxy in front of every service. It obtains and renews its own certificates (DNS-01 through the Cloudflare API, into `./caddy/data`), so there is no certbot. `caddy/Caddyfile` holds the global options and the shared snippets (`proxy`, `limit`, `admin_gate`, `permission_gate`, the upload headers, logging); `caddy/routes.caddy` is the one route table both modes use — add a new route there, in the right place, because inside its `route` block the first matching `handle` wins; `caddy/sites/prod.caddy` and `sites/dev.caddy` hold what differs (TLS, security headers, the apex, static caching, `/`), picked by `CADDY_SITE`. Every variable the config reads goes through the caddy service's explicit `environment:` list. The image build runs `caddy validate`, so `make check-caddy` (or a failed deploy build) catches a bad config before any container is replaced; the first build on a host compiles Caddy with its two plugins (rate limiting, the Cloudflare DNS provider) and is slow, later ones are cached. Rate limits (`import limit <zone> <events> <window>`) are sliding windows keyed on the real client IP, and a refused request gets 503; a zone name shared by several routes shares one bucket, so it must always carry the same numbers. Every request is also logged as a JSON line, body included (redacted if it mentions a password, token or secret), to `logs/caddy/payloads.log`. The `traffic` container tails that file so it shows up in Dozzle, which is served at `/dozzle/` behind the admin login; the admin panel no longer has a log view. Caddy has a healthcheck (`http://127.0.0.1/caddy-health`); the `autoheal` container restarts it when that fails, since Docker never restarts an unhealthy container itself. Gitea's commit-pinned history views and archives are admin-gated at the edge because a crawler swarm hammers them; the branch views stay public. `caddy/edge_test.sh` checks the privacy denials and every gate against a running edge. The pre-cutover nginx and certbot configs are in `.deprecated/nginx/` and `.deprecated/certbot/`, kept for the rollback in `DEPLOYMENT.md` §7.
## Backend Structure ## Backend Structure
+15 -12
View File
@@ -259,8 +259,9 @@ Encrypt allows five certificates for the same name a week, so do not make a
habit of it. habit of it.
Until 2026-11-17 this was certbot plus a bootstrap nginx config, a reload Until 2026-11-17 this was certbot plus a bootstrap nginx config, a reload
sentinel and a watcher loop. `certbot/` and its `./certbot/conf` stay on the sentinel and a watcher loop, now in `.deprecated/`. The last certbot
host as the rollback (§7); that certificate expires on 2027-01-20. certificate is still in `./certbot/conf` on the host as the rollback (§7); it
expires on 2027-01-20.
### Cloudflare Tunnel ### Cloudflare Tunnel
@@ -522,13 +523,15 @@ export "$(grep '^DOMAIN=' .env)"
caddy/edge_test.sh https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1 caddy/edge_test.sh https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1
``` ```
**Roll back to nginx** (until `nginx/` and `certbot/` are removed; the certbot **Roll back to nginx** (possible while the certbot certificate in
certificate in `./certbot/conf` is valid until 2027-01-20). `git revert` the `./certbot/conf` is valid, until 2027-01-20). The old edge is in
cutover commit and push, or by hand on the host, under the lock so a deploy `.deprecated/nginx/` and `.deprecated/certbot/`. Revert the commit that moved
cannot interleave: it there and then the cutover (`daa2a46`), which restores both directories
and nginx's compose services. Push, or apply it by hand on the host under the
lock so a deploy cannot interleave:
``` ```
git revert --no-edit <cutover commit> git revert --no-edit <the .deprecated move> daa2a46
flock .compose.lock sh -c 'docker compose stop caddy && docker compose rm -f caddy && docker compose up -d --build nginx certbot cloudflared traffic' flock .compose.lock sh -c 'docker compose stop caddy && docker compose rm -f caddy && docker compose up -d --build nginx certbot cloudflared traffic'
``` ```
@@ -707,11 +710,11 @@ docker compose restart caddy
Documented, not fixed — each would change deploy behaviour. Documented, not fixed — each would change deploy behaviour.
1. **`nginx/`, `certbot/` and their host directories are still here** as the 1. **The old edge's host directories are still on stpvm** as the rollback
rollback from the 2026-11-17 cutover. Once Caddy has run for a couple of from the 2026-11-17 cutover: `./certbot/` (the last certbot certificate)
weeks: move `nginx/` and `certbot/` to `.deprecated/`, then delete and `./logs/nginx/`, plus the `logs/nginx` stanza in
`./certbot/` and `./logs/nginx/` on the host and the `logs/nginx` logrotate `/etc/logrotate.d/web_server`. The code is in `.deprecated/`. Once the
stanza. rollback is no longer wanted, delete the two directories and the stanza.
2. **`gitea/config/entrypoint.sh` is an empty, unused file** that would be 2. **`gitea/config/entrypoint.sh` is an empty, unused file** that would be
mounted to the same in-container path as the real wrapper. It is currently mounted to the same in-container path as the real wrapper. It is currently
shadowed by an explicit file mount — fragile. Deleting it would be safe but shadowed by an explicit file mount — fragile. Deleting it would be safe but
+3 -2
View File
@@ -1,6 +1,7 @@
# ============================================================================= # =============================================================================
# Caddyfile — the public edge: TLS, the SPA, and the reverse proxy in front of # Caddyfile — the public edge: TLS, the SPA, and the reverse proxy in front of
# every other service. Replaces nginx/ and the certbot container. # every other service. Replaced nginx and certbot (now .deprecated/) on
# 2026-11-17.
# #
# FILES (all baked into the image by caddy/Dockerfile) # FILES (all baked into the image by caddy/Dockerfile)
# Caddyfile this file: global options, the snippets every site # Caddyfile this file: global options, the snippets every site
@@ -29,7 +30,7 @@
# list in docker-compose.yml, or it reaches Caddy empty. Note an EMPTY # list in docker-compose.yml, or it reaches Caddy empty. Note an EMPTY
# variable is not "unset": {$X:default} keeps the empty value. So defaults # variable is not "unset": {$X:default} keeps the empty value. So defaults
# live in that compose list (${X:-default}), which treats both alike, as # live in that compose list (${X:-default}), which treats both alike, as
# nginx/entrypoint.sh's ${X:-default} did. # nginx's entrypoint's ${X:-default} did.
# #
# WHAT NO LONGER NEEDS DOING (vs nginx) # WHAT NO LONGER NEEDS DOING (vs nginx)
# - Upstreams are resolved when Caddy dials them, not at startup, so it # - Upstreams are resolved when Caddy dials them, not at startup, so it
+1 -2
View File
@@ -114,8 +114,7 @@ services:
# serves the SPA, reverse-proxies everything else, and obtains and renews # serves the SPA, reverse-proxies everything else, and obtains and renews
# its own certificates over DNS-01 into ./caddy/data, with no reload and no # its own certificates over DNS-01 into ./caddy/data, with no reload and no
# inbound port. It replaced nginx and the certbot container on 2026-11-17; # inbound port. It replaced nginx and the certbot container on 2026-11-17;
# nginx/ and certbot/ stay in the repo until that has settled, as the # both are in .deprecated/ (DEPLOYMENT.md §7 has the rollback).
# rollback.
# #
# ENVIRONMENT: an explicit list, not the whole .env, so the edge never sees # ENVIRONMENT: an explicit list, not the whole .env, so the edge never sees
# the database password or the JWT secret. A variable the Caddyfile reads # the database password or the JWT secret. A variable the Caddyfile reads