My websites, on three continents
Until this month, every website I host had its own LXC, behind an Nginx Proxy Manager container and two port forwards on my home router. Each site lived on exactly one machine, and each new one meant another container to patch.
I wanted hundreds of small sites on a few shared machines, in more than one place, so that losing any one of them wouldn't take a site down. I built that first on a k3s cluster, then on Komodo, and it now runs on Kamal. Kamal runs nothing on the servers to manage them: it connects over SSH and runs Docker commands. This post is mostly things you can poke.
The shape of it
Six servers on three continents: OVH servers in Virginia, London and Singapore, a server in Noida, and two containers in Bengaluru, one on the Proxmox machine in my house and one in an ISP's server room. Each runs the same containers and serves real traffic all the time. Pick where a visitor is, then shut something down.
- kamal-home-01serving you
Home, Bengaluru · LXC on Proxmox
cloudflared → kamal-proxy → nginx
- kamal-ovh-01
OVH, Virginia, US · VPS
cloudflared → kamal-proxy → nginx
- kamal-ovh-02
OVH, London, UK · VPS
cloudflared → kamal-proxy → nginx
- kamal-ovh-03
OVH, Singapore · VPS
cloudflared → kamal-proxy → nginx
- kamal-afn-01
Bengaluru, an ISP's server room · LXC on Proxmox
cloudflared → kamal-proxy → nginx
- kamal-hxc-01
Noida, India · server
cloudflared → kamal-proxy → nginx
How a visitor reaches a site
Every server is on my Tailscale network, and Kamal deploys over Tailscale SSH. Nothing listens on the servers' web ports. Visitors come in through a Cloudflare Tunnel with a connector on every server, so Cloudflare hands each request to a connector near where it entered. From there it never leaves that server.
visitor
anywhere
Cloudflare
nearest edge
One server, of six
cloudflared
kamal-proxy
by Host
a container per site
- yoginth-com
- example1-com
- example2-com
- example3-com
- example4-com
Every response carries an x-bigint-trace header naming the Cloudflare data centre and the server that served it, with an ID that changes on every request, like Vercel's x-vercel-id. Run this from wherever you are:
$ curl -sI https://yoginth.com | grep x-bigint-traceFrom a push to production
A site's image holds only its static files and a few lines of nginx config. A push builds it, publishes it as a public GitHub package, and pins its digest in my infra repo, so rolling back is a git revert. That commit starts a workflow that joins the tailnet, wraps the files in nginx and runs kamal deploy. There's no registry to run: Kamal builds into a registry on the runner, and the servers pull through the SSH connection.
git push
A commit lands on main in the site repo.
GitHub Actions
Builds the static site into an image that holds only its files.
GHCR
Pushes the image to a public GitHub package.
Infra repo
CI commits the image digest to kamal/<site>.yml.
Deploy
The infra repo's workflow joins the tailnet with a short-lived GitHub token, wraps the files in nginx and runs kamal deploy over Tailscale SSH.
New container, one server at a time
Each server's kamal-proxy keeps sending visitors to the old container until the new one passes its health check.
kamal-home-01kamal-ovh-01kamal-ovh-02kamal-ovh-03kamal-afn-01kamal-hxc-01
Nothing is deploying.
One container per site
On k3s, one nginx per node served every site, each mounted from its image. It was cheap, but a site that failed its check blocked every other site's deploys. Now each site is its own container on every server, with its own nginx, and a push replaces only that site's six containers. The cost is memory, and it grows with every site.
A container per site, now
30 containers · 175–189 MiB
3.3–3.4 MiB a container, plus 13–14 MiB of kamal-proxy a server
One shared nginx, on k3s
6 pods · 32 MiB
5.25 MiB a pod, measured with 100 sites
Switching without dropping requests
kamal-proxy owns each site's route on a server. A deploy starts the new container next to the old one and checks its /up every second. Traffic moves only once it answers, and then the old container stops. During a deploy of yoginth.com to the home server, a request through the proxy every 0.2 seconds got 273 answers out of 273, all 200.
1. Starting
GET /up, every second
kamal-proxy
Visitors still get the old container.
2. Switched
/up → 200
kamal-proxy
New requests go to the new one; the old one finishes its own.
3. Done
old container stopped
kamal-proxy
Only the new container is left running.
When something breaks
Most failures stop deploys, not sites. If GitHub is down, the servers keep serving and only new deploys wait. No server controls the others, so losing my house costs the home server and the visitor analytics that run there, nothing else. A container that never passes /up never gets traffic, so a broken image leaves the old one serving.
A server that dies outright takes its connector with it, and Cloudflare sends its visitors to another server. The gap is a server that stays up while its proxy or a site's container breaks. Its connector keeps taking traffic it can't serve, and visitors near it get errors until Docker restarts the crashed container or I fix it. Each server now answers a public /health through Tailscale Funnel, which asks its own kamal-proxy for every site, and an outside monitor checks it every 30 seconds. Taking a failing server out of the tunnel on that signal is next.
What it costs to grow
Adding a server is a checklist: run one setup script, join Tailscale, add the server to every site's Kamal config and push, then start its connector and health check. Adding a site is a Kamal config file, a deploy key, a tunnel route and a line in the health check. Each new site adds one small container to every server, so the hundredth site takes the same effort as the second.