Fly lets you run app servers and read replicas in multiple regions. We also give you a tool for getting requests to the right place. You can read all about it here: Multi-region PostgreSQL · Fly
The example is Rails based, we’d like to deliver this as a Ruby gem. The Gem needs to do two things:
DATABASE_URLenvironment variable before Rails boots.
- Install Rack middleware and modify the ApplicationController to handle Postgres readonly errors and send back the
fly-replayheader. This is easy to implement in a controller, but it might be a little tricky to do as middleware.
If the gem doesn’t detect these environment variables, it should print a warning to logs and do nothing:
It would be nice to make these environment variables configurable, or at least make it easy to add config options for v2.
We think this is a ~4 hour project for experience Rails and Ruby gem developers. We’ll pay you $1,000 to build the first version for us! Post here if you’re interested, link to previous Ruby / Rails / Rack code and we’ll let you know when to go.