thermograph/infra/deploy
Emi Griffith a4bcae5bf9
All checks were successful
PR build (required check) / changes (pull_request) Successful in 7s
secrets-guard / encrypted (pull_request) Successful in 5s
PR build (required check) / build-backend (pull_request) Has been skipped
PR build (required check) / build-frontend (pull_request) Has been skipped
shell-lint / shellcheck (pull_request) Successful in 7s
PR build (required check) / validate-observability (pull_request) Has been skipped
PR build (required check) / gate (pull_request) Successful in 2s
lb: trust the host Caddy's X-Forwarded-Proto
Every OAuth redirect URI the backend builds is currently http://, whatever
scheme the user actually arrived with.

There are two Caddy hops in front of the app: the host Caddy terminates TLS
and sets X-Forwarded-Proto: https, then proxies to 127.0.0.1:8137 over plain
HTTP; the stack LB is the second hop. Caddy preserves an incoming
X-Forwarded-* header only when the immediate peer is a trusted proxy, and
trusted_proxies was never set here -- so the LB overwrote the header with the
scheme of the connection it had just received, which is http.

accounts/oauth.py:_redirect_uri builds the callback from x-forwarded-proto,
and that URI must match what is registered in the provider's console.

Measured on vps2, same request to each hop:

  direct to web, XFP=https      -> https://thermograph.org/api/v2/...
  through the LB, XFP=https     -> http://thermograph.org/api/v2/...
  through the PATCHED LB        -> https://thermograph.org/api/v2/...
  through the PATCHED LB, no XFP-> http://thermograph.org/api/v2/...

The last line is the point of using trusted_proxies rather than hardcoding
`header_up X-Forwarded-Proto https`: the LB still reports the truth when
nothing in front of it claims otherwise.

private_ranges covers 127.0.0.1/8 and the Docker bridge ranges, which is where
the host Caddy reaches this container from. The LB binds loopback only,
precisely so it cannot be reached un-fronted, so the only party that can set
these headers is the host Caddy -- trusting the local peer widens nothing.

Applied to beta's LB too. Beta is where a provider change gets tested before
it reaches thermograph.org, so it needs the same behaviour or the test is not
a test.
2026-08-01 09:06:11 -07:00
..
backup infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
db db: raise max_connections to 200, cap work_mem at 64MB, trim async pool overflow (#124) 2026-07-26 19:48:50 +00:00
forgejo ci: add an always-on Actions runner on vps2 2026-08-01 07:54:28 -07:00
migrations Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
openmeteo infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
secrets secrets: make the two-host age key quorum a checked policy 2026-07-31 05:12:58 +00:00
stack lb: trust the host Caddy's X-Forwarded-Proto 2026-08-01 09:06:11 -07:00
swarm infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
twa Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
Caddyfile.vps1 dev: leave /healthz outside the basic-auth boundary (#113) 2026-07-26 08:28:18 +00:00
Caddyfile.vps2 infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
deploy-dev.sh infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
deploy.sh deploy.sh: honour TG_POST_DEPLOY on the compose path too (#109) 2026-07-26 07:28:43 +00:00
env-topology.sh openbao: derive the AppRole credential path per environment 2026-07-30 19:49:28 -07:00
migrate-db.py Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
POSTGRES-MIGRATION.md Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
provision-agent-access.sh Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
provision-dev.sh dev: serve at dev.thermograph.org behind basic auth, bound to loopback (#111) 2026-07-26 07:49:43 +00:00
provision-mail-supervision.sh observability: add the estate's first alerting; supervise Postfix 2026-07-24 13:19:19 -07:00
provision-mail.sh infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
provision-secrets.sh infra: split the estate into vps1/vps2 — beta joins prod, dev gets a home (#103) 2026-07-26 06:56:38 +00:00
render-secrets-openbao.sh openbao: render Centralis from the vault 2026-07-30 19:55:17 -07:00
render-secrets.sh openbao: render Centralis from the vault 2026-07-30 19:55:17 -07:00
RUNBOOK-vps1-vps2-cutover.md dev: serve at dev.thermograph.org behind basic auth, bound to loopback (#111) 2026-07-26 07:49:43 +00:00
thermograph-dev.service Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00
thermograph.env.example accounts: sign in with Google, on a shared provider-agnostic OAuth engine (#122) 2026-07-27 00:56:43 +00:00
thermograph.service Subtree-merge thermograph-infra (origin/main) into infra/ 2026-07-22 22:01:11 -07:00