Run an installation / When something is down
When something is down
Caroline fails closed. When a part cannot be sure, it refuses rather than guesses, and it never lets a change land without its record. Here is what each part does when another is down, slow or restarting.
At a glance
| Down | Decisions | Changes |
|---|---|---|
| The engine or the PDP | refused gateways get 503 or no answer, and forward nothing, unless their connection lets calls through (below) | can be saved; reach the engine when it is back |
| The backend | go on from the rules, directory and keys the engine and PDP hold; stop after 15 minutes without a fresh directory | none: the console and API are down |
| Distribution (OPAL) | go on from what the engine holds; the same 15-minute limit | saved, but reach the engine only when it is back |
| The rules' history (git) | go on | refused; nothing half-saved |
| The ledger's disk | go on recorded once it is back, within limits (below) | refused (503 ledger_unavailable), except suspending an agent and revoking a key |
| The key store | go on with the key list the PDP holds | no key can be issued or revoked until it is back |
Why decisions stop after 15 minutes
Suspensions, removals and computed dates (an access that expired today, an embargo that lifted) reach the engine with the directory. An engine that has not had a whole directory for 15 minutes cannot know them, so it reports itself not ready and the PDP refuses. That is a choice: a stale yes is worse than a no.
What the ledger can lose
- While its disk is unavailable, the engine holds unsent decisions in a bounded memory buffer (128 slots) and sends them when it can. A long outage, or an engine restart during one, loses what it held.
- Refusals at the PDP's door are forwarded on a queue of 1,000, best-effort; drops are counted.
- Changes are never lost this way: a change the ledger cannot record is not made.
Watch the ledger's metrics (The decision ledger).
Restarts
| Restarted | What you notice |
|---|---|
| Backend | everyone is signed out; the rogue-agent flags are rebuilt from the ledger; a change waiting for a countersign keeps waiting, and one a restart cut off is settled against the ledger and git; a connector that holds the credential takes the person from the agent's key, if an older version left it otherwise (recorded) |
| PDP | the Decisions page's recent list empties (the ledger keeps everything); approvals issued before the restart are refused, so a used one can never be replayed |
| Engine | it reloads the rules, the directory and its modules, and answers once it holds them |
Rolled back
| Rolled back | What you notice |
|---|---|
| The PDP, below 0.10.1 | gateways that take the person from the agent's key are cut off, and every key issued for a person is refused |
| The backend, below 0.50.2 | keys issued for a person can be neither listed nor revoked; connections' tools are no longer Caroline's, and connectors keep the tools they hold; a connector that holds the credential may be left not taking the person from the key until this version starts again |
Roll out the PDP first, then the web app, then the backend.
Two writers at once
- Two people saving rules: each save names the version it was reviewed against; the second is refused (
409 stale) rather than undoing the first. - Two edits to one record or list: the version in
If-Matchcatches it (412); nothing changes. - The same request sent twice: the
Idempotency-Keyreturns the first answer. - Two people countersigning one change: the first applies it; the second is refused, and nothing applies twice.
- Two backends: never at once. The ledger has one writer, held by a lock; a second waits, answering
503, and takes over within seconds.
What your gateway should do
Treat anything but "decision": true in a 200 as no. Set a deadline on the whole evaluation (2 seconds is a good start), retry a 503 or a lost connection at most once, and never cache an answer. Run the PDP's route close to your gateway. See Fail closed.
A connection declares what its connector does when Caroline gives no answer: follows the last mode (refuses after an enforce answer, lets the call through after an observe answer), refuses, or lets the call through. The card on Keys says Lets calls through when Caroline is down when that is so.