Default VM specs for a Phoenix app's db backend

How is the memory size and number of VM determined for an app running postgres db? When I launch a phoenix app called signupsheet, it created two apps including signupsheet and signupsheet-db.

Monitoring shows this db app is using 340MB/4GB, and 3 vms. It sounds excessive so I tried to change scale with fly scale memory 512 -a signupsheet-db but it doesn’t seem to recognize the app name and returns this error:

C:\my_app>fly scale memory 512 -a signupsheet-db
Error: No active machines in process group ‘app’, check fly status output

C:\my_app>fly status
Name = signupsheet
Owner = personal
Hostname =
Image = signupsheet:deployment-01H1G4XA20PARR3ZQE7MSM06HM
Platform = machines

app 3d8dxxxxxxxxx 60 lax stopped 2023-06-02T23:06:50Z
app 908xxxxxxxxxx 60 lax started 2023-06-02T23:06:49Z

Perhaps I need to somehow switch to signupsheet-db app before attempting to change its scale? How do I do that?

Hi @jason2023

You usually choose the resource config for your postgres cluster from a few preset configs (or use a custom config) either when:

  • you create it using fly postgres create, or
  • you run fly launch to build your app and answer Yes to the question ? Would you like to set up a Postgresql database now?

You can see those preset resource options here: Create a Fly Postgres Cluster · Fly Docs. But having 3 nodes is the standard for production apps.

You can’t use fly scale commands to scale postgres Machines, but you can make changes using fly machine update. And because the db app doesn’t have a fly.toml config file with an app name, you’ll need to specify the app in every command (-a signupsheet-db).

If you run fly status -a signupsheet-db, then you should see the info for your db app, including the machine IDs.

NOTE: Before you scale the memory on your Postgres Machines, you should learn about Postgres configuration parameters and adjust them as needed. You can read more in the docs for scaling postgres Machines and the docs for postgres configuration tuning.

You can scale the memory on your postgres Machines, one at a time, using:

fly machine update <machineID> --memory 512 -a signupsheet-db
1 Like

Thanks. Two follow up questions…

  1. If I want to downgrade the postgres machines to a single node Development configuration for the time being, how do I do that?

  2. If I instead remove two Production nodes, and reduce the SSD size from 40gb to something minimal until the project gets out of beta, how could I do that?

Both questions can have the same solution: we recommend you to create a new cluster then import your current data in there. The new cluster could have the amount of nodes you want and storage size you need.

As a word of advice we do recommend postgres to have at least 3 nodes for reliability but if it’s just for beta or development purposes it’s fine to run one.


Thanks for your prompt response.
Ran into another issue trying to follow your advice.

  1. Destroyed all existing machines and volumes under the db app.
  2. Created a new Postgres cluster with a Dev configuration. Named it db-dev.
  3. Tried to detach the old db app and attach the new db-dev, but got this error.
C:\>flyctl postgres detach --app signupsheet signupsheet-db
Error: no 6pn ips founds for signupsheet-db app

C:\> flyctl postgres attach --app signupsheet signupsheet-db-dev
Checking for existing attachments
Error: consumer app "signupsheet" already contains a secret named DATABASE_URL

Try to first unset DATABASE_URL on your app. Should be safe since the old app is gone.

It worked. Thank you!

1 Like