Cloud Migration
Moving a live game from Digital Ocean to Hetzner behind a clean abstraction, then proving horizontal scaling with a real-cloud load test. Part of the Box of Cards work.
TS · Hetzner · Digital Ocean · Docker · go-task · GitHub Container Registry · cloud-init · Route53 · Let's Encrypt · MongoDB · NestJS · NodeJs · Jest
The Cloud Provider as a Swappable Detail
Digital Ocean was never the problem — great API, clean UI, fair cost. But Hetzner's RAM runs about a dollar a gigabyte against Digital Ocean's six, and I wanted the headroom to bolt on logging and metrics and try a few tech stacks without paying for an upgrade. So the move came down to paying less and getting more.
The broader result is that the cloud provider became a detail behind one clean interface. A single setting now re-points provisioning, object storage and certificate generation — and in the same change the Docker images moved off the Digital Ocean registry to GitHub's Container Registry (ghcr.io), which every node now pulls from on boot.
One Project, Two Environments
Beta and live share a single Hetzner project. Env-scoped server names keep the two apart while DNS and the app still use short names, and every new server boots from a pre-baked snapshot — trusted only once its health check returns green.
One Bucket, Foldered by Concern
State that has to outlive any single server lives in one Hetzner Object Storage bucket, split into folders by job: live/ and beta/ keep the two environments' assets apart, cert/ holds the certificates a fresh node pulls as it boots, and monitoring/ collects what the observability stack ships off-box.
Moving the old Digital Ocean bucket across was painless, since both providers wrap the same AWS S3 API — so faithfully that the protocol still wants its credentials in environment variables named for AWS secret keys, even though they're Hetzner's. S3 was just too prominent to escape.
Proving the Autoscaler Before the Traffic
Earlier autoscaling tests leaned on artificially low game-count thresholds to trip the scaler. This one goes for the real thing: it provisions genuine Hetzner servers and floods a node with 10,000+ memory-heavy games until it hits its RAM ceiling and the fleet scales itself up — then checks the new node boots with a valid certificate and that live games survive the scale event.
A fresh Hetzner account caps the project at five servers, so the three live nodes leave no room to stand a full beta fleet beside them. The load test works within that: it spins beta up on its own, drives it to the scale event, and tears it back down — rather than running against live.