Hand-written HTML and CSS, one small Caddy container per site, and a short list of things the server refuses to do.
Update, October 10, 2026: this post records the original static setup. By October 2026 the blog had moved through Go and SQLite to Next.js, Payload CMS and Postgres. The portfolio continued to serve static files. A third site has since been retired.
At the time of this setup, the portfolio, the blog and a third site, since retired, were directories of files. There is no application server, no database and no step that builds pages on the server: what is in the directory is what gets served. The third site’s pages were written by hand. The pages of danielbae.me are written by hand as fragments and wrapped in a shared shell by a short script, and the pages of the blog come from a generator, covered at the end; in both cases the output is committed, so what is served is still a directory of files. The rest of this post follows one request from the visitor to the container, then the deploy script, and then the parts that are not as tidy as “static” suggests.
One container per site, and one edge
Each site is its own container: caddy:2.10.2-alpine, pinned so a rebuild is reproducible, with the site’s files copied in. It speaks plain HTTP on an internal network and nothing else. It compresses with zstd and gzip, maps /name to name.html and /dir/ to that directory’s index.html, and serves its own 404 page. Caching is two rules.
@asset path *.css *.js *.svg *.png *.jpg *.webp *.woff2 *.ico
header @asset Cache-Control "public, max-age=604800"
@page not path *.css *.js *.svg *.png *.jpg *.webp *.woff2 *.ico
header @page Cache-Control "public, max-age=300, must-revalidate"
Assets can be cached for a week. Everything else, meaning pages, the feed and the sitemap, has to be revalidated after five minutes. The page rule used to list /, *.html, *.txt and *.xml. A directory URL such as /writing/x/ matched none of those, so the rule now matches everything that is not an asset.
In front of the site containers is one edge container, also Caddy. It is the only service in the compose file that publishes a port. The sites sit on an internal network, so none of them can be reached from the internet and none can see another’s files. The edge holds what they share: TLS, the security headers, the mapping from hostnames to sites, and the redirect from www to the bare domain. Inside the container it listens on a high port so that it can run unprivileged, and compose publishes the public HTTPS port onto it. One path is routed differently: /analytics on every site goes to a fifth container, the counter described in Analytics from the access log, which reads the edge’s access log from a shared volume and serves each site’s visitor numbers behind a password.
Only Cloudflare can connect
Public traffic goes from the visitor to Cloudflare and from Cloudflare to the edge. The edge presents a Cloudflare Origin CA certificate, which is what lets every zone run in Full (Strict) mode. It also requires a client certificate signed by Cloudflare’s origin-pull CA, set with mode require_and_verify. This is authenticated origin pulls, which is mutual TLS: a client that connects to the server’s address directly cannot present a certificate Cloudflare signed, and the handshake fails. The blog and the portfolio each use an origin certificate.
That controls who can reach the origin. It says nothing about who sees the traffic. Cloudflare terminates the visitor’s TLS connection and reads every request in the clear.
A policy with one origin
The edge sends a Content-Security-Policy in which every source is 'self' or nothing. It is one header, wrapped here:
default-src 'self';
base-uri 'none';
form-action 'none';
frame-ancestors 'none';
img-src 'self' data:;
style-src 'self';
script-src 'self';
font-src 'self';
connect-src 'self';
object-src 'none';
upgrade-insecure-requests
The practical effects are blunt. No inline style element, no style attribute (not even inside an inline SVG), no inline script, and no request to another host: no web fonts from a font service, no hosted analytics, no embeds. Every stylesheet, script, font and image is a file on the same origin. The visitor counts come from the server’s own log instead, which is why they cost the pages nothing. The edge also sends HSTS, nosniff, X-Frame-Options: DENY, Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy set to same-origin, and a Permissions-Policy that switches off the camera, microphone, geolocation and similar features, and it removes the Server header.
Containers that can do very little
Every container gets the same hardening block from the compose file.
user: "1001:1001"
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
tmpfs:
- /tmp:rw,noexec,nosuid,nodev,size=32m
The root filesystem is read-only, the process is not root, it cannot gain privileges, it has no Linux capabilities, and its only writable space is a small temporary directory that cannot execute anything. Each container also has CPU and memory limits, rotated logs and a health check against a plain-HTTP /healthz. Caddy’s admin API is switched off. The upstream Caddy binary carries a file capability, which does not work with capabilities dropped and privilege gain disallowed, so each Dockerfile removes it with setcap -r. The counter’s image is built FROM scratch, so it has no shell at all, and its health check is the binary probing itself.
The deploy script
deploy.sh runs on my own machine. It stops if a certificate file or a site’s index page is missing, rebuilds the blog and the portfolio, then rsyncs the whole tree to the server with --delete. The private keys are in a directory git ignores and travel in that rsync. On the server the script validates the compose file and builds the images; the counter’s tests run inside its build. Before it restarts anything it checks the edge’s Caddy configuration with the freshly built image, because the edge fronts every site and a typo there would take all of them down. Then it brings the stack up, waits for all five containers to report healthy, and finally fetches each public URL through Cloudflare, including the newest post from the feed, and checks that each site’s analytics page refuses a visitor without the password and answers with it. It exits non-zero unless every check passes.
The blog’s generator
The blog is the one part that is not written by hand. build.py is a single Python file that uses only the standard library. It reads Markdown posts, fills a few templates and writes public/, which is committed. The Dockerfile copies public/ into the image like any other site, so the server needs no Python and no Node, and a deploy ships exactly what is in git. python3 build.py --check rebuilds in memory and fails if the committed output is different.
The generator also exists to make the policy’s silent failures loud. A browser that blocks an inline style reports it only in the console; the page just looks wrong. So the build parses every page it produces and fails on a style attribute, a script or style element, an event handler, an unbalanced tag, an image without width, height and alt text, a link or image that does not resolve, and a request to another origin. It fails on a missing front matter field, a duplicate slug and a date in the future, and it writes nothing when it fails. The output is deterministic, with no timestamps and sorted input, and the stylesheet’s URL carries a hash of its contents, which is what makes the week-long asset cache safe. Posts are written in a small Markdown subset, everything is escaped, and raw HTML in a post is an error. The same script draws each post’s cover as an SVG from one of six motifs and four palettes, chosen from the slug unless the post says otherwise, and writes a page for every tag.
danielbae.me reuses the checks without the Markdown. Its pages are HTML fragments with a few lines of front matter, and a second, shorter script wraps each in the shared masthead and footer, fills the list of recent posts from the blog’s own sources, and runs the blog’s page linter over the result.
What this does not cover
Not every page is free of scripts. The original Latch product page loaded one 1 KB script, site.js, that adds copy buttons to the install commands; without the Clipboard API the buttons stay hidden and the commands remain selectable text. danielbae.me loads a similar small script that only reveals its print button. The pages the blog’s generator writes contain no script at all.
Cloudflare adds things of its own. With its bot detection switched on, a page of the blog comes back from Cloudflare with an extra inline script that would load one of Cloudflare’s own scripts, and the policy blocks it, which shows up as one error in the browser console. The same goes for email addresses: Cloudflare can rewrite them into a link that a script decodes. The generator cannot see any of that, because it happens after the origin, so the one email link on this blog is wrapped in a comment that tells Cloudflare to leave it alone.
And it is one small VPS. If that machine is down, so are the sites.
