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
App
Name = signupsheet
Owner = personal
Hostname = signupsheet.fly.dev
Image = signupsheet:deployment-01H1G4XA20PARR3ZQE7MSM06HM
Platform = machines
Machines
PROCESS ID VERSION REGION STATE CHECKS LAST UPDATED
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?
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
If I want to downgrade the postgres machines to a single node Development configuration for the time being, how do I do that?
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.