@@ -6,6 +6,7 @@
|
|||||||
checks <app> Show zero-downtime status
|
checks <app> Show zero-downtime status
|
||||||
checks:disable <app> [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
checks:disable <app> [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||||
checks:enable <app> [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
checks:enable <app> [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||||
|
checks:report [<app>] [<flag>] Displays a checks report for one or more apps
|
||||||
checks:run <app> [process-type(s)] Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
checks:run <app> [process-type(s)] Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||||
checks:skip <app> [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
checks:skip <app> [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||||
```
|
```
|
||||||
@@ -61,6 +62,46 @@ dokku checks:disable node-js-app worker
|
|||||||
DOKKU_CHECKS_SKIPPED: web
|
DOKKU_CHECKS_SKIPPED: web
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Displaying checks reports about an app
|
||||||
|
|
||||||
|
> New as of 0.8.1
|
||||||
|
|
||||||
|
You can get a report about the app's checks status using the `checks:report` command:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dokku checks:report
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
=====> search checks information
|
||||||
|
Checks disabled list: none
|
||||||
|
Checks skipped list: none
|
||||||
|
=====> python-sample
|
||||||
|
Checks disabled list: none
|
||||||
|
Checks skipped list: none
|
||||||
|
=====> ruby-sample
|
||||||
|
Checks disabled list: _all_
|
||||||
|
Checks skipped list: none
|
||||||
|
```
|
||||||
|
|
||||||
|
You can run the command for a specific app also.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dokku checks:report node-js-sample
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
=====> node-js-sample checks information
|
||||||
|
Checks disabled list: none
|
||||||
|
Checks skipped list: none
|
||||||
|
```
|
||||||
|
|
||||||
|
You can pass flags which will output only the value of the specific information you want. For example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dokku checks:report node-js-sample --git-sha
|
||||||
|
```
|
||||||
|
|
||||||
## Customizing Checks
|
## Customizing 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.
|
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.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ case "$1" in
|
|||||||
checks <app>, Show zero-downtime status
|
checks <app>, Show zero-downtime status
|
||||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||||
|
checks:report [<app>] [<flag>], Displays a checks report for one or more apps
|
||||||
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||||
help_content
|
help_content
|
||||||
|
|||||||
75
plugins/checks/subcommands/report
Executable file
75
plugins/checks/subcommands/report
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||||
|
|
||||||
|
fn-checks-disabled-list() {
|
||||||
|
declare APP="$1"
|
||||||
|
|
||||||
|
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED)
|
||||||
|
DOKKU_CHECKS_DISABLED="${DOKKU_CHECKS_DISABLED:-none}"
|
||||||
|
echo "$DOKKU_CHECKS_DISABLED"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn-checks-skipped-list() {
|
||||||
|
declare APP="$1"
|
||||||
|
|
||||||
|
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED)
|
||||||
|
DOKKU_CHECKS_SKIPPED="${DOKKU_CHECKS_SKIPPED:-none}"
|
||||||
|
echo "$DOKKU_CHECKS_SKIPPED"
|
||||||
|
}
|
||||||
|
|
||||||
|
checks_report_single_app() {
|
||||||
|
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
|
||||||
|
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||||
|
INFO_FLAG=""
|
||||||
|
fi
|
||||||
|
verify_app_name "$APP"
|
||||||
|
local flag_map=(
|
||||||
|
"--checks-disabled-list: $(fn-checks-disabled-list "$APP")"
|
||||||
|
"--checks-skipped-list: $(fn-checks-skipped-list "$APP")"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -z "$INFO_FLAG" ]]; then
|
||||||
|
dokku_log_info2 "$APP checks information"
|
||||||
|
for flag in "${flag_map[@]}"; do
|
||||||
|
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||||
|
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
local match=false; local value_exists=false
|
||||||
|
for flag in "${flag_map[@]}"; do
|
||||||
|
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||||
|
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||||
|
value=${flag#*: }
|
||||||
|
size="${#value}"
|
||||||
|
if [[ "$size" -ne 0 ]]; then
|
||||||
|
echo "$value" && match=true && value_exists=true
|
||||||
|
else
|
||||||
|
match=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ "$match" == "true" ]]; then
|
||||||
|
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||||
|
else
|
||||||
|
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checks_report_cmd() {
|
||||||
|
declare desc="shows reports for an app"
|
||||||
|
local cmd="checks:report"
|
||||||
|
local INSTALLED_APPS=$(dokku_apps); local APP
|
||||||
|
|
||||||
|
if [[ -z $2 ]]; then
|
||||||
|
for APP in $INSTALLED_APPS; do
|
||||||
|
checks_report_single_app "$APP" "true"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
checks_report_single_app "$2" "$3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checks_report_cmd "$@"
|
||||||
Reference in New Issue
Block a user