Skip to content

Commit

Permalink
Zero downtime with cordfile
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Aug 31, 2023
1 parent 99798a5 commit c45a930
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion _docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ volumes:

Directories act in a similar way to volumes except it will create a corresponding directory on the host before mounting the volume:

e.g.
e.g.

```yaml
service: kamal-demo
Expand Down Expand Up @@ -688,6 +688,28 @@ The healthcheck allows for an optional `max_attempts` setting, which will attemp

The HTTP health checks assume that the `curl` command is available inside the container. If that's not the case, use the healthcheck's `cmd` option to specify an alternative check that the container supports.

#### Zero-downtime deploy with cord files

We need to stop Traefik from sending requests to old containers before stopping them, otherwise we could get errors. We do this with a cord file.

The file is created in a directory on the host and the directory is mounted into the container. The healthcheck is modified to check for the file.

When we want to shut down the container we first delete the cord file, then wait for container to become unhealthy.

By default the directory is mounted to `/tmp/kamal-cord`. You can change the location with

```
healthcheck:
cord: /var/run/kamal-cord
```
Or disable the cord (and lose the zero-downtime guarantee) with:
```
healthcheck:
cord: false
```
## Using rolling deployments
When deploying to large numbers of hosts, you might prefer not to restart your services on every host at the same time.
Expand Down

0 comments on commit c45a930

Please sign in to comment.