# ADR-005: A warm standby in a second region

- Status: Accepted
- Date: 2024-07-01
- Decided by: Imogen Varga, with Tobias Okonjo and Priya Ramanathan

## Context

Ferrylog runs in one region. Operators sell tickets up to the minute a ferry leaves, so a regional
outage stops sailings from filling. The booking store (ADR-001) is the only part that is hard to move:
the services themselves are stateless and redeploy anywhere in minutes.

## Decision

We run a warm standby of the booking store in a second region, fed by streaming replication. The
recovery point objective is five minutes: after a failover we accept losing at most the last five
minutes of writes. The recovery time objective is thirty minutes.

Failing over is a human decision. The on-call site reliability engineer proposes it, and the platform
team lead or the chief technology officer approves it. We do not fail over automatically, because a
network partition could otherwise leave two primaries taking bookings.

## Consequences

- A regional outage costs up to thirty minutes of sales instead of the length of the outage.
- Bookings and payments made in the last minutes before a failover may need reconciling with the
  payment provider, which the database failover runbook covers.
- Replication lag is monitored, and an alert fires when it exceeds two minutes.
