Add Caddy beside nginx as the replacement edge
Test and deploy / test (push) Successful in 1m32s
Test and deploy / deploy (push) Successful in 29m5s

caddy/ reproduces nginx's routes, gates, /notes/ privacy denials, uploads
(bucket first, then disk), rate limits, real-IP and headers in one shared
route table, with certificates obtained over DNS-01 in-process instead of by
certbot. Until the cutover it serves nothing public: loopback-only ports
8880/8443, no network aliases, its own address. The image build validates
the prod and dev configs, so a broken Caddyfile stops the deploy before any
container is replaced (`make check-caddy` is the same build).

caddy/edge_test.sh checks the privacy boundary and the gates and prints
everything else for diffing nginx against Caddy before switching over.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-17 22:45:35 +00:00
co-authored by Claude Opus 5.5
parent 89aaf8d79e
commit e09b90afaa
14 changed files with 1464 additions and 8 deletions
+30
View File
@@ -498,6 +498,36 @@ docker compose restart nginx
Add `--dry-run` to test without burning rate limit.
**Caddy beside nginx (the edge migration, in progress).** `caddy/` is the
replacement for `nginx/` and certbot. Until the cutover the `caddy` container
runs next to nginx and serves nothing public: it listens on the host's
loopback only (`127.0.0.1:8880` http, `127.0.0.1:8443` https), has no network
aliases, and gets its own certificates over DNS-01 into `./caddy/data`. That
needs `CLOUDFLARE_DNS_API_TOKEN` to carry **Zone → Zone → Read** as well as
DNS → Edit (certbot only needed the second); without it Caddy logs failed
orders and the public site is unaffected. Watch the first issuance with:
```
docker compose logs -f caddy | grep -i -E 'certificate|error'
```
Then compare the two edges request by request (the script's header explains
the output; pass an admin session's cookie as `EDGE_COOKIE` to cover the
signed-in cases too):
```
export "$(grep '^DOMAIN=' .env)"
caddy/edge_test.sh https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1 >nginx.txt
caddy/edge_test.sh https://www.$DOMAIN:8443 --resolve www.$DOMAIN:8443:127.0.0.1 >caddy.txt
diff nginx.txt caddy.txt
```
The expected differences: `Server: nginx` is gone, the gates match paths
case-insensitively (so `/SB/` is gated instead of falling to the SPA), and
`X-Frame-Options`/`Cache-Control` come out in a different order or combined.
A Caddyfile change is checked by `make check-caddy`, the same image build the
deploy runs, which validates the production and dev configs.
**Check logs:**
```