feat: add the ability to disable the init process

This allows projects using s6 overlay - in particular linxserver images - the ability to disable --init flag injection.

Closes #5287
This commit is contained in:
Jose Diaz-Gonzalez
2022-08-10 21:27:25 -04:00
parent 6a3933213c
commit c4c6ac5617
5 changed files with 21 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ main() {
CONTAINER_INDEX=$((CONTAINER_INDEX + 1))
done
INJECT_INIT_FLAG="$(fn-plugin-property-get "scheduler-docker-local" "$APP" "init-process" "true")"
PARALLEL_DEPLOY_COUNT="$(plugn trigger "app-json-process-deploy-parallelism" "$APP" "$PROC_TYPE")"
DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED" parallel --will-cite --halt soon,fail=1 --jobs "$PARALLEL_DEPLOY_COUNT" --ungroup <"$PROCESS_TMP_FILE"

View File

@@ -19,7 +19,9 @@ main() {
DOCKER_ARGS+=" --label=com.dokku.process-type=$PROC_TYPE --label=com.dokku.dyno=$DYNO"
DOCKER_ARGS+=" --env=DYNO=$DYNO"
DOCKER_ARGS+=" --name=$APP.$DYNO.upcoming-$RANDOM"
DOCKER_ARGS+=" --init"
if [[ "$INJECT_INIT_FLAG" == "false" ]]; then
DOCKER_ARGS+=" --init"
fi
DOCKER_ARGS+=" $DOCKER_RUN_LABEL_ARGS $DOKKU_GLOBAL_RUN_ARGS "
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" --env=TRACE=true"

View File

@@ -37,6 +37,7 @@ cmd-scheduler-docker-local-report-single() {
verify_app_name "$APP"
local flag_map=(
"--scheduler-docker-local-disable-chown: $(fn-plugin-property-get "scheduler-docker-local" "$APP" "disable-chown" "")"
"--scheduler-docker-local-init-process: $(fn-plugin-property-get "scheduler-docker-local" "$APP" "init-process" "true")"
"--scheduler-docker-local-parallel-schedule-count: $(fn-plugin-property-get "scheduler-docker-local" "$APP" "parallel-schedule-count" "")"
)

View File

@@ -9,13 +9,13 @@ cmd-scheduler-docker-local-set() {
declare cmd="scheduler-docker-local:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("disable-chown" "parallel-schedule-count")
local VALID_KEYS=("disable-chown" "init-process" "parallel-schedule-count")
verify_app_name "$APP"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
dokku_log_fail "Invalid key specified, valid keys include: disable-chown, parallel-schedule-count"
dokku_log_fail "Invalid key specified, valid keys include: disable-chown, init-process, parallel-schedule-count"
fi
if [[ -n "$VALUE" ]]; then