Skip to content

Postgres + Stolon for HA clusters as Fly apps.

License

Notifications You must be signed in to change notification settings

smitchell41/postgres-ha

 
 

Repository files navigation

High Availability Postgres on Fly

This is a ready-to-go HA Postgres app that runs on Fly.

Prepare your app

flyctl init

Init gets you going with a Fly application and generates a config file.

Set secrets

This app requires SU_PASSWORD and REPL_PASSWORD environment variables and gives users the option to create a "root" account on new database clusters using 'OPERATOR_PASSWORD'.

SU_PASSWORD is the PostgreSQL super user password, and the username is flypgadmin. You can use this to administer the database once it's running. You should create less privileged users for your applications to use.

REPL_PASSWORD is used to replicate between instances.

'OPERATOR_PASSWORD' is used to create a "root" user when a cluster is initialized.

flyctl secrets set SU_PASSWORD=<PASSWORD> REPL_PASSWORD=<PASSWORD>

Deploy one instance

  1. flyctl volumes create pg_data --region ord --size 10
  2. flyctl deploy

Add a replica

  1. flyctl volumes create pg_data --region ord --size 10
  2. flyctl scale count 2

Add a replica in another region

  1. flyctl volumes create pg_data --region syd --size 10
  2. flyctl scale count 2

About

Postgres + Stolon for HA clusters as Fly apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 93.6%
  • Shell 4.8%
  • Dockerfile 1.6%