Backup and disaster recovery
FlowCatalyst keeps its state in one PostgreSQL database plus a few keys and an artifact store. Everything else (processes, queues, Redis, ingestor runtimes) can be rebuilt from those. Backup and recovery therefore come down to protecting four things, and understanding what rolling the database back to an earlier point does to work in flight.
What to back up
Section titled “What to back up”| What | Why | How often |
|---|---|---|
| The PostgreSQL database | Every definition, principal, event, dispatch job, audit entry, ingestion watermark and function version | Continuously: point-in-time recovery, plus regular full backups |
FLOWCATALYST_APP_KEY (and FLOWCATALYST_APP_KEY_PREVIOUS during a rotation) |
Without it a restored database’s secrets cannot be decrypted, OAuth client secrets cannot be verified, dispatch messages cannot be verified and field-worker PINs cannot be checked | Whenever it changes. Store it apart from the database backups |
| The JWT signing keys | With the keyring (FC_JWT_KEY_STORE=database, the default with an app key) they are in the database, sealed with the app key, so the database backup and the app key together restore them: nothing more to back up. With FC_JWT_KEY_STORE=config, the configured RSA key: without it every issued token is invalid. Users sign in again and resource servers fetch the new key, so this is recoverable, but disruptive |
Keyring: with the database. Configured key: whenever it changes |
Function artifacts (FC_FUNCTIONS_ARTIFACT_STORE) |
Version rows point at artifacts by digest; a missing artifact cannot be loaded by any runner | With the database. Artifacts are immutable and content-addressed, so object versioning and replication suit them |
Also keep, with your deployment configuration: the environment of each tier, the push gateway’s
FC_PUSH_STREAM_SECRET, router Basic auth credentials, and ingestor extension jars or manifests.
What does not need a backup
Section titled “What does not need a backup”| What | Why |
|---|---|
| Dispatch queues (SQS or the Postgres broker) | A queue message is a pointer to a dispatch job. A job whose message is lost is republished by stale recovery within 15 minutes. The Postgres broker’s rows are in the database anyway |
| Redis | Leader-election locks and rate-limit counters only. A new Redis starts empty and elections resume |
| Router, scheduler and runner processes | Stateless between restarts |
| Ingestor runtimes | Watermarks, cursors and leases live on the platform |
| Push streams | Clients reconnect and resume from the push log, or re-subscribe |
Applications’ own outbox tables live in their databases; back those up with the applications.
What a restore means
Section titled “What a restore means”Restoring the database to an earlier point rolls back everything after it. Plan for these effects, and choose a recovery point objective accordingly. Point-in-time recovery to a few seconds before the failure keeps them small.
| Area | Effect of restoring to an earlier point |
|---|---|
| Events accepted after the recovery point | Lost. Applications’ outbox relays delete rows once the platform accepts them, so they will not resend. Applications that can republish (by replaying their own records) should |
| Dispatch jobs | Return to their state at the recovery point. Jobs that completed after it will be delivered again; jobs QUEUED or PROCESSING at that point are recovered by stale recovery and delivered. Consumers must be idempotent (they must be anyway: delivery is at least once) |
| Queue messages created after the recovery point | Name jobs that may no longer exist. The delivery callback acknowledges and drops a message whose job is missing or already finished, so they drain harmlessly |
| Ingestions | Watermarks and cursors move back, so sources are read again from that point. Idempotency keys also move back, so records ingested after the recovery point produce jobs again |
| Sessions and tokens | Refresh tokens and sessions issued after the point are unknown: those users sign in again. Access tokens stay valid until they expire (they are signed, not stored) |
| Configuration and identity | Users, roles, subscriptions and secrets created or changed after the point are gone. Re-apply them; applications’ definition syncs restore their own definitions |
| Scheduled jobs | Firings after the point are not recorded. Each job fires once for its most recent slot since the recovery point (earlier missed slots are skipped), then on schedule; a firing the receiver already handled may therefore come again |
| Audit log | Entries after the point are lost. Ship the audit log elsewhere too if it matters for compliance |
Restoring
Section titled “Restoring”- Stop the writers. Scale the worker and router tiers to zero first (so nothing claims or delivers against the old database), then the API tier, runners and ingestors.
- Restore the database to a new instance, to the chosen point.
- Check the keys. The
FLOWCATALYST_APP_KEYin the environment must be the one that was current at the recovery point (keep the previous ones, comma-separated, inFLOWCATALYST_APP_KEY_PREVIOUSif a rotation was under way); the signing keyring in the restored database can be opened only with it. WithFC_JWT_KEY_STORE=config, use the same JWT signing key if you still have it. A key the platform rotated after the recovery point is not in the restored keyring, so tokens signed by it stop verifying and those users sign in again. - Point the platform at the restored database (
FC_DATABASE_URLor the secret behindDB_SECRET_ARN). - Start one API process. It applies any migrations the restored database lacks (a restore from before an upgrade) and seeds. Then start the rest of the API tier.
- Start the worker tier, then the router, then runners and ingestors.
- Verify: sign-in, a client-credentials token, a test event delivered end to end, the dispatch
backlog draining (
fc_scheduler_pending_oldest_age_seconds), ingestions polling. - Tell application owners the recovery point, so they can republish what was lost and expect repeated deliveries.
Practise this. A restore you have not timed is not a recovery time objective.
Recovery in another region
Section titled “Recovery in another region”The same procedure, with these differences:
- Queues. SQS queues are regional. In the new region, set
FC_DISPATCH_QUEUE_URL(orFC_DISPATCH_QUEUE_REGION) for the new region; the platform creates each client’s queues there on first publish and the router learns them from the router-config document. Messages left in the old region’s queues are not needed: stale recovery republishes their jobs. - Artifacts and secrets must be replicated to the new region ahead of time (object replication, replicated secrets).
- The public URL. If
FC_JWT_ISSUERstays the same (a DNS failover), tokens and SSO configuration keep working. A new URL means every identity provider’s redirect URI and every token validator’s issuer must change.
- Database: RDS or Aurora automated backups with point-in-time recovery; copy snapshots to a second region, or run an Aurora global database or a cross-region read replica for a lower recovery time.
- Keys: keep the app key (and, with
FC_JWT_KEY_STORE=config, the signing key) in Secrets Manager with replication to the recovery region. - Artifacts: S3 versioning plus cross-region replication on the artifact bucket and the extension-manifest bucket.
- Queues: nothing to replicate.
- Database: Cloud SQL automated backups with point-in-time recovery, and a cross-region read replica that can be promoted.
- Keys: Secret Manager with replication to the recovery region.
- Artifacts: the artifact store is a shared file system here (Filestore or similar); back it up with its own snapshots or copy it with the database backups.
- Queues: the Postgres broker lives in the database and is restored with it.
- Database: WAL archiving with a tool such as pgBackRest, WAL-G or Barman for point-in-time recovery, plus a streaming replica in another location.
- Keys: your secret store’s own backup and replication; an offline copy of the app key in a safe place.
- Artifacts: snapshots or a copy of the shared artifact volume, taken with the database backups.
- Queues: the Postgres broker lives in the database and is restored with it.
Read next
Section titled “Read next”- Database operations.
- Key rotation: rotating the keys you are backing up.
- Upgrades: backups before every deploy.