Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initial pg machine config for scaling to zero #3354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jacobwegner
Copy link

Change Summary

What and Why:

I was kicking the tires on Fly Postgres and this caught my eye:

In the single-instance “Development” config, you’ll also be given the option to activate “automatic scale to zero”. It’s not magic: it’s just how our apps work. If you have an app that connects to your database, make sure that it also scales to zero (otherwise the connection remaining open will prevent it from “going to sleep”

But, it didn't look like my single-instance cluster was ever actually scaling down to zero.

I found this post on community.fly.io that recommended editing the fly.toml to set auto_stop_machines = true.

Making the change to fly.toml and re-deploying worked for me, so I headed to Github to make this PR.

How:

I looked at the changes in #2282 and believe that setting Autostop along with Autostart should do the trick.

I tried to look at the GraphQL schema to see if Autostop was a valid input, but it looks like the config input is as far as the schema goes:

image

I did not yet attempt writing an integration / "preflight" test (my Go is a bit rusty), but would happy to do so if desired.

Related to:

@jacobwegner jacobwegner force-pushed the fix-pg-services-scale-to-zero branch from 7701451 to ba14ef3 Compare March 9, 2024 01:26
@jacobwegner
Copy link
Author

@DAlperin: Pinging you as I saw you had commented on a related discussion thread:

https://community.fly.io/t/scale-to-zero-postgres-for-hobby-projects/12212/13

Is there anything else I could do to help get this reviewed / merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant