superfly / docs

Apache License 2.0
102 stars 1.04k forks source link

Issue with the "Fly.io Resource Pricing" doc #1700

Closed tcurdt closed 1 month ago

tcurdt commented 1 month ago

I found an issue with this document.

Title: Fly.io Resource Pricing Location: https://fly.io/docs/about/pricing/ Source: https://github.com/superfly/docs/blob/main/about/pricing.html.markerb

Describe the issue

What is the price of running Postgres DB? I cannot figure it out from this page.

Is there a way to run a single instance with more memory? I couldn't figure that out either.

🤷‍♂️

Addtional info

andie787 commented 1 month ago

hi @tcurdt !

Fly Postgres clusters are just apps made up of Machines, volumes, and sometimes extra memory. The Machine price and volume price for Postgres are the same as any other Machine and volume you’d run on Fly.io, and are listed on the pricing page.

We bill only for the resources Postgres clusters use. So the cost of a Postgres cluster is:

( machine_price (started or stopped) + volume_price + additional_memory_price ) * machine_count

We only recommend running single instance Postgres for dev projects, not production. But you can always increase the memory of individual Machines independent of the formal presets you saw when you created the cluster. See https://fly.io/docs/postgres/managing/scaling/

tcurdt commented 1 month ago

Thanks for the quick reply, @andie787. I think that explanation is dearly missing from the pricing page. The way I understood it is that the fly postgres service is outside of the normal app machines. Especially as LiteFS is also mentioned. This clears things up.

But to clarify further: The database would have to run on a separate machine IIUC?

Side note: Not a fan of the push for "dev projects only". In my experience HA comes at a cost that's a bit over the top for tiny services - even in production. At least as long backups/snapshotting is setup. When the services grow up that's a different story of course.

Or is there anything specifically one should worry about when hosting databases on fly?

andie787 commented 1 month ago

your Postgres "app" is one or more Machines with attached volumes. Those Machines only run the db. You can connect to your Postgres app from your other apps on Fly.io.

As for "dev projects only", this comes from us seeing people run a single instance Postgres cluster for ages with no problems and then be unpleasantly surprised when it goes down completely due to a physical host/hardware issue. Every Machine is running on a physical server, and when it has a volume, the volume is also on that same physical server. We take daily volume snapshots, but you might lose data from the interim transactions and you'd definitely need to do a manual recovery to get your database back if you have a single Machine Postgres app and the host goes down. (https://fly.io/docs/apps/trouble-host-unavailable/#fly-postgres-database-apps)

If you're aware of the risks and the downsides don't outweigh the cost savings for your specific project, then we obviously won't stop you from running your db on a single Machine/volume! You might also have your own backup and recovery automation. :)

tcurdt commented 1 month ago

So that means one machine running the db and one machine running the app. OK.

If you could, please explain that in the pricing. For potential new fly users this might really help.

...then be unpleasantly surprised when it goes down completely due to a physical host/hardware issue...

People 🤷‍♂️

You might also have your own backup and recovery automation. :)

Backup or be doomed - this is the way :) Even a HA cluster is no full substitute for that.

Thanks for the help.

andie787 commented 1 month ago

No problem! Have you visited our community? I think you might like it! https://community.fly.io/

andie787 commented 1 month ago

took your suggestion: https://fly.io/docs/about/pricing/#fly-postgres

thanks for pointing out the issue!

tcurdt commented 1 month ago

Thanks for the quick fix!