From f509bcb0dc34d3f3b39d9e63c777e0289ed31166 Mon Sep 17 00:00:00 2001 From: Will Jordan Date: Fri, 17 Jan 2025 00:07:55 -0800 Subject: [PATCH 1/3] Update machine restart policy docs Add extra details to `on-fail` restart policy documentation: - clarify that the `max_restart` value is configurable, with a default 10 - add detail that the max number of restarts is evaluated within a fixed 5-minute window --- machines/guides-examples/machine-restart-policy.html.markerb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/guides-examples/machine-restart-policy.html.markerb b/machines/guides-examples/machine-restart-policy.html.markerb index 9cc15836df..f07569c40c 100644 --- a/machines/guides-examples/machine-restart-policy.html.markerb +++ b/machines/guides-examples/machine-restart-policy.html.markerb @@ -13,7 +13,7 @@ The restart policies are: - **`always`**: Always restart a Machine automatically and never let it enter a `stopped` state, even when the main process exits cleanly. `always` is the default when you create a Machine with `fly m run` and for Fly Postgres app Machines. Recommended for "always-on" apps with no services configured, since the Machine restarts regardless of the exit code. -- **`on-fail`** (or **`on-failure`** for the Machines API and when viewed in the Machine config): Try up to 10 times to automatically restart the Machine if it exits with a non-zero exit code, before letting it stop. Recommended for most Machines with services configured, since Fly Proxy can wake them on request. `on-fail` lets Machines be restarted if they crash, and allows your app Machines to effectively scale down by exiting cleanly. `on-fail` is the default when there's no explicit restart policy in a Machine's config, such as Machines created by `fly launch` and `fly deploy`. Machines with a schedule also default to the `on-fail` restart policy. +- **`on-fail`** (or **`on-failure`** for the Machines API and when viewed in the Machine config): Try up to `max_restart` (default 10) times within a 5-minute window to automatically restart the Machine if it exits with a non-zero exit code, before letting it stop. Recommended for most Machines with services configured, since Fly Proxy can wake them on request. `on-fail` lets Machines be restarted if they crash, and allows your app Machines to effectively scale down by exiting cleanly. `on-fail` is the default when there's no explicit restart policy in a Machine's config, such as Machines created by `fly launch` and `fly deploy`. Machines with a schedule also default to the `on-fail` restart policy. ## Check a Machine's restart policy From 7f66e515d6fc934830e5d4375055803dcc26e124 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Mon, 6 Jul 2026 23:29:21 +0000 Subject: [PATCH 2/3] Match the max_retries field name used by the Machines API --- machines/guides-examples/machine-restart-policy.html.markerb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/guides-examples/machine-restart-policy.html.markerb b/machines/guides-examples/machine-restart-policy.html.markerb index f07569c40c..f46d0aea62 100644 --- a/machines/guides-examples/machine-restart-policy.html.markerb +++ b/machines/guides-examples/machine-restart-policy.html.markerb @@ -13,7 +13,7 @@ The restart policies are: - **`always`**: Always restart a Machine automatically and never let it enter a `stopped` state, even when the main process exits cleanly. `always` is the default when you create a Machine with `fly m run` and for Fly Postgres app Machines. Recommended for "always-on" apps with no services configured, since the Machine restarts regardless of the exit code. -- **`on-fail`** (or **`on-failure`** for the Machines API and when viewed in the Machine config): Try up to `max_restart` (default 10) times within a 5-minute window to automatically restart the Machine if it exits with a non-zero exit code, before letting it stop. Recommended for most Machines with services configured, since Fly Proxy can wake them on request. `on-fail` lets Machines be restarted if they crash, and allows your app Machines to effectively scale down by exiting cleanly. `on-fail` is the default when there's no explicit restart policy in a Machine's config, such as Machines created by `fly launch` and `fly deploy`. Machines with a schedule also default to the `on-fail` restart policy. +- **`on-fail`** (or **`on-failure`** for the Machines API and when viewed in the Machine config): Try up to `max_retries` (default 10) times within a 5-minute window to automatically restart the Machine if it exits with a non-zero exit code, before letting it stop. Recommended for most Machines with services configured, since Fly Proxy can wake them on request. `on-fail` lets Machines be restarted if they crash, and allows your app Machines to effectively scale down by exiting cleanly. `on-fail` is the default when there's no explicit restart policy in a Machine's config, such as Machines created by `fly launch` and `fly deploy`. Machines with a schedule also default to the `on-fail` restart policy. ## Check a Machine's restart policy From b4292922273c3c94eb784cea5b5364f7e32d892e Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Mon, 6 Jul 2026 23:30:46 +0000 Subject: [PATCH 3/3] Fix fly.toml and flyctl casing flagged by Vale --- .../guides-examples/machine-restart-policy.html.markerb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/machines/guides-examples/machine-restart-policy.html.markerb b/machines/guides-examples/machine-restart-policy.html.markerb index f46d0aea62..c9a9d00f21 100644 --- a/machines/guides-examples/machine-restart-policy.html.markerb +++ b/machines/guides-examples/machine-restart-policy.html.markerb @@ -95,8 +95,8 @@ For example: Refer to the Machines API docs for more information about [updating a Machine](/docs/machines/api-machines-resource/#update-a-machine). -## Set a restart policy in your Fly.toml -You can also set a default app-level restart policy in your Fly.toml file: +## Set a restart policy in your fly.toml +You can also set a default app-level restart policy in your fly.toml file: ```toml [[restart]] policy = "" @@ -104,4 +104,4 @@ You can also set a default app-level restart policy in your Fly.toml file: processes = ["app"] ``` - A restart policy can be targeted to a specific process group. If a group is not specified, all machines in an app will have the same default restart policy. If needed, you can still apply different policies on individual machines using the Flyctl or Machines API methods above. + A restart policy can be targeted to a specific process group. If a group is not specified, all machines in an app will have the same default restart policy. If needed, you can still apply different policies on individual machines using the flyctl or Machines API methods above.