Merge pull request #5057 from dokku/fix-wait
Ensure we use the correct variable for WAIT
This commit is contained in:
3 files changed
+7
-8
No files matched your search
@@ -17,7 +17,7 @@ main() {
|
|||||||
dokku_log_verbose "Stopping $cid ($PROC_TYPE)"
|
dokku_log_verbose "Stopping $cid ($PROC_TYPE)"
|
||||||
|
|
||||||
# Retire the containers to ensure they get removed
|
# Retire the containers to ensure they get removed
|
||||||
plugn trigger scheduler-register-retired "$APP" "$cid" "$WAIT"
|
plugn trigger scheduler-register-retired "$APP" "$cid" "$DOKKU_WAIT_TO_RETIRE"
|
||||||
|
|
||||||
# Disable the container restart policy
|
# Disable the container restart policy
|
||||||
"$DOCKER_BIN" container update --restart=no "$cid" &>/dev/null || true
|
"$DOCKER_BIN" container update --restart=no "$cid" &>/dev/null || true
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ main() {
|
|||||||
local DOKKU_PORT=""
|
local DOKKU_PORT=""
|
||||||
if [[ "$PROC_TYPE" == "web" ]]; then
|
if [[ "$PROC_TYPE" == "web" ]]; then
|
||||||
ports=($(plugn trigger network-compute-ports "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH" "$CONTAINER_INDEX"))
|
ports=($(plugn trigger network-compute-ports "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH" "$CONTAINER_INDEX"))
|
||||||
local DOKKU_DOCKER_PORT_ARGS=""
|
|
||||||
for p in "${ports[@]}"; do
|
for p in "${ports[@]}"; do
|
||||||
if [[ ! "$p" =~ .*udp.* ]]; then
|
if [[ ! "$p" =~ .*udp.* ]]; then
|
||||||
DOKKU_PORT=${DOKKU_PORT:="$p"}
|
DOKKU_PORT=${DOKKU_PORT:="$p"}
|
||||||
@@ -64,7 +63,7 @@ main() {
|
|||||||
declare desc="wrapper function to kill newly started app container"
|
declare desc="wrapper function to kill newly started app container"
|
||||||
declare CID="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
|
declare CID="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
|
||||||
|
|
||||||
plugn trigger scheduler-register-retired "$APP" "$CID" "$WAIT"
|
plugn trigger scheduler-register-retired "$APP" "$CID" "$DOKKU_WAIT_TO_RETIRE"
|
||||||
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
|
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
|
||||||
echo "${CID} ${PROC_TYPE}.${CONTAINER_INDEX}" >>"${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
|
echo "${CID} ${PROC_TYPE}.${CONTAINER_INDEX}" >>"${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
|
||||||
"$DOCKER_BIN" container inspect "$CID" &>/dev/null && {
|
"$DOCKER_BIN" container inspect "$CID" &>/dev/null && {
|
||||||
@@ -86,8 +85,8 @@ main() {
|
|||||||
|
|
||||||
if [[ -f "$DOKKU_CONTAINER_ID_FILE" ]]; then
|
if [[ -f "$DOKKU_CONTAINER_ID_FILE" ]]; then
|
||||||
# schedule old container for retirement
|
# schedule old container for retirement
|
||||||
dokku_log_verbose "Scheduling old container shutdown in $WAIT seconds ($PROC_TYPE.$CONTAINER_INDEX)"
|
dokku_log_verbose "Scheduling old container shutdown in $DOKKU_WAIT_TO_RETIRE seconds ($PROC_TYPE.$CONTAINER_INDEX)"
|
||||||
plugn trigger scheduler-register-retired "$APP" "$(cat "$DOKKU_CONTAINER_ID_FILE")" "$WAIT"
|
plugn trigger scheduler-register-retired "$APP" "$(cat "$DOKKU_CONTAINER_ID_FILE")" "$DOKKU_WAIT_TO_RETIRE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# now using the new container
|
# now using the new container
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
|||||||
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
export DOKKU_WAIT_TO_RETIRE="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||||
|
|
||||||
local TMP_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
|
local TMP_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
|
||||||
trap "rm -rf '$TMP_FILE' >/dev/null" RETURN INT TERM
|
trap "rm -rf '$TMP_FILE' >/dev/null" RETURN INT TERM
|
||||||
@@ -78,11 +78,11 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
|||||||
# kill the old container
|
# kill the old container
|
||||||
if [[ -n "$oldids" ]]; then
|
if [[ -n "$oldids" ]]; then
|
||||||
# Let the old container finish processing requests, before terminating it
|
# Let the old container finish processing requests, before terminating it
|
||||||
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
|
dokku_log_info1 "Shutting down old containers in $DOKKU_WAIT_TO_RETIRE seconds"
|
||||||
(
|
(
|
||||||
exec >/dev/null 2>/dev/null </dev/null
|
exec >/dev/null 2>/dev/null </dev/null
|
||||||
trap '' INT HUP
|
trap '' INT HUP
|
||||||
sleep "$WAIT"
|
sleep "$DOKKU_WAIT_TO_RETIRE"
|
||||||
for oldid in $oldids; do
|
for oldid in $oldids; do
|
||||||
if ! docker container inspect "$oldid" >/dev/null 2>&1; then
|
if ! docker container inspect "$oldid" >/dev/null 2>&1; then
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in new issue
Block a user