|
| 1 | +--- |
| 2 | +pcx_content_type: reference |
| 3 | +title: Rollouts |
| 4 | +sidebar: |
| 5 | + order: 2 |
| 6 | +--- |
| 7 | + |
| 8 | +import { WranglerConfig } from "~/components"; |
| 9 | + |
| 10 | +## How rollouts work |
| 11 | +When you run `wrangler deploy`, the Worker code is updated immediately and Container |
| 12 | +instances are updated using a rolling deploy strategy. The default rollout configuration is two steps, |
| 13 | +where the first step updates 10% of the instances, and the second step updates the remaining 90%. |
| 14 | +This can be configured in your Wrangler config file using the [`rollout_step_percentage`](/workers/wrangler/configuration#containers) property. |
| 15 | + |
| 16 | +When deploying a change, you can also configure a [`rollout_active_grace_period`](/workers/wrangler/configuration#containers), which is the minimum |
| 17 | +number of seconds to wait before an active container instance becomes eligible for updating during a rollout. |
| 18 | +At that point, the container will be sent at `SIGTERM`, and still has 15 minutes to shut down gracefully. |
| 19 | +If the instance does not stop within 15 minutes, it is forcefully stopped with a `SIGKILL` signal. |
| 20 | +If you have cleanup that must occur before a Container instance is stopped, you should do it during this 15 minute period. |
| 21 | + |
| 22 | +Once stopped, the instance is replaced with a new instance running the updated code. Requests may hang while the container is starting up again. |
| 23 | + |
| 24 | +Here is an example configuration that sets a 5 minute grace period and a two step rollout where the first step updates 10% of instances and the second step updates 100% of instances: |
| 25 | +<WranglerConfig> |
| 26 | + |
| 27 | +```toml |
| 28 | +[[containers]] |
| 29 | +max_instances = 10 |
| 30 | +class_name = "MyContainer" |
| 31 | +image = "./Dockerfile" |
| 32 | +rollout_active_grace_period = 300 |
| 33 | +rollout_step_percentage = [10, 100] |
| 34 | + |
| 35 | +[[durable_objects.bindings]] |
| 36 | +name = "MY_CONTAINER" |
| 37 | +class_name = "MyContainer" |
| 38 | + |
| 39 | +[[migrations]] |
| 40 | +tag = "v1" |
| 41 | +new_sqlite_classes = ["MyContainer"] |
| 42 | +``` |
| 43 | +</WranglerConfig> |
0 commit comments