Scale to zero for Postgres Development projects
If you select the Development configuration when you create your Fly Postgres app, then you also get the option to have your database scale down to zero after one hour.
After one hour, if there are no open connections, then the database shuts down and waits to restart until something tries to connect again. If there are open connections, then the database stays running and checks for open connections again in one hour.
Turn Off the Scale to Zero Feature
The scale to zero feature is controlled by the
FLY_SCALE_TO_ZERO environment variable.
To turn off scale to zero, you first need to get and save the
fly.toml file locally, since the the automated Postgres creation process doesn't generate a
fly.toml file in the working directory.
fly config save --app <app-name>
fly.toml file and remove the following line from the
FLY_SCALE_TO_ZERO = "1h"
Verify what image you’re running:
fly image show --app <app-name>
Finally, deploy your changes. For example:
fly deploy . --image flyio/postgres-flex:15.2