Skip to content

High availability & recovery ​

Roles is the opt-in multi-Server path for Compose. Replicate stateless Services behind a named Cloudflare Tunnel or an external TLS load balancer. Stateful Services remain singleton; high availability of their data still needs an App/database replication strategy and verified Backups. Swarm is frozen.

Yoho deploys to Servers you own. It does not make a database highly available, and it does not pretend to. This page says what fails when a Server fails, and how you get back.

Compose without Roles: one Server per Destination ​

Without Roles, the compose runtime (the default) deploys a Destination to exactly one Server. That Server is a single point of failure: if it dies, the App is down until you rebuild it somewhere else. Zero-downtime deploys (kamal-proxy) protect against bad releases, not against a lost machine.

Two Destinations (production, staging) on two Servers are two independent copies of the App, not a failover pair. Yoho never moves traffic between them.

What Swarm adds, and what it doesn't ​

With runtime: swarm (Swarm) a Destination spans several Servers:

  • Stateless Services (Web, workers) run replicas on any node. If a worker node dies, Swarm reschedules its tasks on the others, and the Proxy on every node keeps routing to the service VIP.
  • Stateful Services stay pinned to the first Server (ADR 0005). Their volume lives on that disk. If the first Server dies, the database is gone with it, and Swarm will not (and must not) start an empty copy elsewhere.
  • The first Server is also the only manager that yoho swarm init creates. Losing it loses the control plane until you rebuild it.

So Swarm removes the single point of failure for stateless capacity. The data, and therefore the App, still depends on one Server.

Database replication is out of scope ​

Replicated or clustered databases (PostgreSQL streaming replication with Patroni, MySQL group replication, managed databases such as RDS, Cloud SQL, Neon or Supabase) are the way to survive a lost database Server without data loss. Yoho does not set them up, fail them over, or reconcile split-brain. If you need that:

  • use a managed database and point the App at it with a secret, or
  • run the cluster yourself and treat it as an external dependency of the App.

Yoho's job then is deploying the stateless Services against it.

Yoho does not fail over. For a hot standby that you promote by hand, the Postgres primary and standby recipe runs streaming replication across two Servers with Roles. It documents and CI-tests yoho db promote (a manual, fenced promotion after you point the Connection at the standby), the rebuild of the old primary, and password rotation. yoho db promote runs only when you run it; nothing watches the primary. yoho app stop SERVICE keeps a Service down through deploys, applies and rollbacks until yoho app start SERVICE (CLI). The MariaDB primary and replica recipe runs GTID replication the same way, with a documented manual promotion.

Off-Server Backups are the recovery path ​

For a database Yoho runs, recovery after losing its Server is restore from a Backup. That only works if the Backup is not on the lost Server:

  • Use an off-Server Backup Target: restic to S3/B2/SFTP/rclone:, or an encrypted archive on an rclone remote. A local path on the same Server is lost with it.
  • Or mirror archives to another machine with yoho backup pull.
  • Use an encrypted Target so generated secrets (x-yoho.generate, such as the database password) are in the Backup too; otherwise keep copies of them elsewhere.
  • Schedule Backups (Scheduled Jobs). Your recovery point objective (RPO) is the Backup interval: data written after the last Backup is lost.

The steps and measured timings are in the Losing a Server runbook.

Know your recovery time: drills ​

A Backup you have never restored is a hope. yoho backup drill restores the newest Backup into a throwaway project next to the running App, waits for the healthchecks, runs your x-yoho.backup.verify command and prints how long download, restore and health took: a recovery time (RTO) estimate for the data part of a recovery. Run it on a schedule you trust, after schema changes, and before you need it. See Restore drills.

yoho backup restore --from production -d staging exercises the full path on a second Destination, including the deployed App starting against restored data.

Summary ​

FailureCompose DestinationSwarm Destination
Bad releaseRollback, zero-downtime cutoverSame
App container crashDocker restart policy (restart: unless-stopped)Swarm reschedules
Worker node lost(n/a: one Server)Stateless tasks move; Stateful Services unaffected
Server with Stateful Services lostDown until rebuilt from BackupDown until rebuilt from Backup
Backup Target on the lost ServerData lostData lost