refactor: move container stopping into new scheduler-stop plugin trigger
This commit is contained in:
1 parent
da1ea2dda8
commit
8474c72a10
2 files changed
+28
-12
No files matched your search
+4
-12
@@ -108,21 +108,13 @@ ps_start() {
|
|||||||
ps_stop() {
|
ps_stop() {
|
||||||
declare desc="stops app"
|
declare desc="stops app"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
|
|
||||||
|
|
||||||
! (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
|
echo "Stopping $APP ..."
|
||||||
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
|
||||||
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP"
|
||||||
|
plugn trigger post-stop "$APP"
|
||||||
echo "Stopping $APP ..."
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
docker stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
|
||||||
plugn trigger post-stop "$APP"
|
|
||||||
else
|
|
||||||
echo "App $APP already stopped"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ps_rebuild() {
|
ps_rebuild() {
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
|
scheduler-docker-local-scheduler-stop() {
|
||||||
|
declare desc="scheduler-docker-local scheduler-stop plugin trigger"
|
||||||
|
declare trigger="scheduler-docker-local scheduler-stop"
|
||||||
|
declare DOKKU_SCHEDULER="$1" APP="$2"
|
||||||
|
|
||||||
|
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
|
||||||
|
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||||
|
|
||||||
|
[[ -n "$DOKKU_DOCKER_STOP_TIMEOUT" ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
docker stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scheduler-docker-local-scheduler-stop "$@"
|
||||||
Reference in new issue
Block a user