Cut the edge over from nginx and certbot to Caddy
Test and deploy / test (push) Successful in 3m30s
Test and deploy / deploy (push) Has been cancelled

Caddy takes nginx's place in compose: ports 80/443, the fixed address
172.28.255.251 that cloudflared pins the public names to, the network
aliases, the healthcheck and the autoheal label. nginx and certbot are
removed from compose; Caddy already holds its own certificates in
./caddy/data, obtained while it ran beside nginx. `traffic` now tails
logs/caddy/payloads.log, and the dev override switches Caddy to its dev
sites instead of putting nginx in DEV_MODE.

Docs and comments that described nginx's behaviour now describe Caddy's:
CLAUDE.md, DEPLOYMENT.md (topology, boot paths, TLS, rate limits, runbook
with a rollback, rough edges), the READMEs, .env.example and the comments
in the backend, Python service, Vue source and infra files. nginx/ and
certbot/ stay in the repo as the rollback until this has settled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-17 23:28:28 +00:00
co-authored by Claude Opus 5.5
parent e09b90afaa
commit daa2a465fb
54 changed files with 547 additions and 655 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
*
* Auth rides along in HTTP-only cookies set by the backend, so no token handling
* is needed here — axios sends them automatically because the request is
* same-origin (nginx in production, the Vite proxy in dev).
* same-origin (Caddy in production, the Vite proxy in dev).
*/
import axios from "axios";
+2 -2
View File
@@ -46,7 +46,7 @@ const router = createRouter({
},
// A signed-in user's own page: the gated services they have
// been granted. /no-access is the same page with a notice,
// where nginx's permission gate sends a refused visitor.
// where Caddy's permission gate sends a refused visitor.
{
path: "account",
name: "account",
@@ -105,7 +105,7 @@ const router = createRouter({
component: () => import("@/views/CV/CV.vue"),
},
// /cv/jobs and /cv/leads moved to the job tracker app at
// /jobs/; nginx redirects the old paths.
// /jobs/; Caddy redirects the old paths.
],
},
],
+2 -2
View File
@@ -18,7 +18,7 @@ import { useAuthStore } from "@/stores/auth";
/**
* Same-origin ws:// or wss:// URL for the chat socket, derived from the page's
* own protocol and host. Nothing is configurable: nginx (prod) and the Vite
* own protocol and host. Nothing is configurable: Caddy (prod) and the Vite
* proxy (dev) both serve /api/ws from the same origin as the page, and the
* auth cookies only travel if the origin matches.
*/
@@ -171,7 +171,7 @@ export const useMessagesStore = defineStore("messages", () => {
* surface via `lastError`.
*
* `private` goes to both: the upload is stored under /uploads/private/,
* which nginx gates behind an admin check, and the message is marked
* which Caddy gates behind an admin check, and the message is marked
* private. The two must agree.
*/
async function uploadAndSendFile(file, isPrivate = false) {
+2 -2
View File
@@ -4,13 +4,13 @@
* page for a signed-in account that is not an admin, listing the gated
* services it has been granted (backend/services/permissions.go) as links.
*
* `/no-access` is where nginx's permission gate sends a signed-in visitor who
* `/no-access` is where Caddy's permission gate sends a signed-in visitor who
* lacks the permission (`@auth_forbidden`, with the refused address in
* `?path=`). It is this same page with a notice on top, since "what can I
* open instead" is the useful answer to "you can't open that".
*
* The links are plain <a href>, not RouterLinks: every service lives in
* another container behind nginx, so it needs a real page load.
* another container behind Caddy, so it needs a real page load.
*/
import { ref, computed, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
+2 -2
View File
@@ -98,7 +98,7 @@ async function handleLogout() {
{{ section.label }}
</button>
<!-- Logs and incoming request bodies live in Dozzle, outside the
SPA (nginx serves it at /dozzle/ behind the admin check). -->
SPA (Caddy serves it at /dozzle/ behind the admin check). -->
<a
class="admin-nav-link no-underline"
href="/dozzle/"
@@ -108,7 +108,7 @@ async function handleLogout() {
Logs ↗
</a>
<!-- The receipt printer's page is served from stppi, which reaches
the printer on the home LAN; nginx proxies /receipt/ there over
the printer on the home LAN; Caddy proxies /receipt/ there over
Tailscale behind the `receipt` permission gate. -->
<a
class="admin-nav-link no-underline"
+3 -3
View File
@@ -6,7 +6,7 @@
* (a non-admin would only bounce off /admin's guard back to here).
*
* The `?redirect=` is set by two different gates: the SPA router guard
* (`meta.requiresAdmin`) and nginx's `auth_request` gate in front of the
* (`meta.requiresAdmin`) and Caddy's `forward_auth` gate in front of the
* proxied containers (/notes/, /sb/, /receipt/). The latter means the
* destination is frequently NOT a Vue route, so see goTo() below.
*
@@ -34,12 +34,12 @@ const errorMsg = ref("");
// Send the browser to `dest`, choosing SPA navigation vs. a real page load.
//
// nginx bounces /notes/, /sb/, /receipt/ and the like here when the session
// Caddy bounces /notes/, /sb/, /receipt/ and the like here when the session
// 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
// the route named "404" means no real Vue route exists and the browser needs a
// full document request for nginx to proxy it.
// full document request for Caddy to proxy it.
//
// `dest` comes from the query string, so it is only followed when it is a
// site-relative path — a leading "//" or a scheme would be an open redirect.
+1 -1
View File
@@ -6,7 +6,7 @@
* site's 404 — with, for an admin, a form to create a page right here.
*
* Static routes always win, which is why the server refuses slugs under the
* SPA's and nginx's own paths (validateSlug in backend/graph/page_helpers.go).
* SPA's and Caddy's own paths (validateSlug in backend/graph/page_helpers.go).
*
* An adminOnly page answers null to anyone else, so to them it is simply a
* 404.
+1 -1
View File
@@ -7,7 +7,7 @@
* in as literal values, read from the live page so a re-themed layout
* (CVLayout re-points the tokens) would carry through.
* - Load our fonts. Without allow-same-origin its origin is opaque ("null"),
* which makes /fonts/*.woff2 a cross-origin font load that nginx and the
* which makes /fonts/*.woff2 a cross-origin font load that Caddy and the
* Vite dev server would both refuse without CORS headers. Instead the page
* fetches the two files (28 KB) once, same-origin, and inlines them as
* data: URLs.
+1 -1
View File
@@ -58,7 +58,7 @@ export async function runStream(url, body, { signal, onEvent }) {
try {
payload = await res.json();
} catch {
/* non-JSON body (e.g. nginx error page) */
/* non-JSON body (e.g. an error page from the edge) */
}
throw new Error(describeError(res.status, payload));
}