Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update machine restart policy docs #1911

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

- **`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

Expand Down Expand Up @@ -95,8 +95,8 @@

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

Check failure on line 98 in machines/guides-examples/machine-restart-policy.html.markerb

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fly.toml' instead of 'Fly.toml'. Raw Output: {"message": "[Vale.Terms] Use 'fly.toml' instead of 'Fly.toml'.", "location": {"path": "machines/guides-examples/machine-restart-policy.html.markerb", "range": {"start": {"line": 98, "column": 33}}}, "severity": "ERROR"}
You can also set a default app-level restart policy in your Fly.toml file:

Check failure on line 99 in machines/guides-examples/machine-restart-policy.html.markerb

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'fly.toml' instead of 'Fly.toml'. Raw Output: {"message": "[Vale.Terms] Use 'fly.toml' instead of 'Fly.toml'.", "location": {"path": "machines/guides-examples/machine-restart-policy.html.markerb", "range": {"start": {"line": 99, "column": 61}}}, "severity": "ERROR"}
```toml
[[restart]]
policy = "<never | always | on-failure>"
Expand All @@ -104,4 +104,4 @@
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.

Check warning on line 107 in machines/guides-examples/machine-restart-policy.html.markerb

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Fly.Machine] Use 'Machines' instead of 'machines'. Raw Output: {"message": "[Fly.Machine] Use 'Machines' instead of 'machines'.", "location": {"path": "machines/guides-examples/machine-restart-policy.html.markerb", "range": {"start": {"line": 107, "column": 96}}}, "severity": "INFO"}

Check warning on line 107 in machines/guides-examples/machine-restart-policy.html.markerb

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Fly.Machine] Use 'Machines' instead of 'machines'. Raw Output: {"message": "[Fly.Machine] Use 'Machines' instead of 'machines'.", "location": {"path": "machines/guides-examples/machine-restart-policy.html.markerb", "range": {"start": {"line": 107, "column": 222}}}, "severity": "INFO"}

Check failure on line 107 in machines/guides-examples/machine-restart-policy.html.markerb

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'flyctl' instead of 'Flyctl'. Raw Output: {"message": "[Vale.Terms] Use 'flyctl' instead of 'Flyctl'.", "location": {"path": "machines/guides-examples/machine-restart-policy.html.markerb", "range": {"start": {"line": 107, "column": 242}}}, "severity": "ERROR"}
Loading