What about one DB (PostgreSQL), do I need two volumes?

Hi, I understood to need that two volumes are assigned to one app.

So what about one DB (PostgreSQL), do I need two volumes?

By default, one VM and one volume are assigned to one DB.

Machine

Volume

Hi @shirotamaki

It’s not necessary to have more than 1 VM, only recommended.

Having only 1 VM means you can suffer from outages during deploys as the VM is updated and restarted.

If the app is for testing/staging then high availability probably isn’t necessary. But if it’s for production then the recommendation is to have more VMs.

1 Like

Thank you for your comment !!

Just to be sure, let me ask if I am correct in my understanding.

The configuration of the application I am developing is as follows

  • App - 2 VMs - 2 Volumes
  • DB - 1 VM - 1 Volume

In Docs, I see the following statement, does it mean that my setup is using 3 vms? Or can I set up 3 in app and 3 in db for free?

Free Allowances
Resources included for free on all plans: Up to 3 shared-cpu-1x 256mb VMs

  • Up to 3 shared-cpu-1x 256mb VMs†
  • 3GB persistent volume storage (total)
  • 160GB outbound data transfer

Regarding the free tier, it’s 3 VMs in total across all apps in your organization. Having 3 VMs for your app and 3 VMs for your DB would be 6 total which would be over the limit.

1 Like

I see. I knew it…

Thanks, I feel relieved now.

Hello, @charsleysa

Thanks for your help just now.
May I ask an additional question?

I have created 2 Volumes.
I want to attach them to the Machines I have already prepared, but the ID vol_B_xxxxxxxxxxxxxxx is not attached to the Machines.

Please tell me how to attach it.

❯ fly volumes list
ID                  	STATE  	NAME                            	SIZE	REGION	ZONE	ENCRYPTED	ATTACHED VM   	CREATED AT
vol_A_xxxxxxxxxx	created	outdoor_heart_sutra_backend_data	1GB 	nrt   	a588	true     	AAAxxxxxxxxxxx	34 minutes ago
vol_B_xxxxxxxxxx	created	outdoor_heart_sutra_backend_data	1GB 	nrt   	6082	true     	              	37 minutes ago
❯ fly status
App
  Name     = outdoor-heart-sutra-backend
  Owner    = personal
  Hostname = outdoor-heart-sutra-backend.fly.dev
  Image    = outdoor-heart-sutra-backend:deployment-xxxxxxxxxxxxxxxxx
  Platform = machines

Machines
PROCESS	ID            	VERSION	REGION	STATE  	CHECKS	LAST UPDATED
app    	AAAxxxxxxxxxxx	4      	nrt   	stopped	      	2023-06-10T08:22:40Z
app    	BBBxxxxxxxxxxx	3      	nrt   	stopped	      	2023-06-04T14:24:14Z

Looks like one of your machines is running on an old version. Possibly the old version didn’t have any volume mounts. Maybe try deploying again to see if it will update both machines.

1 Like

I initialized Fly.io and tried again.

  • Delete App and db on the dashboard
  • Delete local Dockerfile and `fly.toml
  • Run fly launch.
  • Run fly machine clone <machine-id>.

Result.

❯ fly status
App
  Name     = outdoor-heart-sutra-backend
  Owner    = personal
  Hostname = outdoor-heart-sutra-backend.fly.dev
  Image    = outdoor-heart-sutra-backend:deployment-01H2JH5NCPN0X4RV99W0D1WB9N
  Platform = machines

Machines
PROCESS	ID            	VERSION	REGION	STATE  	CHECKS	LAST UPDATED
app    	14xxxxxxx	1      	nrt   	stopped	      	2023-06-10T11:37:45Z
app    	56xxxxxxx	1      	nrt   	started	      	2023-06-10T11:44:58Z


❯ fly volumes list
ID                  	STATE  	NAME                            	SIZE	REGION	ZONE	ENCRYPTED	ATTACHED VM   	CREATED AT
vol_3q80vd3	created	outdoor_heart_sutra_backend_data	1GB 	nrt   	a588	true     	56xxxxxxx	2 minutes ago
vol_lgz1vpp	created	outdoor_heart_sutra_backend_data	1GB 	nrt   	e73c	true     	14xxxxxxx	14 minutes ago

The problem has been resolved successfully.

Thank you very much !!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.