@@ -277,3 +277,10 @@ To dokku@dokku.example.com:myapp
|
|||||||
! [remote rejected] dokku -> master (pre-receive hook declined)
|
! [remote rejected] dokku -> master (pre-receive hook declined)
|
||||||
error: failed to push some refs to 'dokku@dokku.example.com:myapp'
|
error: failed to push some refs to 'dokku@dokku.example.com:myapp'
|
||||||
````
|
````
|
||||||
|
|
||||||
|
### Configuring docker stop timeout
|
||||||
|
|
||||||
|
[By default](https://docs.docker.com/engine/reference/commandline/stop/), docker will wait 10 seconds from the time the `stop` command is passed to a container before it attempts to kill said container. This timeout can be configured on a per-app basis in dokku by setting the `DOKKU_DOCKER_STOP_TIMEOUT` configuration variable. This timeout applies to normal zero-downtime deployments as well as the `ps:stop` and `apps:destroy` commands.
|
||||||
|
```
|
||||||
|
$ dokku config:set $APP DOKKU_DOCKER_STOP_TIMEOUT=20
|
||||||
|
```
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ dokku_deploy_cmd() {
|
|||||||
for oldid in $oldids; do
|
for oldid in $oldids; do
|
||||||
dokku_log_info2 "$oldid"
|
dokku_log_info2 "$oldid"
|
||||||
done
|
done
|
||||||
|
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||||
|
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||||
(
|
(
|
||||||
exec >/dev/null 2>/dev/null </dev/null
|
exec >/dev/null 2>/dev/null </dev/null
|
||||||
trap '' INT HUP
|
trap '' INT HUP
|
||||||
@@ -151,7 +153,8 @@ dokku_deploy_cmd() {
|
|||||||
# Attempt to stop, if that fails, then force a kill as docker seems
|
# Attempt to stop, if that fails, then force a kill as docker seems
|
||||||
# to not send SIGKILL as the docs would indicate. If that fails, move
|
# to not send SIGKILL as the docs would indicate. If that fails, move
|
||||||
# on to the next.
|
# on to the next.
|
||||||
docker stop "$oldid" \
|
# shellcheck disable=SC2086
|
||||||
|
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|
||||||
|| docker kill "$oldid" \
|
|| docker kill "$oldid" \
|
||||||
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
|
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
apps_create() {
|
apps_create() {
|
||||||
declare desc="verifies app name and creates an app"
|
declare desc="verifies app name and creates an app"
|
||||||
@@ -34,11 +35,14 @@ apps_destroy() {
|
|||||||
|
|
||||||
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
|
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
|
||||||
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
||||||
local cid
|
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||||
|
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||||
|
|
||||||
if [[ -n $DOKKU_APP_CIDS ]]; then
|
if [[ -n $DOKKU_APP_CIDS ]]; then
|
||||||
|
local cid
|
||||||
for cid in $DOKKU_APP_CIDS; do
|
for cid in $DOKKU_APP_CIDS; do
|
||||||
docker stop "$cid" > /dev/null || true
|
# shellcheck disable=SC2086
|
||||||
|
docker stop $DOCKER_STOP_TIME_ARG "$cid" > /dev/null || true
|
||||||
docker rm "$cid" > /dev/null || true
|
docker rm "$cid" > /dev/null || true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
print_dokku_scale_file() {
|
print_dokku_scale_file() {
|
||||||
declare desc="prints contents of DOKKU_SCALE file"
|
declare desc="prints contents of DOKKU_SCALE file"
|
||||||
@@ -107,9 +108,12 @@ ps_stop() {
|
|||||||
! (is_deployed "$APP") && echo "App $APP has not been deployed" && exit 0
|
! (is_deployed "$APP") && echo "App $APP has not been deployed" && exit 0
|
||||||
|
|
||||||
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
||||||
|
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||||
|
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||||
|
|
||||||
echo "Stopping $APP ..."
|
echo "Stopping $APP ..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
docker stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
||||||
plugn trigger post-stop "$APP"
|
plugn trigger post-stop "$APP"
|
||||||
else
|
else
|
||||||
echo "App $APP already stopped"
|
echo "App $APP already stopped"
|
||||||
|
|||||||
Reference in New Issue
Block a user