feat: retire intermediate containers after use
Rather than waiting for the next deploy, take advantage of the retire system to retire these containers immediately. Note that since the retire process happens out of band, the containers may stick around for up to 5 minutes, after which point they will be removed. Customization of the wait time to retire - currently 60 seconds - is up for future debate. The containers ultimately haven't been useful for debugging, so keeping them around for longer won't help in most cases, and folks can disable the dokku-retire service (or cron) if that is desired.
This commit is contained in:
@@ -51,7 +51,7 @@ scheduler-docker-local-pre-deploy-chown-app() {
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
"$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
|
||||
"$DOCKER_BIN" container run --rm "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
|
||||
}
|
||||
|
||||
scheduler-docker-local-pre-deploy-precheck() {
|
||||
|
||||
14
plugins/scheduler-docker-local/scheduler-register-retired
Executable file
14
plugins/scheduler-docker-local/scheduler-register-retired
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
|
||||
|
||||
trigger-scheduler-docker-local-scheduler-register-retired() {
|
||||
declare desc="register a container for retiring"
|
||||
declare trigger="scheduler-register-retired"
|
||||
declare APP="$1" CONTAINER_ID="$2" WAIT="${3:-60}"
|
||||
|
||||
fn-scheduler-docker-local-register-retired-container "$APP" "$CONTAINER_ID" "$WAIT"
|
||||
}
|
||||
|
||||
trigger-scheduler-docker-local-scheduler-register-retired "$@"
|
||||
Reference in New Issue
Block a user