Fly Vapor Server Restarting

I am new to using fly. I’ve managed to get my vapor (Swift) server running on fly but I get this:

2024-08-06T19:30:22.702 app[1857597a473198] sjc [info] INFO Main child exited normally with code: 0
2024-08-06T19:03:20.942 app[1857597a473198] sjc [info] WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-08-06T19:03:20.943 app[1857597a473198] sjc [info] [ 416.125459] reboot: Restarting system

This happens every 10 or so minutes. Why is the server exiting? What’s the best way to go about debugging this? Any push in the right direction would be greatly appreciated.

Also in the dashboard it shows 2 machines. I only have one server. Is this normal?

I believe the default is for the Fly proxy to scale to 0 and generally the scale down period is around 10mins in my experience.

If you want to keep a certain number of machines running or prevent scaling, you can adjust the following properties in your fly.toml’s services/http_service section: min_machines_running, auto_stop_machines, auto_start_machines.

Reference: Fly Launch configuration (fly.toml) · Fly Docs

As for two machines, when deploying an app for the first time it defaults to deploying two machines.

the first deployment gives you two Machines for redundancy

from Deploy an app · Fly Docs

Thanks for the response! The min_machines was set to 0, so does this mean the machines will stop until the min_machines is reached? I’m changing min_machines to 1 and auto_stop_machines to false.

That’s correct. Assuming no usage via the Fly proxy endpoint, it will scale down until it reaches min_machines_running.

Just be aware that if you set auto_stop_machines to false, but still have auto_start_machines set to true, it will only scale up and never back down (assuming you still have more than one machine).

If you only ever need one machine, you can run the following:

flyctl scale count 1
1 Like

I changed the fly.toml file and it seems to have stopped the machine from exiting but this morning I saw this:

2024-08-06T21:15:34.424 app[784e69ef2d3de8] sjc [info] WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-08-06T21:15:34.425 app[784e69ef2d3de8] sjc [info] [ 495.208637] reboot: Restarting system

Is there anyway to know why fly is restarting the system and how to prevent it?

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