min_machines_running=0 not working for simple test application

Hi, I just put up a rabbitmq image with the following config. The app has zero active connections but it doesn’t seem to turn off. I assume I’m missing something obvious, just looking for a pointer.

app = "odin-mq"
primary_region = "syd"
kill_signal = "SIGINT"
kill_timeout = 5

[experimental]
  auto_rollback = true

[build]
  dockerfile = "Dockerfile"

[mounts]
source = "odin_mq"
destination = "/var/lib/rabbitmq/mnesia"

[[services]]
  protocol = "tcp"
  internal_port = 5672
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  [services.concurrency]
    type = "connections"
    soft_limit = 20
    hard_limit = 25

  [[services.tcp_checks]]
    interval = "15s"
    timeout = "2s"
    grace_period = "1s"
    restart_limit = 0

[metrics]
  port = 15692
  path = "/metrics"

from a quick look, your config seems fine.

can you

  • remove the min_machines_running line
  • update your flyctl to the latest version
  • and redeploy your app?

Okay giving it a go, I also disabled metrics and health checks for now just to keep it simple.

Left it running a couple of hours, still didn’t shutdown.

Okay I’m going to give up on this and start connecting to it now. But if anyone has any tips on how to get the initial machine to shutdown on zero connections please let me know :slight_smile:

Your app has no exposed ports through the [[services.ports]] configuration option making it a private application. As such, Fly Proxy, the component in our infrastructure that automatically stops/starts app instances has no visibility of it nor of the request volume to the instance (communication over your internal 6PN network occurs outside of the proxy). If automatically stopping instances was enabled regardless, even if you had active connections over 6PN, the proxy wouldn’t know any better and would stop your instance.

One way around this is to add a port and communicate with the application over a Flycast address.

Thanks that makes complete sense.

I’ll have to research this flycast address stuff more that sounds great.

Out of interest, how does Scale to zero for Postgres Development projects · Fly Docs work if the postgres connections are over 6PN?

Hey @jmsfbs good question! Our postgres connections have been over flycast for the last few versions. Notably, the scale to zero stuff can’t work on older 6pn only pg setups.

1 Like

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