Files
dokku/plugins/scheduler-docker-local/pre-deploy
Jose Diaz-Gonzalez 68d05b230d refactor: simplify file ownership in the container by setting the process ownership during the build process
Rather than require a heavy chown operation across various paths, just chown the files already in the built image during the release process. This ensures we can skip not-only the chown process during the container start that herokuish injects, but also the one that Dokku runs which modifies mounted container paths as well during the pre-deploy.

Note that users will need to ensure any mounted volumes don't have permissions reset by other processes or containers won't be able to access them.
2024-03-12 22:27:39 -04:00

40 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
trigger-scheduler-docker-local-pre-deploy() {
declare desc="scheduler-docker-local pre-deploy plugin trigger"
declare trigger="pre-deploy"
declare APP="$1" IMAGE_TAG="$2"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi
scheduler-docker-local-pre-deploy-precheck "$APP"
}
scheduler-docker-local-pre-deploy-precheck() {
declare desc="Outputs the checks messages if necessary"
declare APP="$1"
dokku_log_info2 "Processing deployment checks"
local TMP_APP_JSON_OUTPUT=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$TMP_APP_JSON_OUTPUT' >/dev/null" RETURN INT TERM EXIT
plugn trigger app-json-get-content "$APP" >"$TMP_APP_JSON_OUTPUT"
if ! docker-container-healthchecker exists web --app-json "$TMP_APP_JSON_OUTPUT"; then
local CHECKS_URL="${DOKKU_CHECKS_URL:-https://dokku.com/docs/deployment/zero-downtime-deploys/}"
dokku_log_verbose "No web healthchecks found in app.json. Simple container checks will be performed."
dokku_log_verbose "For more efficient zero downtime deployments, add healthchecks to your app.json. See ${CHECKS_URL} for examples"
fi
}
trigger-scheduler-docker-local-pre-deploy "$@"