Auto stop not working

Hi everyone,

I’m having trouble getting my machines to auto-stop. I’ve set auto_stop_machines = "stop" and min_machines_running = 0 in my fly.toml, and I’ve also tested with auto_stop_machines = true, but the machine still don’t stop automatically.

One machine have been running for about a year and it never worked, but I’d really like to get this feature working now. Am I missing something in my configuration, or is there another setting I should check?

The services part of my fly.toml:

[[services]]
  auto_start_machines = true
  auto_stop_machines = "stop"
  internal_port = 5432 # Postgres instance
  protocol = "tcp"
  min_machines_running = 0

Thanks in advance for your help!

Hi… It would probably help to post your entire fly.toml.

(Feel free to * out any sensitive names, but do show the full structure.)

Also, the outputs of fly ips list -a app-name and fly m list -a app-name—and a few words about how you’re accessing this service currently (public Internet, 6PN, etc.)—would give us forum readers a bit more to go on…

How was the Postgres machine created? if fly postgres then you need to choose the option of going down to zero at creation time, it’s valid only for the Development type (1 node), and it goes down after 1 hour without incoming connections.

Also, importantly, you need to make sure the applications that query postgres do not keep connections open otherwise the postgres machine won’t ever go down

Found out the solution, my bad.

I also had a [http_service] section:

[http_service]
  internal_port = 3000
  force_https = true
  min_machines_running = 0
  processes = ["app"]

without

auto_stop_machines = "stop"
auto_start_machines = true

So the solution here is to add auto_stop_machines = "stop" & auto_start_machines = true to [http_service] which gives:

[http_service]
  auto_stop_machines = "stop"
  auto_start_machines = true
  internal_port = 3000
  force_https = true
  min_machines_running = 0
  processes = ["app"]
1 Like