Running InfraOrcinus for High Availability and Disaster Recovery

By Chirag Panchal · Founder & Lead Architect · · 8 min read

What InfraOrcinus provides for availability (a stateless server, health and readiness probes, database-leased jobs, safe migrations) and what you provide (a replicated PostgreSQL, backups, and the encryption key kept somewhere else). A runbook for losing the database, an unhealthy replica or a bad deploy, and why recovery targets are yours to set.

Development Status & Architectural Evolution: InfraOrcinus is in active development. Architecture specifications, internal interfaces, and operational protocols described herein reflect our current engineering design and are continuously refined to make InfraOrcinus robust, resilient, and enterprise-grade.

An infrastructure delivery platform is a dependency of everything else. When a customer-facing service is down, the people fixing it reach for the tool that provisions replacement capacity or rolls back a bad change. If that tool is down too, recovery waits on it.

So it is worth being exact about who provides what. InfraOrcinus makes itself easy to run in a redundant way and easy to restore. It does not ship a database cluster, a failover manager or a backup scheduler, and it does not promise a recovery time. Those belong to the PostgreSQL you run it on and the operations around it. An earlier version of this article promised "sub-5-minute recovery" and "near-zero data loss"; those are properties of a well-run database tier, not something the control plane can guarantee on its own. This version separates the two.


1. One Stateless Server, One Database

InfraOrcinus is a Go server backed by a single PostgreSQL database. Everything durable lives there: environments, jobs, encrypted credentials, Terraform state, policies and the audit trail. The server keeps nothing important on local disk.

That gives the shape of availability:

  • Run two or more server replicas behind a load balancer, all pointing at the same database. Sessions are token-based, so no replica needs to remember a user.
  • Make the database highly available with whatever you already trust: a managed service with a hot standby, or a streaming-replication cluster. Point DATABASE_URI at the cluster's writer endpoint so a failover is transparent to the servers.
  • Scale runners separately. A job is leased from the database with FOR UPDATE SKIP LOCKED, so two runners are not handed the same job.

2. Two Probes With Different Jobs

The server exposes two unauthenticated endpoints:

Endpoint Meaning Use it for
GET /health The process is up and serving HTTP. Always 200. Liveness
GET /ready The process and its database answer a ping within five seconds. 503 when the database does not. Readiness, load-balancer health

A replica whose database connection is broken fails readiness and leaves rotation without being killed. The readiness response also reports whether a runner is connected, but a missing runner deliberately does not fail readiness: the API can still serve people while runners restart, and a rolling restart of runners must not take the control plane out of rotation.


3. What Is Shared Between Replicas, and What Is Not

Most state is in the database, but two protections are per-process unless you add one more component. Login rate limiting, account lockout and token revocation hold in memory on a single server. With several replicas, set a Redis address and they share that state; without it, a caller can spread attempts across replicas. This is the one piece of "run more than one replica" that needs a decision from you.


4. Migrations You Can Deploy Under Load

The schema is applied by the server at start-up. Each migration runs in its own transaction and is recorded once, a database-wide lock stops two replicas from migrating at the same time, and migrations are written to be safe to run again. Because they are additive, the previous version keeps working against the new schema, which is what makes both a rolling deploy and a rollback to the previous image safe. A bad deploy is therefore a rollback of the image, not a restore of the database, unless data was actually corrupted.


5. Backups, and the Key That Is Not in Them

Two scripts ship with the product: one takes a compressed pg_dump, the other restores a dump after asking for confirmation, because it drops and recreates objects in the target. Schedule the first yourself, and copy the files off the host to encrypted, access-controlled storage.

The point that catches teams out: the encryption key is not in the backup. Cloud credentials, version-control tokens, state, plans, variable values and provider secrets are encrypted at rest with a key you supply, or with a Vault transit key. A dump without that key restores a database whose secrets cannot be read.

  • Back up the key material separately, in a different access-controlled place.
  • After a restore, start the server with the same key it was encrypted with.
  • The rest of a dump is not encrypted: users, blueprints, jobs, logs and the audit trail. Store dumps as sensitive.

A backup you have never restored is a hypothesis. Restore into a scratch database, point a scratch server at it with the matching key, and confirm that login works, a tenant lists its own resources, and a stored credential or state entry decrypts.


6. A Short Runbook

The database is lost. Provision a fresh instance, or promote the standby if you run one. If starting empty, let the server apply migrations. Restore the latest verified dump, supply the original key, check login, a tenant read and a decrypt, then repoint DATABASE_URI or DNS and confirm /ready returns 200 on every replica.

A replica is unhealthy. Nothing to recover. Readiness has already removed it from rotation; replace it.

A deploy goes wrong. Roll back to the previous image. The earlier version still reads the current schema.


7. Recovery Targets Are Yours

The mechanisms support a range of targets, and which one you get is a function of what you run underneath:

  • Recovery point is decided by how you protect the data. An hourly dump bounds loss to about an hour. A hot standby with streaming replication brings it close to zero.
  • Recovery time is bounded by database size when you restore a dump, and is usually fastest by promoting a standby.

Write down the numbers you chose, the backup schedule, where the key backup lives and who owns the process, and rehearse the runbook before you need it.


Summary

InfraOrcinus is stateless, leases jobs from the database, exposes honest liveness and readiness probes, and migrates its schema in a way that allows rolling deploys and rollbacks. You supply the replicated PostgreSQL, the backup schedule, shared state for rate limiting if you run replicas, and, most importantly, a separate home for the encryption key. Recovery objectives follow from those choices, and the ones you can actually promise are the ones you have restored from.