Autostop not working for supabase stack deployed using docker dind

I have deployed supabase stack using docker dind based image to run docker-compose.

I have put fly.io instance to autostop: "suspend" mode. Here’s my fly.toml file

primary_region = 'sin'

[build]
  dockerfile = "Dockerfile.fly"

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

[mounts]
  source = "supa_img"
  destination = "/var/lib/docker"
  initial_size = 5

[[services]]
  internal_port = 5432
  protocol = "tcp"

  [[services.ports]]
    port = 5432
    handlers = ["pg_tls"]

[[services]]
  internal_port = 8000
  protocol = "tcp"
  auto_stop_machines = "suspend"
  auto_start_machines = true
  min_machines_running = 0

  [[services.ports]]
  handlers = ["tls", "http"]
  port = "443"

Deployment works fine. I was anticipating my machine to suspend based on my autostop settings. However, I don’t see my machine getting suspended after even 30 min of inactivity.

I also don’t see any request getting logged. Can someone help me with this issue? I am new to fly.io setup.

Hi… Auto-suspend is fairly new, and there are still some glitches being reported. I would try changing that to "stop" and see if that improves things.

Also, you can remove the entire 5432 block if you don’t actually have a need to access the database from the outside. (The fact that one port is auto-stopped but the other is not may be confusing things, :thought_balloon:.)

Hope this helps a little!

Added autoscaling, postgres

Thanks @mayailurus. Your solution really helped me troubleshoot the issue.

  • I first tried using stop as value for autostop and removing 5432 port section. That stopped my machine after 6 min. of inactivity.
  • Then, I used replaced autostop value with suspend. 5432 was removed. That worked by suspending the machine after 6 min. of inactivity.
  • Then I uncommented 5432 section but added auto_stop_machines and auto_start_machines. This too worked by suspending the machine.

So I guess, not adding auto_stop_machines and auto_start_machines inside 5432 section was the real issue.

Thanks a ton once again for your help.

1 Like

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