repos
/ orchard main

orchard

mirror

Every site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.

blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics

1.1 KB · 21 lines · markdown Raw History
 1This package is isaacbythewood.com's own copy of the small HTTP layer every
 2site here needs: the Vite manifest reader, request logging, panic recovery,
 3security headers, the static cache policy, graceful shutdown, and the log
 4shipper.
 5
 6Every site carries its own copy instead of importing a shared module, so a site
 7can be lifted out into its own repository and its Docker build context is just
 8its own directory. The cost is that a fix here has to be made eight times, so if a
 9change belongs in all eight then change all eight.
10
11`shipper.go` is the only file that talks to another site. It installs a
12`slog.Handler` that tees, so stdout is written exactly as before and a copy is
13queued for logging.bythewood.me and flushed by a background goroutine. Nothing
14in it can block a caller and every failure path drops rather than waits, because
15stdout stays the source of truth.
16
17`session.go` is the other one that talks to another site. It asks
18auth.bythewood.me whether the cookie in a request is a live session, over the
19bridge and on every request rather than from a cache, because an opaque session
20that can be revoked everywhere at once is the reason it is opaque.