Skip to content

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 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 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.

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
  1. 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.
  2. Restore the database to a new instance, to the chosen point.
  3. Check the keys. The FLOWCATALYST_APP_KEY in the environment must be the one that was current at the recovery point (keep the previous ones, comma-separated, in FLOWCATALYST_APP_KEY_PREVIOUS if a rotation was under way); the signing keyring in the restored database can be opened only with it. With FC_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.
  4. Point the platform at the restored database (FC_DATABASE_URL or the secret behind DB_SECRET_ARN).
  5. 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.
  6. Start the worker tier, then the router, then runners and ingestors.
  7. 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.
  8. 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.

The same procedure, with these differences:

  • Queues. SQS queues are regional. In the new region, set FC_DISPATCH_QUEUE_URL (or FC_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_ISSUER stays 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.