feat: migrate environment variables to plugin properties
Standardize how environment variables are migrated to properties during install triggers and migrate all remaining DOKKU_* config vars to their appropriate plugin properties. Adds a reusable MigrateConfigToProperties() function in the common package with Transform callback and ListProperty support, plus a migrate-config-to-property subcommand for the prop binary so shell plugins can use the same code path. Migrated variables and their new property owners: - DOKKU_APP_PROXY_TYPE/DOKKU_PROXY_TYPE → proxy type - DOKKU_DISABLE_PROXY → proxy disabled - DOKKU_PROXY_PORT → ports proxy-port - DOKKU_PROXY_SSL_PORT → ports proxy-ssl-port - DOKKU_APP_RESTORE → ps restore - DOKKU_SKIP_DEPLOY → ps skip-deploy - DOKKU_START_CMD → ps start-cmd - DOKKU_DOCKERFILE_START_CMD → ps dockerfile-start-cmd - DOKKU_DISABLE_APP_AUTOCREATION → apps disable-autocreation - DOKKU_APP_SHELL → scheduler shell - DOKKU_SKIP_CLEANUP → builder skip-cleanup - DOKKU_CHECKS_DISABLED → checks disabled - DOKKU_CHECKS_SKIPPED → checks skipped - DOKKU_CHECKS_WAIT → checks wait - DOKKU_CHECKS_TIMEOUT → checks timeout - DOKKU_CHECKS_ATTEMPTS → checks attempts - DOKKU_DEFAULT_CHECKS_WAIT → checks default-wait - DOKKU_SKIP_ALL_CHECKS → checks disabled (legacy) - DOKKU_SKIP_DEFAULT_CHECKS → checks skipped (legacy) Also refactors existing bespoke migration loops in scheduler, ports, ps, builder, and nginx-vhosts plugins to use the standardized utility. Removes DOKKU_PARALLEL_ARGUMENTS from documentation (unused in core). Deprecates fn-migrate-config-to-property bash function. closes #1558
This commit is contained in:
@@ -3,16 +3,14 @@ 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"
|
||||
|
||||
migrate_checks_vars_0_29_0() {
|
||||
declare desc="migrates deprecated DOKKU_WAIT_TO_RETIRE config variables to property counter part introduced in 0.29.x"
|
||||
|
||||
fn-migrate-config-to-property "checks" "wait-to-retire" "DOKKU_WAIT_TO_RETIRE" "DOKKU_WAIT_TO_RETIRE"
|
||||
}
|
||||
|
||||
migrate_checks_vars_0_5_0() {
|
||||
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
|
||||
|
||||
if ! declare -f -F config_get >/dev/null; then
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
fi
|
||||
|
||||
local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local GLOBAL_SKIP_DEFAULT_CHECKS=$(config_get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
@@ -20,13 +18,13 @@ migrate_checks_vars_0_5_0() {
|
||||
local APP_SKIP_ALL_CHECKS=$(config_get "$app" DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local APP_SKIP_DEFAULT_CHECKS=$(config_get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
|
||||
dokku_log_info1 "Migrating zero downtime env variables to 0.5.x. The following variables have been deprecated"
|
||||
dokku_log_info2 "DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS"
|
||||
dokku_log_info2 "Please use dokku checks:[disable|enable] <app> to control zero downtime functionality"
|
||||
dokku_log_info2 ""
|
||||
dokku_log_info2 "Zero downtime checks disabled for app ($app)"
|
||||
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
|
||||
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]]; then
|
||||
dokku_log_info1 "Migrating DOKKU_SKIP_ALL_CHECKS to checks disabled property for $app. Use 'dokku checks:set $app disabled <value>' to manage this going forward."
|
||||
fn-plugin-property-write "checks" "$app" "disabled" "_all_"
|
||||
fi
|
||||
if [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
|
||||
dokku_log_info1 "Migrating DOKKU_SKIP_DEFAULT_CHECKS to checks skipped property for $app. Use 'dokku checks:set $app skipped <value>' to manage this going forward."
|
||||
fn-plugin-property-write "checks" "$app" "skipped" "_all_"
|
||||
fi
|
||||
if [[ -n "$APP_SKIP_ALL_CHECKS" ]] || [[ -n "$APP_SKIP_DEFAULT_CHECKS" ]]; then
|
||||
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
|
||||
@@ -34,7 +32,6 @@ migrate_checks_vars_0_5_0() {
|
||||
done
|
||||
|
||||
if [[ -n "$GLOBAL_SKIP_ALL_CHECKS" ]] || [[ -n "$GLOBAL_SKIP_DEFAULT_CHECKS" ]]; then
|
||||
dokku_log_info1 "Removing global zero downtime settings"
|
||||
DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
|
||||
fi
|
||||
}
|
||||
@@ -42,15 +39,16 @@ migrate_checks_vars_0_5_0() {
|
||||
migrate_checks_vars_0_6_0() {
|
||||
declare desc="migrates CHECKS config variables from 0.5.x to support fully-disabled zero-downtime checks"
|
||||
|
||||
if ! declare -f -F config_get >/dev/null; then
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
fi
|
||||
|
||||
for app in $(dokku_apps "false" 2>/dev/null); do
|
||||
local APP_DOKKU_CHECKS_ENABLED=$(config_get "$app" DOKKU_CHECKS_ENABLED || true)
|
||||
if [[ $APP_DOKKU_CHECKS_ENABLED ]]; then
|
||||
dokku_log_info1 "Migrating zero downtime env variables to 0.6.x. The following variables will be migrated"
|
||||
dokku_log_info2 "DOKKU_CHECKS_ENABLED -> DOKKU_CHECKS_SKIPPED"
|
||||
if [[ -n "$APP_DOKKU_CHECKS_ENABLED" ]]; then
|
||||
if [[ "$APP_DOKKU_CHECKS_ENABLED" == "0" ]]; then
|
||||
dokku_log_info2 ""
|
||||
dokku_log_info2 "Zero downtime checks disabled for app ($app)"
|
||||
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_CHECKS_SKIPPED="_all_"
|
||||
dokku_log_info1 "Migrating DOKKU_CHECKS_ENABLED to checks skipped property for $app. Use 'dokku checks:set $app skipped <value>' to manage this going forward."
|
||||
fn-plugin-property-write "checks" "$app" "skipped" "_all_"
|
||||
fi
|
||||
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
|
||||
fi
|
||||
@@ -64,7 +62,14 @@ trigger-checks-install() {
|
||||
fn-plugin-property-setup "checks"
|
||||
migrate_checks_vars_0_5_0 "$@"
|
||||
migrate_checks_vars_0_6_0 "$@"
|
||||
migrate_checks_vars_0_29_0 "$@"
|
||||
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks wait-to-retire DOKKU_WAIT_TO_RETIRE --global-config-var DOKKU_WAIT_TO_RETIRE
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks disabled DOKKU_CHECKS_DISABLED
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks skipped DOKKU_CHECKS_SKIPPED
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks wait DOKKU_CHECKS_WAIT --global-config-var DOKKU_CHECKS_WAIT
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks timeout DOKKU_CHECKS_TIMEOUT --global-config-var DOKKU_CHECKS_TIMEOUT
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks attempts DOKKU_CHECKS_ATTEMPTS --global-config-var DOKKU_CHECKS_ATTEMPTS
|
||||
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property checks default-wait DOKKU_DEFAULT_CHECKS_WAIT --global-config-var DOKKU_DEFAULT_CHECKS_WAIT
|
||||
}
|
||||
|
||||
trigger-checks-install "$@"
|
||||
|
||||
Reference in New Issue
Block a user