这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions docs/application-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ This is in particular useful, then you want to deploy to root domain, as

# Zero downtime deploy

Following a deploy Dokku's default behaviour is to switch new traffic over to the new container immediately.
Following a deploy, dokku will now wait `DOKKU_DEFAULT_CHECKS_WAIT` seconds (default: `10`), and if the container is still running, then route traffic to the new container.

This can be problematic for applications that take some time to boot up and can lead to `502 Bad Gateway` errors.
This can be problematic for applications whose boot up time can vary and can lead to `502 Bad Gateway` errors.

Dokku provides a way to run a set of checks against the new container, and only switch traffic over if all checks complete successfully.
Dokku provides a way to run a set of more precise checks against the new container, and only switch traffic over if all checks complete successfully.

To specify checks, add a `CHECKS` file to the root of your project directory. This is a text file with one line per check. Empty lines and lines starting with `#` are ignored.

Expand All @@ -137,7 +137,7 @@ A check is a relative URL and may be followed by expected content from the page,
/about Our Amazing Team
```

Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable. This can be overridden in the CHECKS file by setting WAIT=nn.
Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable. This can also be overridden in the CHECKS file by setting WAIT=nn.

Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped.

Expand Down
6 changes: 3 additions & 3 deletions plugins/checks/check-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]];

# simple default check to see if the container stuck around
# for more thorough checks, create a CHECKS file
DOKKU_DEFAULT_WAIT=10
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
sleep $DOKKU_DEFAULT_WAIT
DOKKU_DEFAULT_CHECKS_WAIT="${DOKKU_DEFAULT_CHECKS_WAIT:-10}"
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_CHECKS_WAIT seconds ..."
sleep $DOKKU_DEFAULT_CHECKS_WAIT

! (is_container_running $DOKKU_APP_CONTAINER_ID) && dokku_log_fail "App container failed to start!!"
dokku_log_info1 "Default container check successful!" && exit 0
Expand Down