If one of my machines fail I don’t want it to restart. I’m not seeing where I can set the restart policy. Attempting to add it to the configuration leads to a server time out.
Most our services rely on health checks. Any timeline for these for Machines?
If there aren’t health-checks for Machines, what does the restart-policy act on? Does it monitor the exit code to apply restart-policies?
a. Does no mean, a new vm is started on next request?
b. Does always mean, even if it exits with 0, the main process is restarted inside the existing vm?
c. Does on-failure mean, only on non-zero exit codes, the main process is restarted in the existing vm?
What does the default policy do? In all our Machine configs, the restart-policy is empty.
@lubien Can you share what the fly command would be to update the restart policy on an existing machine? I can’t figure out how to do that. If I pass it an updated config.toml file, it detects no changes.
Hey @nick-brevity , the specific command you’ll need is fly machine update <machine_id> --restart <policy>. The three policy options are:
no - always let a Machine stop when its main process exits, whether that’s on purpose or on a crash
always - never let a Machine enter the stopped state, even if your main process exits cleanly
on-fail - try up to 10 times to restart the Machine if it exits with a non-zero exit code, before letting it stop. This is the default behaviour if the policy is not specified.
The thread Lubien linked above goes into more detail on the three policies and when you’d want to apply them to your app