Phoenix app fails to restart on incoming traffic

my phoenix small app is setup to shutdown when there are no users and boot up when request comes in using fly.io proxy system. Today i am noticing machine is not able to start and on fly.io dashboard i see machine failed error only on repeat.

failed	launch	flyd	May 27, 2025 11:38AM	
starting	start	user	May 27, 2025 11:38AM	
failed	launch	flyd	May 27, 2025 11:38AM	

Is the machine sufficiently alive enough for you to shell into it (flyctl ssh console)? If so, perhaps you can retrieve some Phoenix-level logs.

Consider also posting your TOML config in this thread (in text format, not as an image, using a Markdown code block). I am wondering if you have a health-check defined that is persistently failing.

app = "chatclub"
kill_signal = "SIGTERM"
primary_region = "otp"

[env]
DATABASE_PATH = "/mnt/name/chatclub.db"
PHX_HOST = "chatclub.dev.com"
PORT = "8080"
RELEASE_COOKIE = "kungfuPanda"

[http_service]
auto_start_machines = true
auto_stop_machines = true
force_https = true
internal_port = 8_080
min_machines_running = 0
processes = [ "app" ]

  [http_service.concurrency]
  hard_limit = 1_000
  soft_limit = 1_000
  type = "connections"

[[mounts]]
destination = "/mnt/name"
source = "name"

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

no machine is not even starting so i cant do anything. That is why status is showing “failed” i guess

trying to ssh just to be sure

❯ fly ssh console
Error: app chatclub has no started VMs.
It may be unhealthy or not have been deployed yet.
Try the following command to verify:

Ah, I wonder whether your original post is misleading. It sounded as if your app works fine when originally deployed, but fails to come back after a suspend and wake-on-request.

However, it sounds like it is actually just dead, and won’t start from a cold boot. Does that sound right?

yes sir and i have been running this app with same toml file for months. sorry for confusion. Today i notice its not booting up and keep saying machine failed.

If i do fly deploy which i did this morning it worked. I go away now in night still app is down and machine failed. So this leads me to think issue is with proxy stopping my app but not able to bring it back. Which is strange since i didnt change anything maybe fly.io have some changes in back

OK, gotcha; that’s good additional detail. Do your Live Logs in your web console give anything useful?

only this is showing

$ fly logs -a chatclub

Waiting for logs...

Oh, hang on:

Today [I] notice [it’s] not booting up and keep saying machine failed.

You also say:

If [I] do fly deploy which [I] did this morning it worked

These statements do not seem to be compatible. If you do fly deploy then it is booting up.

So, right, back to your original suggestion then; I wonder if some nuances are being lost in translation.

If you want, you could switch auto_stop_machines = false, which would at least keep your app running! However, I agree that suspend and wake should work.

Can your app do application-level logs to a file? If so, see if you can them to write to your mounted folder. Maybe there will be some logs that are written there on unsuccessful wake.

so normal function is if your app is not getting used fly.io shut down machines using fly.io proxy. that is the part in toml file “auto_stop_machines” at least that was my understanding. So in morning i notice when i open my app nothing was showing. I tried and tried so finally did
fly deploy and it brings it back. Since my app doesnt have many users or regular traffic it got shutdown again and now again not working :slight_smile:

Yes, but you’re not obligated to use the suspend feature. I think suspend can be made to work, but in the interim, turn suspend off, so your app doesn’t stop working.

yes but saves billing and cost :slight_smile: that is why i love that feature and want to solve it using auto stop support enable

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