Back to devlog

We Moved a Live Mobile Game to a Mac Mini at Home

The API, bots, Discord bot, site, console, Postgres and Redis of a live mobile game left managed hosting for one self-hosted Mac mini. What moved, how, and the limits.

self-hostinginfrastructuredevopsdockergo
The Retropolis map at night around the Eiffel Tower, with coins, cards and buildings to claim

Since 8 November 2026, everything we host ourselves for Retropolis runs on one Mac mini in France: the Go API, the simulated players, the Discord bot, the admin console, this website, Postgres and Redis. Before that, those pieces were spread across Railway, Neon and Vercel, with two scheduled functions on Google Cloud.

This post covers why we left, the order things moved in, how traffic reaches a machine on a home connection, and what we would not recommend. It stays vague about addresses and configuration on purpose.

Why leave

Mostly plan minimums. We paid two plans at $20 a month, one for the app platform and one for the database. On the app platform our metered usage was about $11 a month, so the plan floor was the real price. The database held about 100 MB and sat at the smallest compute size the provider bills.

Forty dollars a month does not justify a migration on its own, and nothing was broken at those providers. The other reason was the shape of the system. A scheduled function on Google Cloud advanced the game's hourly turn and had to reach our Redis over a public TCP endpoint, because that was the only way in. With one machine we control, Redis has no public endpoint at all, and logs, deploys and data sit in one place.

The machine is a Mac mini with an M2 Pro and 16 GB of memory. It runs a Linux virtual machine, and inside it Coolify, an open-source deploy platform that builds each service from its Dockerfile.

What moved, in order

The plan on 7 November was to move the studio's side projects first and leave the game alone until the box had proven itself. By that evening we had stopped waiting.

  1. Side projects, then the low-risk game services. The beta API, the bots and the Discord bot moved first, still pointed at the old Redis and Postgres.
  2. The admin console. Its two small tables left a serverless Postgres for a plain one on the box, which meant replacing a vendor-specific driver with a standard client.
  3. A second copy of the production API, on the box, sharing the old database and cache, with its scheduler off and its own job queue so it could not steal production jobs.
  4. Trial copies of the data. A Postgres dump and restore gave identical row counts across 35 tables in 6 seconds. Redis was less polite: the old instance ran an image bundling extra modules, and a plain Redis refused its replication stream. A short script copied keys one by one instead, 58,500 of them in 12.8 seconds.
  5. The clock. The hourly turn and the automatic end of a season moved out of the cloud functions and into the Go server as scheduled jobs. The turn writes the time it last ran, so a job delivered twice does not advance the game twice.
  6. The cutover, then the website the same night.

The cutover

Released builds of the app read the API address from a remote config document, with an optional override per app version. That gave us a switch that did not depend on DNS propagation.

On 8 November, in UTC: snapshot of both stores at 00:36, players routed to the new API at 00:41, old API stopped at 00:44, old scheduled functions deleted at 00:47. That night the API's public hostname also moved to the new path in DNS. At 01:00 the new scheduler ran its first hourly turn, once.

We checked the old Postgres later and found no write after the snapshot. We did not measure the interruption from the player's side, so we will not quote a downtime figure. The old API could come back with one redeploy, and the old database and cache stayed idle as a fallback.

An AI coding agent did much of the legwork (copy scripts, environment variables, documentation) within the rules described in AI Coding Agents on a Live Game. A human saved the production DNS changes.

Reaching a machine at home

The box opens an outbound tunnel to Cloudflare, so nothing has to be forwarded on the home router. Requests arrive at Cloudflare's edge, where TLS ends, travel through the tunnel, and reach a reverse proxy on the box that routes by hostname to the right container. The website is now a static Astro build served by Caddy, with no Node process at runtime.

Administration never goes through that path. The deploy dashboard, the log viewer, the queue monitor and direct database access are only reachable over a private mesh network between our own devices.

Not everything is at home. Accounts and the core game state live in Firebase, and the files that describe real-world places stay on object storage. What we moved is the compute, Postgres and Redis.

Deploys

A push to a branch deploys the services that track it. The API and the scheduler are the same image deployed twice, and only one copy runs the periodic jobs; setting the flag on both would run every cron job twice. Builds now run on the machine that serves players, so the multi-stage Dockerfiles from October matter: the server image went from 3.49 GB to 115 MB, distroless, with no shell.

Rolling back means redeploying the previous image, which Coolify keeps. Two caveats we carried over rather than fixed: CI runs after the push and does not gate the deploy, and database migrations run when the server starts, so a rollback has to be compatible with data that has already changed.

Watching it and restarting it

A machine cannot report its own power cut, so the watchdog runs elsewhere. A scheduled function on Google Cloud calls a deep health endpoint every minute; the endpoint checks that the API reaches Redis and Postgres, with two seconds allowed for each.

  • After three failed probes in a row, it flips a flag in the remote config. The app shows a "server unavailable" screen instead of failing request by request, and we get a Discord alert.
  • After two good probes, it restores the flag, but only if it set it itself. A maintenance we declared by hand is never lifted for us.
  • If the hourly turn is more than 65 minutes old, it alerts.

The Mac is set to never sleep and to restart when power returns, and the virtual machine and its containers start again at boot. An operating system update on the box's first day, before it carried any production traffic, was the first test, and everything came back.

What went wrong

  • Deploy-on-push broke first. The dashboard is only on the private network, so GitHub's webhooks had nowhere to land. We restored it the same day by giving GitHub's webhooks a narrow public route of their own, and nothing else.
  • A tunnel route failed to save, without an error. The console answered 404 for about five minutes before we noticed.
  • ARM. Our Go images build natively. The official PostGIS image had no arm64 build when we looked, so Postgres runs a community multi-arch build.
  • Disk. Within the box's first two days, the Docker build cache reached 26.8 GB. On a platform, that is someone else's disk.
  • A hostname we did not own. Two mobile build profiles still baked in the old platform's generated hostname as their API address.

What we would not recommend

This setup has one machine, one disk, one power line and one residential connection. If any of them fails, the API is down until someone fixes it. The watchdog tells players and tells us; it repairs nothing. There is no second machine and no failover.

There is also one person on call. A PaaS is partly a way to pay for other people's nights, and we stopped paying for that.

Backups were the weakest part of the move. On cutover night the safety net was the old database, left idle, and scheduled backups to object storage were the first item on the list written that night. What limits the damage of a dead disk is that accounts and the core game state are in Firebase, not on the box.

If your game earns money every minute it is up, or if nobody can be near the machine within a day, rent a server. Our exit is the same Dockerfiles on a rented machine plus a restore. We have not rehearsed it.

Where that leaves us

The spare capacity is already in use: the same Mac now hosts a full staging world for the next season, with its own database, cache and emulators, reachable only from our devices.

The rest is a bet that a small game with hourly turns can live with a single point of failure, as long as it fails visibly and we say so. If you want to test our uptime yourself, install Retropolis.