Skip to content

Commit

Permalink
edits re autostop
Browse files Browse the repository at this point in the history
  • Loading branch information
andie787 committed Aug 16, 2024
1 parent 364b1e0 commit 18e9203
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
11 changes: 7 additions & 4 deletions blueprints/autoscale-machines.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,32 @@ Machines during the period of low traffic.
This blueprint will guide you through the process of configuring the
[`fly-autoscaler` app](/docs/launch/autoscale-by-metric/) in conjunction with
[Fly Proxy autostop/autostart](/docs/launch/autostop-autostart/) to
always keep a fixed number of stopped Machines ready to be quickly started
always keep a fixed number of Machines ready to be quickly started
by Fly Proxy.

## Configuring automatic start and stop

First, we will configure the app to allow Fly Proxy to automatically start and
stop Machines based on traffic demand. The auto start and stop settings apply
stop or suspend Machines based on traffic demand. The auto start and stop settings apply
per service, so you set them within the `[[services]]` or `[http_service]`
sections of `fly.toml`:

```toml
...
[[services]]
...
auto_stop_machines = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
...
```

With these settings Fly Proxy will start an additional Machine if all the
running Machines are above their concurrency `soft_limit` and stop running
Machines when the traffic decreases. In the next section we will configure
Machines when the traffic decreases. You can set Machines to `"suspend"` rather than
`"stop"`, for even faster start-up, but with some [limitations on the type of Machine](https://community.fly.io/t/new-feature-in-preview-suspend-resume-for-machines/20672#current-limitations-and-caveats-8).

In the next section we will configure
and deploy `fly-autoscaler` to ensure that the app always has a spare stopped
Machine for Fly Proxy to start.

Expand Down
12 changes: 6 additions & 6 deletions blueprints/autostart-internal-apps.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You have a private, or internal, app that communicates only with other apps on y

To use Fly Proxy autostop/autostart you need to configure services in `fly.toml`, like you would for a public app. But instead of using a public Anycast address, you assign a Flycast address to expose those services only on your private network.

This blueprint focuses on using autostart and autostop to control Machines based on incoming requests. But when you use Flycast for private apps you also get other Fly Proxy features like geographically aware load balancing.
This blueprint focuses on using autostop/autostart to control Machines based on incoming requests. But when you use Flycast for private apps you also get other [Fly Proxy features](/docs/reference/fly-proxy/) like geographically aware load balancing.

Learn more about [Flycast](/docs/networking/flycast/).

Expand Down Expand Up @@ -49,9 +49,9 @@ v6 fdaa:2:45b:0:1::11 private global Mar 16 2024 18:20
v4 66.241.124.11 public (shared) Jan 1 0001 00:00
```

This example app has public IPv4 and IPv6 addresses. These are the addresses automatically assigned to an app on first deploy.
This example app has public IPv4 and IPv6 addresses. These public addresses are automatically assigned to an app with services on the first deploy.

Copy the public IP addresses and run the `release` command to remove them from your app:
Copy the public IP addresses and run the `fly ips release` command to remove them from your app:

```
fly ips release <ip address> <ip address> ...
Expand Down Expand Up @@ -82,7 +82,7 @@ Here's an example `fly.toml` snippet:
# must be false - Flycast is http-only
force_https = false
# Fly Proxy stops Machines based on traffic
auto_stop_machines = true
auto_stop_machines = "stop"
# Fly Proxy starts Machines based on traffic
auto_start_machines = true
# Number of Machines to keep running in primary region
Expand All @@ -94,7 +94,7 @@ Here's an example `fly.toml` snippet:
```

<div class="important icon">
**Important:** Set `force_https = false` since Flycast only works over HTTP. HTTPS isn't necessary because all your private network traffic goes through encrypted WireGuard tunnels.
**Important:** Set `force_https = false`; Flycast only works over HTTP. HTTPS isn't necessary because all your private network traffic goes through encrypted WireGuard tunnels.
</div>

Learn more about [Fly Launch configuration](/docs/reference/configuration/) and [Fly Proxy autostop/autostart](/docs/launch/autostop-autostart/).
Expand All @@ -107,7 +107,7 @@ To be reachable by Fly Proxy, an app needs to listen on `0.0.0.0` and bind to th

Run `fly deploy` for the configuration changes to take effect.

Other apps in your organization can now reach your private app using the [Flycast](/docs/networking/flycast/) IP address or `<appname>.flycast`.
Other apps in your organization can now reach your private app using the [Flycast](/docs/networking/flycast/) IP address or the `<appname>.flycast` domain.

## Read more

Expand Down
4 changes: 2 additions & 2 deletions blueprints/resilient-apps-multiple-machines.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ If your app doesn't already have multiple Machines with autostop/autostart confi

#### 1. Set up autostop/autostart

Use [Fly Proxy autostop/autostart](/docs/launch/autostop-autostart/#apps-that-shut-down-when-idle) to automatically stop and start Machines based on traffic. Keep one or more Machines running in your primary region if you want to. Example from `fly.toml` config:
Use [Fly Proxy autostop/autostart](/docs/launch/autostop-autostart/) to automatically stop and start Machines based on traffic. Keep one or more Machines running in your primary region if you want to. Example from `fly.toml` config:

```toml
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true # Fly Proxy stops Machines based on traffic
auto_stop_machines = "stop" # Fly Proxy stops Machines based on traffic
auto_start_machines = true # Fly Proxy starts Machines based on traffic
min_machines_running = 0 # No. of Machines to keep running in primary region
[http_service.concurrency]
Expand Down
8 changes: 5 additions & 3 deletions launch/autostop-autostart.html.markerb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ The autostop/autostart settings are part of each service in an app's `fly.toml`

Autostop/autostart settings:

* **`auto_stop_machines`:** The action, if any, that Fly Proxy should take when the app is idle for several minutes. Options are `"off"`, `"stop"`, or `"suspend"`. If `"off"`, Fly Proxy will never stop Machines. If `"stop"`, Fly Proxy stops Machines when the app has excess capacity. If `"suspend"`, Fly Proxy suspends Machines (if possible) when the app has excess capacity. Starting a Machine from a `suspended` state is faster than starting a Machine from a `stopped` state, but there are [some caveats](https://community.fly.io/t/autosuspend-is-here-machine-suspension-is-enabled-everywhere/20942) that you should know about.
* **`auto_start_machines`:** Whether Fly Proxy should automatically start Machines based on requests and capacity.
* **`min_machines_running`:** The minimum number of Machines to keep running in the primary region when `auto_stop_machines` is set to `"stop"` or `"suspend"`.
- **`auto_stop_machines`:** The action, if any, that Fly Proxy should take when the app is idle for several minutes.
- The options are `"off"` (equivalent to `false`), `"stop"` (equivalent to `true`), or `"suspend"`.
- If `"off"`, Fly Proxy will never stop Machines. If `"stop"`, Fly Proxy stops Machines when the app has excess capacity. If `"suspend"`, Fly Proxy suspends Machines (if possible) when the app has excess capacity. Starting a Machine from a `suspended` state is faster than starting a Machine from a `stopped` state, but there are [some caveats](https://community.fly.io/t/autosuspend-is-here-machine-suspension-is-enabled-everywhere/20942) that you should know about.
- **`auto_start_machines`:** Whether Fly Proxy should automatically start Machines based on requests and capacity.
- **`min_machines_running`:** The minimum number of Machines to keep running in the primary region when `auto_stop_machines` is set to `"stop"` or `"suspend"`.

Example configuration:

Expand Down
2 changes: 1 addition & 1 deletion reference/fly-proxy-autostop-autostart.html.markerb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ nav: firecracker

With Fly Proxy autostop/autostart, you can scale your app for peak loads and run those Machines only when needed to save on resource costs; you [don't pay for Machine CPU and RAM](/docs/about/pricing/#stopped-fly-machines) when they're in a `stopped` or `suspended` state. Fly Proxy automatically stops (or suspends) and starts existing Machines based on incoming requests to your app, and you have the option to keep a minimum number of machines running at all times in your primary region.

Autostop/autostart works for Fly Apps with a service configured in the `fly.toml` file, which generally covers publicly available apps that accept requests from the internet. But you can also use Fly Proxy autostart/autostart for private apps by setting up services and using a Flycast private IPv6 address. See [Flycast - Private Fly Proxy Services](/docs/networking/flycast/) and [Autostop/autostart private apps](/docs/blueprints/autostart-internal-apps/).
Autostop/autostart works for Fly Apps with a service configured in the `fly.toml` file, which generally covers publicly available apps that accept requests from the internet. But you can also use autostart/autostart for private apps by setting up services and using a Flycast private IPv6 address. See [Flycast - Private Fly Proxy Services](/docs/networking/flycast/) and [Autostop/autostart private apps](/docs/blueprints/autostart-internal-apps/).

For apps that [shut down automatically when idle](/docs/launch/autostop-autostart/#apps-that-shut-down-when-idle) and don't need autostop, the Fly Proxy can still restart your app's Machines when there's traffic.

Expand Down

0 comments on commit 18e9203

Please sign in to comment.