From ecc40c7ea3edcb526e77a93cf164bd7c72fb924f Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 10:36:39 -0600 Subject: [PATCH 01/22] Checks doc: example for setting DOKKU_DEFAULT_CHECKS_WAIT for a single app --- docs/checks-examples.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index ab675965c..93e711de3 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -6,10 +6,11 @@ checks:disable checks:enable Enable zero-downtime checks ``` -Following a deploy, dokku will now wait `10` seconds before routing traffic to the new container. If the container is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value using the following command: +Following a deploy, dokku will now wait `10` seconds before routing traffic to the new container. If the container is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis: ```shell dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 +dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=30 ``` If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. From ec0306278e66ff516ff1056a513f79e69e9aebb9 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 10:37:16 -0600 Subject: [PATCH 02/22] Checks doc: standardize use of instead of APP for commands --- docs/checks-examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 93e711de3..0cf4b1fa5 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -46,7 +46,7 @@ dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 You can also choose to skip checks completely on a per-application basis: ```shell -dokku checks:disable APP +dokku checks:disable ``` ## Checks Examples From 1848ea5d15f6aef33100b8350c67c4e407045f72 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 10:40:31 -0600 Subject: [PATCH 03/22] Checks doc: mention DOKKU_WAIT_TO_RETIRE at the top, before we get into custom checks and config --- docs/checks-examples.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 0cf4b1fa5..ec65ce599 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -13,6 +13,14 @@ dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=30 ``` +Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. This value is also configurable globally: + +```shell +dokku config:set --global DOKKU_WAIT_TO_RETIRE=120 +``` + +> Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. + If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. 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. @@ -29,14 +37,6 @@ Dokku will wait `5` seconds before running the checks to give the server time to dokku config:set --global DOKKU_CHECKS_WAIT=15 ``` -Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. This value is also configurable globally: - -```shell -dokku config:set --global DOKKU_WAIT_TO_RETIRE=120 -``` - -> Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. - Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: ```shell From aabe456aa6644e954b8ee9583c8dd536f1454b21 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 10:41:42 -0600 Subject: [PATCH 04/22] Checks doc: example for setting DOKKU_WAIT_TO_RETIRE for a single app --- docs/checks-examples.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index ec65ce599..6c65bc87c 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -13,10 +13,11 @@ dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=30 ``` -Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. This value is also configurable globally: +Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. You can modify this value globally or on a per-application basis: ```shell dokku config:set --global DOKKU_WAIT_TO_RETIRE=120 +dokku config:set DOKKU_WAIT_TO_RETIRE=120 ``` > Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. From 80d2bf9e8f842421289820162e751dc07d6aad04 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 10:42:54 -0600 Subject: [PATCH 05/22] Checks doc: add a header before getting into the custom checks explanation --- docs/checks-examples.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 6c65bc87c..510cb100e 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -22,6 +22,8 @@ dokku config:set DOKKU_WAIT_TO_RETIRE=120 > Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. +## Checks + If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. 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. From fa018d3e8c6c1533fbee8d7d2b60184f6c24e089 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:00:04 -0600 Subject: [PATCH 06/22] Checks doc: mention dokku checks disable at the top, before we get into the custom checks explanation --- docs/checks-examples.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 510cb100e..0ecee812a 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -13,6 +13,12 @@ dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=30 ``` +You can also choose to skip checks completely on a per-application basis: + +```shell +dokku checks:disable +``` + Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. You can modify this value globally or on a per-application basis: ```shell @@ -46,12 +52,6 @@ Dokku will retry the checks `5` times until the checks are successful. If all 5 dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 ``` -You can also choose to skip checks completely on a per-application basis: - -```shell -dokku checks:disable -``` - ## Checks Examples The CHECKS file may contain empty lines, comments (lines starting with #), From 85dab3b6efedc5eb5d5a2cf827ffeaccaeedfeaa Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:13:30 -0600 Subject: [PATCH 07/22] Checks doc: move checks examples up so we're explaining the options in one place --- docs/checks-examples.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 0ecee812a..09e2282f7 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -40,20 +40,6 @@ A check is a relative URL and may be followed by expected content from the page, /about Our Amazing Team ``` -Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: - -```shell -dokku config:set --global DOKKU_CHECKS_WAIT=15 -``` - -Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: - -```shell -dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 -``` - -## Checks Examples - The CHECKS file may contain empty lines, comments (lines starting with #), settings (NAME=VALUE) and check instructions. @@ -83,6 +69,20 @@ https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` +Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: + +```shell +dokku config:set --global DOKKU_CHECKS_WAIT=15 +``` + +Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: + +```shell +dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 +``` + +## Checks Examples + The default behavior is to wait for 5 seconds before running the first check, and timeout each check to 30 seconds. By default, checks will be attempted 5 times. (Retried 4 times) From aeaf12a7a2e99aa2b03d91dd7bf41c4cf52724e6 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:15:22 -0600 Subject: [PATCH 08/22] Checks doc: move settings explanation into its own section --- docs/checks-examples.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 09e2282f7..d27917245 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -69,6 +69,8 @@ https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` +## Checks Settings + Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: ```shell @@ -81,8 +83,6 @@ Dokku will retry the checks `5` times until the checks are successful. If all 5 dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 ``` -## Checks Examples - The default behavior is to wait for 5 seconds before running the first check, and timeout each check to 30 seconds. By default, checks will be attempted 5 times. (Retried 4 times) From 405c23f2bdf511b4fd2aa1e7085f9d9879014bf5 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:22:39 -0600 Subject: [PATCH 09/22] Checks doc: move redundant content to the same spot for now, add a bit of content to divide the single check and multi check examples --- docs/checks-examples.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index d27917245..234a2de13 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -34,17 +34,19 @@ If your application needs a longer period to boot up - perhaps to load data into 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. +The CHECKS file may contain empty lines, comments (lines starting with #), +settings (NAME=VALUE) and check instructions. + +The format of a check instruction is a path, optionally followed by the +expected content. For example: + A check is a relative URL and may be followed by expected content from the page, for example: ``` /about Our Amazing Team ``` -The CHECKS file may contain empty lines, comments (lines starting with #), -settings (NAME=VALUE) and check instructions. - -The format of a check instruction is a path, optionally followed by the -expected content. For example: +The `CHECKS` file can contain multiple checks, for example: ``` / My Amazing App From 78bb76249e451aba3911b32e91814cc95e7c2030 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:24:59 -0600 Subject: [PATCH 10/22] Checks doc: combine redundant content into a single paragraph --- docs/checks-examples.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 234a2de13..4ce39e0e6 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -32,15 +32,7 @@ dokku config:set DOKKU_WAIT_TO_RETIRE=120 If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. -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. - -The CHECKS file may contain empty lines, comments (lines starting with #), -settings (NAME=VALUE) and check instructions. - -The format of a check instruction is a path, optionally followed by the -expected content. For example: - -A check is a relative URL and may be followed by expected content from the page, for example: +To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file may contain empty lines, comments (lines starting with #), settings (NAME=VALUE), and check instructions. The format of a check instruction is a path or relative URL, optionally followed by the expected content. For example: ``` /about Our Amazing Team From f5ab02ac209098048b55e49ccaafbc8f138667eb Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:27:12 -0600 Subject: [PATCH 11/22] Checks doc: remove linebreak to match the formatting used elsewhere in this doc, remove stray empty line --- docs/checks-examples.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 4ce39e0e6..aebe9822f 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -47,8 +47,7 @@ The `CHECKS` file can contain multiple checks, for example: /images/logo.png ``` -To check an application that supports multiple hostnames, use relative URLs -that include the hostname, for example: +To check an application that supports multiple hostnames, use relative URLs that include the hostname, for example: ``` //admin.example.com Admin Dashboard @@ -57,7 +56,6 @@ that include the hostname, for example: You can also specify the protocol to explicitly check HTTPS requests. - ``` https://admin.example.com Admin Dashboard https://static.example.com/logo.png From 93e8078a939cce7ae5350ab79e2a634f4f44b2c1 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:29:40 -0600 Subject: [PATCH 12/22] Checks doc: break CHECKS file explanation into bullet points for easier reading --- docs/checks-examples.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index aebe9822f..309d59543 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -32,7 +32,14 @@ dokku config:set DOKKU_WAIT_TO_RETIRE=120 If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. -To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file may contain empty lines, comments (lines starting with #), settings (NAME=VALUE), and check instructions. The format of a check instruction is a path or relative URL, optionally followed by the expected content. For example: +To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain: + + * empty lines + * comments (lines starting with #) + * settings (NAME=VALUE) + * check instructions + +The format of a check instruction is a path or relative URL, optionally followed by the expected content. For example: ``` /about Our Amazing Team From da1d3622037b9297fce4f0c3b4fc44f569cdda80 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:30:52 -0600 Subject: [PATCH 13/22] Checks doc: break checks instructions and checks settings into sub sections --- docs/checks-examples.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 309d59543..65022bf1b 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -39,6 +39,8 @@ To specify checks, add a `CHECKS` file to the root of your project directory. Th * settings (NAME=VALUE) * check instructions +### Checks Instructions + The format of a check instruction is a path or relative URL, optionally followed by the expected content. For example: ``` @@ -68,7 +70,7 @@ https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` -## Checks Settings +### Checks Settings Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: From b92fe463876fab4635b55e7d5db5cceb96cfc6de Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 11:31:56 -0600 Subject: [PATCH 14/22] Checks doc: move redundant content to the same spot for now --- docs/checks-examples.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 65022bf1b..de12c6eac 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -72,18 +72,6 @@ https://static.example.com/logo.png ### Checks Settings -Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: - -```shell -dokku config:set --global DOKKU_CHECKS_WAIT=15 -``` - -Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: - -```shell -dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 -``` - The default behavior is to wait for 5 seconds before running the first check, and timeout each check to 30 seconds. By default, checks will be attempted 5 times. (Retried 4 times) @@ -99,6 +87,18 @@ ATTEMPTS=10 # attempt checks 10 times / My Amazing App ``` +Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: + +```shell +dokku config:set --global DOKKU_CHECKS_WAIT=15 +``` + +Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: + +```shell +dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 +``` + ## Example: Successful Rails Deployment In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds. From 9de5965dd195ba101eb4e4cddfacc6aa4ac8c045 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:22:59 -0600 Subject: [PATCH 15/22] Checks doc: combine and clean up redundant checks settings content --- docs/checks-examples.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index de12c6eac..5f41d1a5a 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -72,30 +72,22 @@ https://static.example.com/logo.png ### Checks Settings -The default behavior is to wait for 5 seconds before running the first check, and timeout each check to 30 seconds. +The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic. -By default, checks will be attempted 5 times. (Retried 4 times) - -You can change these by setting `WAIT`, `TIMEOUT` and `ATTEMPTS` to different values, for -example: +You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file. For example: ``` WAIT=30 # Wait 1/2 minute TIMEOUT=60 # Timeout after a minute -ATTEMPTS=10 # attempt checks 10 times +ATTEMPTS=10 # Attempt checks 10 times / My Amazing App ``` -Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation: +You may also override the default `WAIT` and `ATTEMPTS` variables for the global dokku installation: ```shell dokku config:set --global DOKKU_CHECKS_WAIT=15 -``` - -Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally: - -```shell dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 ``` From 7d73f61cd3ac188662a7f1cf3857c436a5f0a342 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:25:12 -0600 Subject: [PATCH 16/22] Checks doc: add a section about disabling the default wait time when running multiple processes re #1964 --- docs/checks-examples.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 5f41d1a5a..244afa06c 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -91,6 +91,12 @@ dokku config:set --global DOKKU_CHECKS_WAIT=15 dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 ``` +If your application runs multiple processes (a background worker configured in a `Procfile`, for example) you may want to disable the default check wait time for that application to avoid the `10` second default delay per process: + +```shell +dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 +``` + ## Example: Successful Rails Deployment In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds. From 7d60e160ab9ae638c3bc70e05c39344c70e97e87 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:25:56 -0600 Subject: [PATCH 17/22] Checks doc: fix typos --- docs/checks-examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 244afa06c..1dbf485cb 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -99,7 +99,7 @@ dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 ## Example: Successful Rails Deployment -In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds. +In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds. ### CHECKS file From 2df9bbeb83aac2577bee87d27b3cb72e0f9665d1 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:28:13 -0600 Subject: [PATCH 18/22] Checks doc: clean up Rails example deployments a bit, add a note about WAIT, and change to from 5 to 10 since the default is 5 so using that variable wouldn't make sense --- docs/checks-examples.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 1dbf485cb..6b673e46d 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -99,12 +99,12 @@ dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 ## Example: Successful Rails Deployment -In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds. +In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `WAIT` is set to `10` because our application takes a while to boot up. `ATTEMPTS` is set to `6`, but the third attempt succeeds. ### CHECKS file ```` -WAIT=5 +WAIT=10 ATTEMPTS=6 /check.txt simple_check ```` @@ -132,19 +132,19 @@ git push dokku master -----> Releasing myapp... -----> Deploying myapp... -----> Running pre-flight checks ------> Attempt 1/6 Waiting for 5 seconds ... +-----> Attempt 1/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/check.txt => "simple_check" ! curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused ! Check attempt 1/6 failed. ------> Attempt 2/6 Waiting for 5 seconds ... +-----> Attempt 2/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/check.txt => "simple_check" ! curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused ! Check attempt 2/6 failed. ------> Attempt 3/6 Waiting for 5 seconds ... +-----> Attempt 3/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/check.txt => "simple_check" -----> All checks successful! @@ -168,6 +168,7 @@ curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused ```` ## Example: Failing Rails Deployment + In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure. Once the attempts have been exceeded, the deployment fails and we see the container output, which shows the Postgres connection errors. @@ -175,7 +176,7 @@ Once the attempts have been exceeded, the deployment fails and we see the contai ### CHECKS file ```` -WAIT=5 +WAIT=10 ATTEMPTS=6 / ```` @@ -203,37 +204,37 @@ Procfile declares types -> web Releasing myapp... Deploying myapp... Running pre-flight checks ------> Attempt 1/6 Waiting for 5 seconds ... +-----> Attempt 1/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused ! Check attempt 1/6 failed. ------> Attempt 2/6 Waiting for 5 seconds ... +-----> Attempt 2/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused ! Check attempt 2/6 failed. ------> Attempt 3/6 Waiting for 5 seconds ... +-----> Attempt 3/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! curl: (22) The requested URL returned error: 500 Internal Server Error ! Check attempt 3/6 failed. ------> Attempt 4/6 Waiting for 5 seconds ... +-----> Attempt 4/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! curl: (22) The requested URL returned error: 500 Internal Server Error ! Check attempt 4/6 failed. ------> Attempt 5/6 Waiting for 5 seconds ... +-----> Attempt 5/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! curl: (22) The requested URL returned error: 500 Internal Server Error ! Check attempt 5/6 failed. ------> Attempt 6/6 Waiting for 5 seconds ... +-----> Attempt 6/6 Waiting for 10 seconds ... CHECKS expected result: http://localhost/ => "" ! From b8c264f1733974216d2b41bf60dfc2118810c5d6 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:32:15 -0600 Subject: [PATCH 19/22] Checks doc: add an example for the simple check for the Rails deployment example --- docs/checks-examples.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 6b673e46d..8897e9262 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -109,7 +109,11 @@ ATTEMPTS=6 /check.txt simple_check ```` -> check.txt is a text file returning the string 'simple_check' +For this check to work, we've added a line to `config/routes.rb` that simply returns a string: + +```` +get '/check.txt', to: proc {[200, {}, ['simple_check']]} +```` ### Deploy Output From 2acd2c294a0678ee3ffccf0d7eb14a46bb144855 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:46:03 -0600 Subject: [PATCH 20/22] Checks doc: minor copy edits to use a consistent voice and sentence structure --- docs/checks-examples.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 8897e9262..1cc68f8b4 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -6,7 +6,7 @@ checks:disable checks:enable Enable zero-downtime checks ``` -Following a deploy, dokku will now wait `10` seconds before routing traffic to the new container. If the container is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis: +Following a deploy, dokku will wait `10` seconds before routing traffic to the new container to give your application time to boot up. If the application is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis: ```shell dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 @@ -34,20 +34,20 @@ If your application needs a longer period to boot up - perhaps to load data into To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain: - * empty lines - * comments (lines starting with #) - * settings (NAME=VALUE) - * check instructions + * Check instructions + * Settings (NAME=VALUE) + * Comments (lines starting with #) + * Empty lines -### Checks Instructions +### Check Instructions -The format of a check instruction is a path or relative URL, optionally followed by the expected content. For example: +The format of a check instruction is a path or relative URL, optionally followed by the expected content: ``` /about Our Amazing Team ``` -The `CHECKS` file can contain multiple checks, for example: +The `CHECKS` file can contain multiple checks: ``` / My Amazing App @@ -56,25 +56,25 @@ The `CHECKS` file can contain multiple checks, for example: /images/logo.png ``` -To check an application that supports multiple hostnames, use relative URLs that include the hostname, for example: +To check an application that supports multiple hostnames, use relative URLs that include the hostname: ``` //admin.example.com Admin Dashboard //static.example.com/logo.png ``` -You can also specify the protocol to explicitly check HTTPS requests. +You can also specify the protocol to explicitly check HTTPS requests: ``` https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` -### Checks Settings +### Check Settings The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic. -You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file. For example: +You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file: ``` WAIT=30 # Wait 1/2 minute @@ -84,14 +84,14 @@ ATTEMPTS=10 # Attempt checks 10 times / My Amazing App ``` -You may also override the default `WAIT` and `ATTEMPTS` variables for the global dokku installation: +You can also override the default `WAIT` and `ATTEMPTS` variables for the global dokku installation: ```shell -dokku config:set --global DOKKU_CHECKS_WAIT=15 -dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2 +dokku config:set --global DOKKU_CHECKS_WAIT=30 +dokku config:set --global DOKKU_CHECKS_ATTEMPTS=10 ``` -If your application runs multiple processes (a background worker configured in a `Procfile`, for example) you may want to disable the default check wait time for that application to avoid the `10` second default delay per process: +If your application runs multiple processes (a background worker configured in your `Procfile`, for example) and you have checks to ensure that your web application has booted up, you may want to disable the default check wait time for that application to avoid the `10` second wait per non-web process: ```shell dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 @@ -99,7 +99,7 @@ dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 ## Example: Successful Rails Deployment -In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `WAIT` is set to `10` because our application takes a while to boot up. `ATTEMPTS` is set to `6`, but the third attempt succeeds. +In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `WAIT` is set to `10` because our application takes a while to boot up. `ATTEMPTS` is set to `6`, but the third attempt succeeds. ### CHECKS file @@ -173,7 +173,7 @@ curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused ## Example: Failing Rails Deployment -In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure. +In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure. Once the attempts have been exceeded, the deployment fails and we see the container output, which shows the Postgres connection errors. From 6a25c8b6758f9bfd56bf815c41348a0ee028dede Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:47:14 -0600 Subject: [PATCH 21/22] Checks doc: mention the ability to globally configure DOKKU_CHECKS_TIMEOUT (it looks like you can do this, but I'm not 100% sure) --- docs/checks-examples.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 1cc68f8b4..0694d8b22 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -84,10 +84,11 @@ ATTEMPTS=10 # Attempt checks 10 times / My Amazing App ``` -You can also override the default `WAIT` and `ATTEMPTS` variables for the global dokku installation: +You can also override the default `WAIT`, `TIMEOUT`, and `ATTEMPTS` variables for the global dokku installation: ```shell dokku config:set --global DOKKU_CHECKS_WAIT=30 +dokku config:set --global DOKKU_CHECKS_TIMEOUT=60 dokku config:set --global DOKKU_CHECKS_ATTEMPTS=10 ``` From bd5a7dea3a45c45a5e3b6f71fecb859c1aab31b5 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 3 Mar 2016 12:50:22 -0600 Subject: [PATCH 22/22] Checks doc: standardize spacing on check instruction example lines --- docs/checks-examples.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 0694d8b22..bb95f8513 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -44,7 +44,7 @@ To specify checks, add a `CHECKS` file to the root of your project directory. Th The format of a check instruction is a path or relative URL, optionally followed by the expected content: ``` -/about Our Amazing Team +/about Our Amazing Team ``` The `CHECKS` file can contain multiple checks: @@ -59,14 +59,14 @@ The `CHECKS` file can contain multiple checks: To check an application that supports multiple hostnames, use relative URLs that include the hostname: ``` -//admin.example.com Admin Dashboard +//admin.example.com Admin Dashboard //static.example.com/logo.png ``` You can also specify the protocol to explicitly check HTTPS requests: ``` -https://admin.example.com Admin Dashboard +https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` @@ -81,7 +81,7 @@ WAIT=30 # Wait 1/2 minute TIMEOUT=60 # Timeout after a minute ATTEMPTS=10 # Attempt checks 10 times -/ My Amazing App +/ My Amazing App ``` You can also override the default `WAIT`, `TIMEOUT`, and `ATTEMPTS` variables for the global dokku installation: @@ -107,7 +107,7 @@ In this example, a Rails application is successfully deployed to dokku. The init ```` WAIT=10 ATTEMPTS=6 -/check.txt simple_check +/check.txt simple_check ```` For this check to work, we've added a line to `config/routes.rb` that simply returns a string: