Serve the Partner Radar demo at radar.DOMAIN
Test and deploy / test (push) Successful in 2m36s
Test and deploy / deploy (push) Successful in 44s
Weekly Maintenance / maintenance (push) Successful in 7m17s
Renovate / renovate (push) Successful in 8m7s

A new Caddy site proxies radar.DOMAIN to radar-web:80, the web container of
the adamf/cto stack, which joins app-network from its own compose project.
It has its own rate-limit zones (radar, radar_login) and answers 503
"offline" when that stack is down. The name is added to Caddy's network
aliases and cloudflared's extra_hosts like www.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-19 15:50:22 +00:00
co-authored by Claude Opus 5.5
parent 30d6056bc0
commit b6baf9c1a2
5 changed files with 70 additions and 1 deletions
+6
View File
@@ -291,6 +291,12 @@ RECEIPT_WEB_UPSTREAM=100.107.152.119:8765
# `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`. # `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`.
RECEIPT_WEB_TOKEN= RECEIPT_WEB_TOKEN=
# --- Partner Radar (radar.DOMAIN) ----------------------------------------------
# A separate compose project on this host (adamf/cto, `make stpvm`), whose web
# container joins app-network as `radar-web`. Only set this to point
# radar.DOMAIN somewhere else.
# RADAR_UPSTREAM=radar-web:80
# TfL Unified API key (500 req/min); used by the Python hotel finder # TfL Unified API key (500 req/min); used by the Python hotel finder
TFL_APP_KEY= TFL_APP_KEY=
+5
View File
@@ -67,6 +67,7 @@ backend icecast2 gitea sb sb-pub python | |
| cloudflared | `cloudflared` | — (fixed IP `172.28.255.250`) | all of Caddy, via Cloudflare | no (outbound only) | | cloudflared | `cloudflared` | — (fixed IP `172.28.255.250`) | all of Caddy, via Cloudflare | no (outbound only) |
| dozzle (log viewer) | `dozzle` | 8080 | `/dozzle/` (admin-gated by Caddy `forward_auth`; reads the Docker socket) | no | | dozzle (log viewer) | `dozzle` | 8080 | `/dozzle/` (admin-gated by Caddy `forward_auth`; reads the Docker socket) | no |
| receipt printer (`receipt serve`, adamf/receipt_maker) | — (runs on **stppi**, not in this stack) | 8765 on stppi's Tailscale IP (`RECEIPT_WEB_UPSTREAM`) | `/receipt/`, prefix stripped (permission-gated on `receipt` by Caddy `forward_auth`; Caddy adds `X-Receipt-Token` and `X-Remote-User`). The only upstream off this host; 503 "offline" when stppi is down | no | | receipt printer (`receipt serve`, adamf/receipt_maker) | — (runs on **stppi**, not in this stack) | 8765 on stppi's Tailscale IP (`RECEIPT_WEB_UPSTREAM`) | `/receipt/`, prefix stripped (permission-gated on `receipt` by Caddy `forward_auth`; Caddy adds `X-Receipt-Token` and `X-Remote-User`). The only upstream off this host; 503 "offline" when stppi is down | no |
| Partner Radar (adamf/cto, its own compose project) | `radar-web` (alias of that project's `web`, on app-network) | 80 | `radar.<DOMAIN>`, the whole host (its own login, no gate; zones `radar` and `radar_login`). Started from the cto checkout with `make stpvm`; 503 "offline" when that stack is down | no |
| traffic (tails the payload log) | `traffic` | — (no network) | none; its stdout is what Dozzle shows | no | | traffic (tails the payload log) | `traffic` | — (no network) | none; its stdout is what Dozzle shows | no |
| autoheal (restarts unhealthy caddy) | `autoheal` | — (no network) | none; reads the Docker socket | no | | autoheal (restarts unhealthy caddy) | `autoheal` | — (no network) | none; reads the Docker socket | no |
| garage (S3 object store) | `garage` | 3900 S3, 3902 web, 3903 admin | none directly; `/uploads/` falls back to its web endpoint for files not on the volume | no | | garage (S3 object store) | `garage` | 3900 S3, 3902 web, 3903 admin | none directly; `/uploads/` falls back to its web endpoint for files not on the volume | no |
@@ -310,6 +311,8 @@ Setup, once:
- `www.<DOMAIN>` → `https://www.<DOMAIN>`: the site. - `www.<DOMAIN>` → `https://www.<DOMAIN>`: the site.
- `<DOMAIN>` → `https://<DOMAIN>`: Caddy redirects it to www, and it serves Gitea's registry - `<DOMAIN>` → `https://<DOMAIN>`: Caddy redirects it to www, and it serves Gitea's registry
at `/v2/`. at `/v2/`.
- `radar.<DOMAIN>` → `https://radar.<DOMAIN>`: the Partner Radar demo
(Caddy's `radar.{$DOMAIN}` site, `sites/prod.caddy`).
Creating each hostname replaces the existing A record for that name with Creating each hostname replaces the existing A record for that name with
a CNAME to the tunnel. **That is the cutover**: until then the tunnel a CNAME to the tunnel. **That is the cutover**: until then the tunnel
carries nothing. carries nothing.
@@ -467,6 +470,8 @@ gets its own zone, as `/receipt/` does.
| `upload` | 30 / 1m | `/api/uploads` | Bounds how fast one IP fills the bucket or the volume. Generous because uploaders must be signed in (accounts are admin-created) and a batch of pictures dropped on a canvas page uploads at once. | | `upload` | 30 / 1m | `/api/uploads` | Bounds how fast one IP fills the bucket or the volume. Generous because uploaders must be signed in (accounts are admin-created) and a batch of pictures dropped on a canvas page uploads at once. |
| `hotel_search` | 3 / 1m | `/py/hotels/(search\|scan)` | Each request holds an upstream call for minutes and the Python side has one search slot — concurrency protection more than abuse protection. | | `hotel_search` | 3 / 1m | `/py/hotels/(search\|scan)` | Each request holds an upstream call for minutes and the Python side has one search slot — concurrency protection more than abuse protection. |
| `receipt` | 10 / 1s | `/receipt/` | Prints are slow and physical; ten a second is far above any real use. | | `receipt` | 10 / 1s | `/receipt/` | Prints are slow and physical; ten a second is far above any real use. |
| `radar` | 30 / 1s | all of `radar.<DOMAIN>` | The Partner Radar demo: an abuse ceiling like `api`, in its own zone because it is a different app. |
| `radar_login` | 5 / 1m | `radar.<DOMAIN>/api/auth/login` | Brute-force defence on the demo's login, on top of `radar` and the app's own login throttling. |
The WebSocket endpoint is deliberately unlimited: a socket is one long-lived The WebSocket endpoint is deliberately unlimited: a socket is one long-lived
request, and a limit there would drop reconnect storms rather than abuse. request, and a limit there would drop reconnect storms rather than abuse.
+6 -1
View File
@@ -292,13 +292,14 @@
respond "Too many requests from your address. Wait a moment and retry." 503 respond "Too many requests from your address. Wait a moment and retry." 503
} }
# An upstream that could not be reached or timed out. Two routes turn that # An upstream that could not be reached or timed out. Three routes turn that
# into something better than a bare 502, each keyed on a variable its # into something better than a bare 502, each keyed on a variable its
# route sets (error routes keep the request's vars, and a variable cannot # route sets (error routes keep the request's vars, and a variable cannot
# be spoofed the way a path can be dressed up): # be spoofed the way a path can be dressed up):
# uploads_fallback Garage is down: serve the file from disk instead. # uploads_fallback Garage is down: serve the file from disk instead.
# receipt_upstream set only once the permission gate has passed, so a # receipt_upstream set only once the permission gate has passed, so a
# backend outage is not reported as the printer's. # backend outage is not reported as the printer's.
# radar_upstream the Partner Radar stack (radar.DOMAIN) is down.
handle_errors 502 504 { handle_errors 502 504 {
@uploads_fallback vars uploads_fallback yes @uploads_fallback vars uploads_fallback yes
handle @uploads_fallback { handle @uploads_fallback {
@@ -308,6 +309,10 @@
handle @receipt_offline { handle @receipt_offline {
respond "The receipt printer machine is offline." 503 respond "The receipt printer machine is offline." 503
} }
@radar_offline vars radar_upstream yes
handle @radar_offline {
respond "Partner Radar is offline." 503
}
} }
} }
+46
View File
@@ -131,3 +131,49 @@ www.{$DOMAIN} {
} }
} }
} }
# ---- Partner Radar (radar.DOMAIN) ----
# The adamf/cto "Partner Radar" demo: its own docker compose project on this
# host (`make stpvm` there), whose `web` container (its own Caddy, serving the
# React app and proxying its API) joins app-network as `radar-web`. A
# subdomain, not a /radar/ path, because the app assumes it owns `/` and its
# session cookie then stays apart from www's.
#
# No admin gate: the app has its own login and accounts. No security_headers
# either: the app's Caddy sends its own, and www's CSP would block the React
# app. Two zones of its own (see DEPLOYMENT.md §6): `radar` on every request,
# and `radar_login` on top of it for the login endpoint. radar_upstream lets
# `errors` answer "offline" when the stack is down instead of a bare 502.
(radar_proxy) {
reverse_proxy {$RADAR_UPSTREAM} {
import proxy
# Caddy's default, spelt out: when the stack is down, fail fast and
# let `errors` answer.
transport http {
dial_timeout 3s
}
}
}
radar.{$DOMAIN} {
import prod_tls
import common
header Strict-Transport-Security "max-age=63072000; includeSubDomains"
route {
import limit radar 30 1s
request_body {
max_size 10MB
}
vars radar_upstream yes
handle /api/auth/login {
route {
import limit radar_login 5 1m
import radar_proxy
}
}
handle {
import radar_proxy
}
}
}
+7
View File
@@ -150,6 +150,11 @@ services:
# A dead port by default, so /receipt/ reads "offline". # A dead port by default, so /receipt/ reads "offline".
- RECEIPT_WEB_UPSTREAM=${RECEIPT_WEB_UPSTREAM:-127.0.0.1:9} - RECEIPT_WEB_UPSTREAM=${RECEIPT_WEB_UPSTREAM:-127.0.0.1:9}
- RECEIPT_WEB_TOKEN=${RECEIPT_WEB_TOKEN:-} - RECEIPT_WEB_TOKEN=${RECEIPT_WEB_TOKEN:-}
# Partner Radar (radar.DOMAIN): the adamf/cto stack's `web` container,
# which joins app-network under this alias (its docker-compose.stpvm.yml).
# While that stack is down the name does not resolve and radar.DOMAIN
# answers "offline".
- RADAR_UPSTREAM=${RADAR_UPSTREAM:-radar-web:80}
# Zone -> Zone -> Read and Zone -> DNS -> Edit; see .env.example. # Zone -> Zone -> Read and Zone -> DNS -> Edit; see .env.example.
- CLOUDFLARE_DNS_API_TOKEN=${CLOUDFLARE_DNS_API_TOKEN:-} - CLOUDFLARE_DNS_API_TOKEN=${CLOUDFLARE_DNS_API_TOKEN:-}
networks: networks:
@@ -164,6 +169,7 @@ services:
aliases: aliases:
- ${DOMAIN} - ${DOMAIN}
- www.${DOMAIN} - www.${DOMAIN}
- radar.${DOMAIN}
# Fixed for cloudflared's extra_hosts (see there): an alias only # Fixed for cloudflared's extra_hosts (see there): an alias only
# exists while Caddy is running, and this address is pinned to the # exists while Caddy is running, and this address is pinned to the
# same names for when it is not. Top of the /16 beside cloudflared's, # same names for when it is not. Top of the /16 beside cloudflared's,
@@ -238,6 +244,7 @@ services:
extra_hosts: extra_hosts:
- "${DOMAIN}:172.28.255.251" - "${DOMAIN}:172.28.255.251"
- "www.${DOMAIN}:172.28.255.251" - "www.${DOMAIN}:172.28.255.251"
- "radar.${DOMAIN}:172.28.255.251"
networks: networks:
app-network: app-network:
ipv4_address: 172.28.255.250 ipv4_address: 172.28.255.250