Merge pull request #8640 from dokku/8631-caddy-haproxy-traefik-report-global-lacks-raw-key-for-global-properties

Split report global keys into raw and computed
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-23 22:54:23 -04:00
committed by GitHub
93 changed files with 2868 additions and 413 deletions

View File

@@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{
"--app-json-global-appjson-path": reportGlobalAppjsonpath,
"--app-json-computed-appjson-path": reportComputedAppjsonpath,
"--app-json-global-appjson-path": reportGlobalAppjsonpath,
}
} else {
flags = map[string]common.ReportFunc{
@@ -41,12 +42,15 @@ func reportComputedAppjsonpath(appName string) string {
if value == "" {
value = reportGlobalAppjsonpath(appName)
}
if value == "" {
value = "app.json"
}
return value
}
func reportGlobalAppjsonpath(appName string) string {
return common.PropertyGetDefault("app-json", "--global", "appjson-path", "app.json")
return common.PropertyGet("app-json", "--global", "appjson-path")
}
func reportAppjsonpath(appName string) string {

View File

@@ -44,6 +44,7 @@ cmd-builder-dockerfile-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-dockerfile-computed-dockerfile-path: $(fn-builder-dockerfile-computed-dockerfile-path "$APP")"
"--builder-dockerfile-global-dockerfile-path: $(fn-builder-dockerfile-global-dockerfile-path "$APP")"
)
else
@@ -97,6 +98,9 @@ fn-builder-dockerfile-computed-dockerfile-path() {
if [[ "$file" == "" ]]; then
file="$(fn-builder-dockerfile-global-dockerfile-path "$APP")"
fi
if [[ "$file" == "" ]]; then
file="Dockerfile"
fi
echo "$file"
}
@@ -104,7 +108,7 @@ fn-builder-dockerfile-computed-dockerfile-path() {
fn-builder-dockerfile-global-dockerfile-path() {
declare APP="$1"
fn-plugin-property-get-default "builder-dockerfile" "--global" "dockerfile-path" "Dockerfile"
fn-plugin-property-get-default "builder-dockerfile" "--global" "dockerfile-path" ""
}
fn-builder-dockerfile-dockerfile-path() {

View File

@@ -44,6 +44,7 @@ cmd-builder-herokuish-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-herokuish-computed-allowed: $(fn-builder-herokuish-computed-allowed "$APP")"
"--builder-herokuish-global-allowed: $(fn-builder-herokuish-global-allowed)"
)
else
@@ -97,16 +98,16 @@ fn-builder-herokuish-computed-allowed() {
if [[ -z "$allowed" ]]; then
allowed="$(fn-builder-herokuish-global-allowed)"
fi
if [[ -z "$allowed" ]]; then
allowed="true"
[[ "$(dpkg --print-architecture 2>/dev/null || true)" != "amd64" ]] && allowed="false"
fi
echo "$allowed"
}
fn-builder-herokuish-global-allowed() {
local default_value="true"
[[ "$(dpkg --print-architecture 2>/dev/null || true)" != "amd64" ]] && default_value="false"
fn-plugin-property-get-default "builder-herokuish" "--global" "allowed" "$default_value"
fn-plugin-property-get-default "builder-herokuish" "--global" "allowed" ""
}
fn-builder-herokuish-allowed() {

View File

@@ -44,6 +44,7 @@ cmd-builder-lambda-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-lambda-computed-lambdayml-path: $(fn-builder-lambda-computed-lambdayml-path "$APP")"
"--builder-lambda-global-lambdayml-path: $(fn-builder-lambda-global-lambdayml-path "$APP")"
)
else
@@ -97,6 +98,9 @@ fn-builder-lambda-computed-lambdayml-path() {
if [[ "$file" == "" ]]; then
file="$(fn-builder-lambda-global-lambdayml-path "$APP")"
fi
if [[ "$file" == "" ]]; then
file="lambda.yml"
fi
echo "$file"
}
@@ -104,7 +108,7 @@ fn-builder-lambda-computed-lambdayml-path() {
fn-builder-lambda-global-lambdayml-path() {
declare APP="$1"
fn-plugin-property-get-default "builder-lambda" "--global" "lambdayml-path" "lambda.yml"
fn-plugin-property-get-default "builder-lambda" "--global" "lambdayml-path" ""
}
fn-builder-lambda-lambdayml-path() {

View File

@@ -44,6 +44,7 @@ cmd-builder-nixpacks-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-nixpacks-computed-nixpackstoml-path: $(fn-builder-nixpacks-computed-nixpackstoml-path "$APP")"
"--builder-nixpacks-global-nixpackstoml-path: $(fn-builder-nixpacks-global-nixpackstoml-path "$APP")"
)
else
@@ -97,6 +98,9 @@ fn-builder-nixpacks-computed-nixpackstoml-path() {
if [[ "$file" == "" ]]; then
file="$(fn-builder-nixpacks-global-nixpackstoml-path "$APP")"
fi
if [[ "$file" == "" ]]; then
file="nixpacks.toml"
fi
echo "$file"
}
@@ -104,7 +108,7 @@ fn-builder-nixpacks-computed-nixpackstoml-path() {
fn-builder-nixpacks-global-nixpackstoml-path() {
declare APP="$1"
fn-plugin-property-get "builder-nixpacks" "--global" "nixpackstoml-path" "nixpacks.toml"
fn-plugin-property-get "builder-nixpacks" "--global" "nixpackstoml-path" ""
}
fn-builder-nixpacks-nixpackstoml-path() {

View File

@@ -44,6 +44,7 @@ cmd-builder-pack-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-pack-computed-projecttoml-path: $(fn-builder-pack-computed-projecttoml-path "$APP")"
"--builder-pack-global-projecttoml-path: $(fn-builder-pack-global-projecttoml-path "$APP")"
)
else
@@ -97,6 +98,9 @@ fn-builder-pack-computed-projecttoml-path() {
if [[ "$file" == "" ]]; then
file="$(fn-builder-pack-global-projecttoml-path "$APP")"
fi
if [[ "$file" == "" ]]; then
file="project.toml"
fi
echo "$file"
}
@@ -104,7 +108,7 @@ fn-builder-pack-computed-projecttoml-path() {
fn-builder-pack-global-projecttoml-path() {
declare APP="$1"
fn-plugin-property-get-default "builder-pack" "--global" "projecttoml-path" "project.toml"
fn-plugin-property-get-default "builder-pack" "--global" "projecttoml-path" ""
}
fn-builder-pack-projecttoml-path() {

View File

@@ -44,6 +44,7 @@ cmd-builder-railpack-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--builder-railpack-computed-railpackjson-path: $(fn-builder-railpack-computed-railpackjson-path "$APP")"
"--builder-railpack-global-railpackjson-path: $(fn-builder-railpack-global-railpackjson-path "$APP")"
)
else
@@ -97,6 +98,9 @@ fn-builder-railpack-computed-railpackjson-path() {
if [[ "$file" == "" ]]; then
file="$(fn-builder-railpack-global-railpackjson-path "$APP")"
fi
if [[ "$file" == "" ]]; then
file="railpack.json"
fi
echo "$file"
}
@@ -104,7 +108,7 @@ fn-builder-railpack-computed-railpackjson-path() {
fn-builder-railpack-global-railpackjson-path() {
declare APP="$1"
fn-plugin-property-get "builder-railpack" "--global" "railpackjson-path" "railpack.json"
fn-plugin-property-get "builder-railpack" "--global" "railpackjson-path" ""
}
fn-builder-railpack-railpackjson-path() {

View File

@@ -13,7 +13,7 @@ trigger-caddy-vhosts-certs-force() {
return
fi
if [[ -n "$(fn-caddy-letsencrypt-email)" ]]; then
if [[ -n "$(fn-caddy-computed-letsencrypt-email)" ]]; then
echo true
fi
}

View File

@@ -70,23 +70,34 @@ cmd-caddy-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--caddy-computed-image: $(fn-caddy-computed-image)"
"--caddy-computed-letsencrypt-email: $(fn-caddy-computed-letsencrypt-email)"
"--caddy-computed-letsencrypt-server: $(fn-caddy-computed-letsencrypt-server)"
"--caddy-computed-log-level: $(fn-caddy-computed-log-level)"
"--caddy-computed-polling-interval: $(fn-caddy-computed-polling-interval)"
"--caddy-computed-tls-internal: $(fn-caddy-computed-tls-internal "$APP")"
"--caddy-global-image: $(fn-caddy-global-image)"
"--caddy-global-letsencrypt-email: $(fn-caddy-global-letsencrypt-email)"
"--caddy-global-letsencrypt-server: $(fn-caddy-global-letsencrypt-server)"
"--caddy-global-log-level: $(fn-caddy-global-log-level)"
"--caddy-global-polling-interval: $(fn-caddy-global-polling-interval)"
"--caddy-global-tls-internal: $(fn-caddy-global-tls-internal)"
"--caddy-image: $(fn-caddy-image)"
"--caddy-letsencrypt-email: $(fn-caddy-letsencrypt-email)"
"--caddy-letsencrypt-server: $(fn-caddy-letsencrypt-server)"
"--caddy-log-level: $(fn-caddy-log-level)"
"--caddy-polling-interval: $(fn-caddy-polling-interval)"
)
else
verify_app_name "$APP"
flag_map=(
"--caddy-computed-image: $(fn-caddy-computed-image)"
"--caddy-computed-letsencrypt-email: $(fn-caddy-computed-letsencrypt-email)"
"--caddy-computed-letsencrypt-server: $(fn-caddy-computed-letsencrypt-server)"
"--caddy-computed-log-level: $(fn-caddy-computed-log-level)"
"--caddy-computed-polling-interval: $(fn-caddy-computed-polling-interval)"
"--caddy-computed-tls-internal: $(fn-caddy-computed-tls-internal "$APP")"
"--caddy-global-image: $(fn-caddy-global-image)"
"--caddy-global-letsencrypt-email: $(fn-caddy-global-letsencrypt-email)"
"--caddy-global-letsencrypt-server: $(fn-caddy-global-letsencrypt-server)"
"--caddy-global-log-level: $(fn-caddy-global-log-level)"
"--caddy-global-polling-interval: $(fn-caddy-global-polling-interval)"
"--caddy-global-tls-internal: $(fn-caddy-global-tls-internal)"
"--caddy-image: $(fn-caddy-image)"
"--caddy-letsencrypt-email: $(fn-caddy-letsencrypt-email)"
"--caddy-letsencrypt-server: $(fn-caddy-letsencrypt-server)"
"--caddy-log-level: $(fn-caddy-log-level)"
"--caddy-polling-interval: $(fn-caddy-polling-interval)"
"--caddy-tls-internal: $(fn-caddy-tls-internal "$APP")"
)
fi

View File

@@ -68,7 +68,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
fi
done < <(plugn trigger ports-get "$APP")
letsencrypt_email="$(fn-caddy-letsencrypt-email)"
letsencrypt_email="$(fn-caddy-computed-letsencrypt-email)"
if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then
proxy_container_https_port_candidate="$proxy_container_http_port_candidate"
proxy_host_https_port_candidate="$proxy_host_http_port_candidate"

View File

@@ -36,35 +36,73 @@ fn-caddy-template-compose-file() {
fi
local SIGIL_PARAMS=(CADDY_DATA_DIR="${DOKKU_LIB_ROOT}/data/caddy"
CADDY_IMAGE="$(fn-caddy-image)"
CADDY_LETSENCRYPT_EMAIL="$(fn-caddy-letsencrypt-email)"
CADDY_LETSENCRYPT_SERVER="$(fn-caddy-letsencrypt-server)"
CADDY_LOG_LEVEL="$(fn-caddy-log-level)"
CADDY_POLLING_INTERVAL="$(fn-caddy-polling-interval)")
CADDY_IMAGE="$(fn-caddy-computed-image)"
CADDY_LETSENCRYPT_EMAIL="$(fn-caddy-computed-letsencrypt-email)"
CADDY_LETSENCRYPT_SERVER="$(fn-caddy-computed-letsencrypt-server)"
CADDY_LOG_LEVEL="$(fn-caddy-computed-log-level)"
CADDY_POLLING_INTERVAL="$(fn-caddy-computed-polling-interval)")
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
}
fn-caddy-image() {
fn-plugin-property-get-default "caddy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/Dockerfile" | awk '{print $2}')"
fn-caddy-global-image() {
fn-plugin-property-get-default "caddy" "--global" "image" ""
}
fn-caddy-letsencrypt-email() {
fn-caddy-computed-image() {
local value
value="$(fn-caddy-global-image)"
if [[ -z "$value" ]]; then
value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/Dockerfile" | awk '{print $2}')"
fi
echo "$value"
}
fn-caddy-global-letsencrypt-email() {
fn-plugin-property-get-default "caddy" "--global" "letsencrypt-email" ""
}
fn-caddy-letsencrypt-server() {
fn-plugin-property-get-default "caddy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory"
fn-caddy-computed-letsencrypt-email() {
fn-caddy-global-letsencrypt-email
}
fn-caddy-log-level() {
local log_level
log_level="$(fn-plugin-property-get-default "caddy" "--global" "log-level" "ERROR")"
echo "${log_level^^}"
fn-caddy-global-letsencrypt-server() {
fn-plugin-property-get-default "caddy" "--global" "letsencrypt-server" ""
}
fn-caddy-polling-interval() {
fn-plugin-property-get-default "caddy" "--global" "polling-interval" "5s"
fn-caddy-computed-letsencrypt-server() {
local value
value="$(fn-caddy-global-letsencrypt-server)"
if [[ -z "$value" ]]; then
value="https://acme-v02.api.letsencrypt.org/directory"
fi
echo "$value"
}
fn-caddy-global-log-level() {
fn-plugin-property-get-default "caddy" "--global" "log-level" ""
}
fn-caddy-computed-log-level() {
local value
value="$(fn-caddy-global-log-level)"
if [[ -z "$value" ]]; then
value="ERROR"
fi
echo "${value^^}"
}
fn-caddy-global-polling-interval() {
fn-plugin-property-get-default "caddy" "--global" "polling-interval" ""
}
fn-caddy-computed-polling-interval() {
local value
value="$(fn-caddy-global-polling-interval)"
if [[ -z "$value" ]]; then
value="5s"
fi
echo "$value"
}
fn-caddy-tls-internal() {
@@ -79,9 +117,12 @@ fn-caddy-computed-tls-internal() {
if [[ -z "$value" ]]; then
value="$(fn-caddy-global-tls-internal)"
fi
if [[ -z "$value" ]]; then
value="false"
fi
echo "$value"
}
fn-caddy-global-tls-internal() {
fn-plugin-property-get-default "caddy" "--global" "tls-internal" "false"
fn-plugin-property-get-default "caddy" "--global" "tls-internal" ""
}

View File

@@ -45,6 +45,7 @@ cmd-checks-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--checks-computed-wait-to-retire: $(fn-checks-computed-wait-to-retire "$APP")"
"--checks-global-wait-to-retire: $(fn-checks-global-wait-to-retire "$APP")"
)
else
@@ -116,6 +117,9 @@ fn-checks-computed-wait-to-retire() {
if [[ "$file" == "" ]]; then
file="$(fn-checks-global-wait-to-retire "$APP")"
fi
if [[ "$file" == "" ]]; then
file="60"
fi
echo "$file"
}
@@ -123,7 +127,7 @@ fn-checks-computed-wait-to-retire() {
fn-checks-global-wait-to-retire() {
declare APP="$1"
fn-plugin-property-get-default "checks" "--global" "wait-to-retire" "60"
fn-plugin-property-get-default "checks" "--global" "wait-to-retire" ""
}
fn-checks-wait-to-retire() {

View File

@@ -11,12 +11,12 @@ fi
DOKKU_ARCHIVE_MAX_SIZE_DEFAULT="1073741824"
DOKKU_ARCHIVE_MAX_FILES_DEFAULT="10000"
fn-archive-max-size() {
fn-archive-computed-max-size() {
declare desc="returns the configured max archive size in bytes"
fn-plugin-property-get "git" "--global" "archive-max-size" "$DOKKU_ARCHIVE_MAX_SIZE_DEFAULT"
}
fn-archive-max-files() {
fn-archive-computed-max-files() {
declare desc="returns the configured max archive entry count"
fn-plugin-property-get "git" "--global" "archive-max-files" "$DOKKU_ARCHIVE_MAX_FILES_DEFAULT"
}
@@ -43,8 +43,8 @@ fn-archive-check-bomb-protection() {
declare desc="validates archive against bomb protection limits"
declare ARCHIVE_PATH="$1" ARCHIVE_TYPE="$2"
local MAX_SIZE MAX_FILES
MAX_SIZE="$(fn-archive-max-size)"
MAX_FILES="$(fn-archive-max-files)"
MAX_SIZE="$(fn-archive-computed-max-size)"
MAX_FILES="$(fn-archive-computed-max-files)"
local ARCHIVE_SIZE
ARCHIVE_SIZE="$(stat -c %s "$ARCHIVE_PATH" 2>/dev/null || stat -f %z "$ARCHIVE_PATH" 2>/dev/null || echo 0)"
@@ -190,8 +190,8 @@ fn-archive-extract-zip() {
declare desc="safely extracts a zip archive with post-extraction symlink validation"
declare ARCHIVE_PATH="$1" DEST_DIR="$2"
local MAX_SIZE MAX_FILES
MAX_SIZE="$(fn-archive-max-size)"
MAX_FILES="$(fn-archive-max-files)"
MAX_SIZE="$(fn-archive-computed-max-size)"
MAX_FILES="$(fn-archive-computed-max-files)"
local ARCHIVE_SIZE
ARCHIVE_SIZE="$(stat -c %s "$ARCHIVE_PATH" 2>/dev/null || stat -f %z "$ARCHIVE_PATH" 2>/dev/null || echo 0)"

View File

@@ -65,7 +65,7 @@ cmd-git-hook() {
plugn trigger app-exists "$APP" 2>/dev/null || is_valid_app_name "$APP"
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via deploy-branch setting."
echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'"
@@ -84,7 +84,7 @@ cmd-git-hook() {
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 1 ]]; then
plugn trigger receive-branch "$APP" "$newrev" "$refname"
plugn trigger deploy-source-set "$APP" "git-push" "$newrev"
elif [[ -z "$(fn-git-deploy-branch "$APP" "")" ]]; then
elif [[ -z "$(fn-git-computed-deploy-branch "$APP" "")" ]]; then
local deploy_branch="${refname/refs\/heads\//}"
deploy_branch="${deploy_branch/refs\/tags\//}"
@@ -115,7 +115,7 @@ git_build() {
fi
local REF="$REV"
else
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if [[ -f "$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH" ]]; then
REF=$(<"$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH")
else

View File

@@ -8,7 +8,7 @@ trigger-git-git-deploy-branch() {
declare trigger="git-deploy-branch"
declare APP="$1"
fn-git-deploy-branch "$APP"
fn-git-computed-deploy-branch "$APP"
}
trigger-git-git-deploy-branch "$@"

View File

@@ -11,7 +11,7 @@ trigger-git-git-from-directory() {
declare APP="$1" SOURCECODE_WORK_DIR="$2" USER_NAME="${3:-Dokku}" USER_EMAIL="${4:-automated@dokku.sh}"
local APP_ROOT="$DOKKU_ROOT/$APP"
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
local REV
local TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
local TMP_WORK_DIR_2=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
@@ -25,7 +25,7 @@ trigger-git-git-from-directory() {
dokku_log_info1 "Updating git repository with specified build context"
if [[ "$has_code" == "false" ]]; then
# setup new repo
local DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
cp -rT "$SOURCECODE_WORK_DIR" "$TMP_WORK_DIR"
suppress_output fn-git-cmd "$TMP_WORK_DIR" init
suppress_output fn-git-cmd "$TMP_WORK_DIR" checkout -b "$DEPLOY_BRANCH"
@@ -64,7 +64,7 @@ trigger-git-git-from-directory() {
return
else
local exit_code=$?
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if [[ "$has_code" == "false" ]]; then
fn-git-cmd "$APP_ROOT" update-ref -d HEAD
else

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/archive-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
@@ -273,7 +274,7 @@ cmd-git-sync() {
fi
local APP_ROOT="$DOKKU_ROOT/$APP"
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
CURRENT_REF="$(fn-git-cmd "$APP_ROOT" rev-parse "$DOKKU_DEPLOY_BRANCH" 2>/dev/null || true)"
dokku_setup_build_capture "$APP" "git:sync"
@@ -369,19 +370,27 @@ cmd-git-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "10000")"
"--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "1073741824")"
"--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "master")"
"--git-computed-archive-max-files: $(fn-archive-computed-max-files)"
"--git-computed-archive-max-size: $(fn-archive-computed-max-size)"
"--git-computed-deploy-branch: $(fn-git-computed-deploy-branch "$APP")"
"--git-computed-keep-git-dir: $(fn-git-computed-keep-git-dir "$APP")"
"--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "")"
"--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "")"
"--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "")"
"--git-global-keep-git-dir: $(fn-plugin-property-get "git" "--global" "keep-git-dir" "")"
)
else
verify_app_name "$APP"
flag_map=(
"--git-computed-deploy-branch: $(fn-git-deploy-branch "$APP")"
"--git-computed-keep-git-dir: $(fn-git-keep-git-dir "$APP")"
"--git-computed-archive-max-files: $(fn-archive-computed-max-files)"
"--git-computed-archive-max-size: $(fn-archive-computed-max-size)"
"--git-computed-deploy-branch: $(fn-git-computed-deploy-branch "$APP")"
"--git-computed-keep-git-dir: $(fn-git-computed-keep-git-dir "$APP")"
"--git-deploy-branch: $(fn-plugin-property-get "git" "$APP" "deploy-branch" "")"
"--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "10000")"
"--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "1073741824")"
"--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "master")"
"--git-global-archive-max-files: $(fn-plugin-property-get "git" "--global" "archive-max-files" "")"
"--git-global-archive-max-size: $(fn-plugin-property-get "git" "--global" "archive-max-size" "")"
"--git-global-deploy-branch: $(fn-plugin-property-get "git" "--global" "deploy-branch" "")"
"--git-global-keep-git-dir: $(fn-plugin-property-get "git" "--global" "keep-git-dir" "")"
"--git-keep-git-dir: $(fn-plugin-property-get "git" "$APP" "keep-git-dir" "")"
"--git-rev-env-var: $(fn-plugin-property-get "git" "$APP" "rev-env-var" "GIT_REV")"
"--git-sha: $(fn-git-cmd "$APP_ROOT" rev-parse HEAD 2>/dev/null || false)"
@@ -475,13 +484,13 @@ fn-git-clone() {
local APP_ROOT="$DOKKU_ROOT/$APP"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if fn-git-cmd "$APP_ROOT" rev-parse "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
dokku_log_fail "The clone subcommand can only be executed for new applications"
fi
if [[ -z "$GIT_REF" ]]; then
GIT_REF="$(fn-git-deploy-branch "$APP")"
GIT_REF="$(fn-git-computed-deploy-branch "$APP")"
fi
local TMP_IS_REF_DIR=$(mktemp -d "/tmp/dokku-ref-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
@@ -511,7 +520,7 @@ fn-git-clone() {
fi
fi
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if [[ "$GIT_REF" != "$DOKKU_DEPLOY_BRANCH" ]]; then
if [[ "$is_ref" == "true" ]]; then
fn-git-cmd "$TMP_CLONE_DIR" branch -qq -D "$DOKKU_DEPLOY_BRANCH" 2>/dev/null || true
@@ -542,12 +551,12 @@ fn-git-fetch() {
local DOKKU_DEPLOY_BRANCH
local APP_ROOT="$DOKKU_ROOT/$APP"
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if ! fn-git-cmd "$APP_ROOT" rev-parse "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
dokku_log_fail "The fetch subcommand can only be executed for existing applications"
fi
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
if ! fn-git-cmd "$APP_ROOT" check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
dokku_log_warn "Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via deploy-branch setting."
dokku_log_warn "For more details, please see the man page for 'git-check-ref-format.'"
@@ -571,7 +580,7 @@ fn-git-has-code() {
declare APP="$1" DOKKU_DEPLOY_BRANCH="$2"
if [[ -z "$DOKKU_DEPLOY_BRANCH" ]]; then
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
fi
local HEAD_FILE="$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH"
@@ -585,7 +594,7 @@ fn-git-has-code() {
fn-git-last-updated-at() {
declare desc="retrieve the deploy branch for a given application"
declare APP="$1"
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
local HEAD_FILE="$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH"
if [[ -f "$HEAD_FILE" ]]; then
@@ -593,7 +602,7 @@ fn-git-last-updated-at() {
fi
}
fn-git-deploy-branch() {
fn-git-computed-deploy-branch() {
declare desc="retrieve the deploy branch for a given application"
local APP="$1"
local DEFAULT_BRANCH="${2-master}"
@@ -609,14 +618,17 @@ fn-git-deploy-branch() {
fi
}
fn-git-keep-git-dir() {
fn-git-computed-keep-git-dir() {
declare desc="retrieve the keep-git-dir value for a given application"
local APP="$1"
local DEFAULT_KEEP_GIT_DIR="${2-false}"
local DOKKU_KEEP_GIT_DIR="$(fn-plugin-property-get "git" "$APP" "keep-git-dir" "")"
local DOKKU_GLOBAL_KEEP_GIT_DIR="$(fn-plugin-property-get "git" "--global" "keep-git-dir" "")"
if [[ -n "$DOKKU_KEEP_GIT_DIR" ]]; then
echo "$DOKKU_KEEP_GIT_DIR"
elif [[ -n "$DOKKU_GLOBAL_KEEP_GIT_DIR" ]]; then
echo "$DOKKU_GLOBAL_KEEP_GIT_DIR"
else
echo "$DEFAULT_KEEP_GIT_DIR"
fi
@@ -624,7 +636,7 @@ fn-git-keep-git-dir() {
fn-git-setup-build-dir() {
declare APP="$1" GIT_WORKDIR="$2" REV="$3"
local DOKKU_KEEP_GIT_DIR="$(fn-git-keep-git-dir "$APP")"
local DOKKU_KEEP_GIT_DIR="$(fn-git-computed-keep-git-dir "$APP")"
if [[ "$DOKKU_KEEP_GIT_DIR" == "true" ]]; then
fn-git-setup-build-dir-new "$APP" "$GIT_WORKDIR" "$REV"
@@ -636,7 +648,7 @@ fn-git-setup-build-dir() {
fn-git-setup-build-dir-new() {
declare APP="$1" GIT_WORKDIR="$2" REV="$3"
local APP_ROOT="$DOKKU_ROOT/$APP"
local DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
local DOKKU_DEPLOY_BRANCH="$(fn-git-computed-deploy-branch "$APP")"
# unset the git quarantine path to allow us to use 2.13.0+
# See this issue for more information: https://github.com/dokku/dokku/issues/2796
@@ -671,7 +683,7 @@ fn-git-setup-build-dir-worktree() {
fn-git-setup-build-dir-submodules() {
declare APP="$1" GIT_WORKDIR="$2"
local DOKKU_KEEP_GIT_DIR="$(fn-git-keep-git-dir "$APP")"
local DOKKU_KEEP_GIT_DIR="$(fn-git-computed-keep-git-dir "$APP")"
# unset the git quarantine path to allow us to use 2.13.0+
# See this issue for more information: https://github.com/dokku/dokku/issues/2796

View File

@@ -13,7 +13,7 @@ trigger-haproxy-vhosts-certs-force() {
return
fi
if [[ -n "$(fn-haproxy-letsencrypt-email)" ]]; then
if [[ -n "$(fn-haproxy-computed-letsencrypt-email)" ]]; then
echo true
fi
}

View File

@@ -71,11 +71,16 @@ cmd-haproxy-report-single() {
verify_app_name "$APP"
fi
local flag_map=(
"--haproxy-image: $(fn-haproxy-image)"
"--haproxy-letsencrypt-email: $(fn-haproxy-letsencrypt-email)"
"--haproxy-letsencrypt-server: $(fn-haproxy-letsencrypt-server)"
"--haproxy-log-level: $(fn-haproxy-log-level)"
"--haproxy-refresh-conf: $(fn-haproxy-refresh-conf)"
"--haproxy-computed-image: $(fn-haproxy-computed-image)"
"--haproxy-computed-letsencrypt-email: $(fn-haproxy-computed-letsencrypt-email)"
"--haproxy-computed-letsencrypt-server: $(fn-haproxy-computed-letsencrypt-server)"
"--haproxy-computed-log-level: $(fn-haproxy-computed-log-level)"
"--haproxy-computed-refresh-conf: $(fn-haproxy-computed-refresh-conf)"
"--haproxy-global-image: $(fn-haproxy-global-image)"
"--haproxy-global-letsencrypt-email: $(fn-haproxy-global-letsencrypt-email)"
"--haproxy-global-letsencrypt-server: $(fn-haproxy-global-letsencrypt-server)"
"--haproxy-global-log-level: $(fn-haproxy-global-log-level)"
"--haproxy-global-refresh-conf: $(fn-haproxy-global-refresh-conf)"
)
fn-report-validate-format "$FORMAT" "$INFO_FLAG"

View File

@@ -68,7 +68,7 @@ trigger-haproxy-vhosts-docker-args-process-deploy() {
fi
done < <(plugn trigger ports-get "$APP")
letsencrypt_email="$(fn-haproxy-letsencrypt-email)"
letsencrypt_email="$(fn-haproxy-computed-letsencrypt-email)"
if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then
proxy_container_https_port_candidate="$proxy_container_http_port_candidate"
proxy_host_https_port_candidate="$proxy_host_http_port_candidate"

View File

@@ -35,33 +35,71 @@ fn-haproxy-template-compose-file() {
COMPOSE_TEMPLATE="$CUSTOM_COMPOSE_TEMPLATE"
fi
local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-image)"
HAPROXY_LOG_LEVEL="$(fn-haproxy-log-level)"
HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-letsencrypt-email)"
HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-letsencrypt-server)"
HAPROXY_REFRESH_CONF="$(fn-haproxy-refresh-conf)")
local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-computed-image)"
HAPROXY_LOG_LEVEL="$(fn-haproxy-computed-log-level)"
HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-computed-letsencrypt-email)"
HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-computed-letsencrypt-server)"
HAPROXY_REFRESH_CONF="$(fn-haproxy-computed-refresh-conf)")
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
}
fn-haproxy-image() {
fn-plugin-property-get-default "haproxy" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/haproxy-vhosts/Dockerfile" | awk '{print $2}')"
fn-haproxy-global-image() {
fn-plugin-property-get-default "haproxy" "--global" "image" ""
}
fn-haproxy-log-level() {
local log_level
log_level="$(fn-plugin-property-get-default "haproxy" "--global" "log-level" "ERROR")"
echo "${log_level^^}"
fn-haproxy-computed-image() {
local value
value="$(fn-haproxy-global-image)"
if [[ -z "$value" ]]; then
value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/haproxy-vhosts/Dockerfile" | awk '{print $2}')"
fi
echo "$value"
}
fn-haproxy-letsencrypt-email() {
fn-haproxy-global-log-level() {
fn-plugin-property-get-default "haproxy" "--global" "log-level" ""
}
fn-haproxy-computed-log-level() {
local value
value="$(fn-haproxy-global-log-level)"
if [[ -z "$value" ]]; then
value="ERROR"
fi
echo "${value^^}"
}
fn-haproxy-global-letsencrypt-email() {
fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-email" ""
}
fn-haproxy-letsencrypt-server() {
fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory"
fn-haproxy-computed-letsencrypt-email() {
fn-haproxy-global-letsencrypt-email
}
fn-haproxy-refresh-conf() {
fn-plugin-property-get-default "haproxy" "--global" "refresh-conf" "10"
fn-haproxy-global-letsencrypt-server() {
fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" ""
}
fn-haproxy-computed-letsencrypt-server() {
local value
value="$(fn-haproxy-global-letsencrypt-server)"
if [[ -z "$value" ]]; then
value="https://acme-v02.api.letsencrypt.org/directory"
fi
echo "$value"
}
fn-haproxy-global-refresh-conf() {
fn-plugin-property-get-default "haproxy" "--global" "refresh-conf" ""
}
fn-haproxy-computed-refresh-conf() {
local value
value="$(fn-haproxy-global-refresh-conf)"
if [[ -z "$value" ]]; then
value="10"
fi
echo "$value"
}

View File

@@ -222,7 +222,7 @@ func writeVectorConfig() error {
data.Sources["docker-global-source"] = vectorSource{
Type: "docker_logs",
IncludeLabels: []string{reportGlobalAppLabelAlias("global")},
IncludeLabels: []string{reportComputedAppLabelAlias("global")},
}
data.Sinks["docker-global-sink"] = sink

View File

@@ -20,23 +20,31 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
"--logs-global-max-size": reportGlobalMaxSize,
"--logs-global-vector-sink": reportGlobalVectorSink,
"--logs-vector-global-image": reportVectorGlobalImage,
"--logs-vector-global-networks": reportVectorGlobalNetworks,
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
"--logs-computed-max-size": reportComputedMaxSize,
"--logs-computed-vector-image": reportComputedVectorImage,
"--logs-computed-vector-networks": reportComputedVectorNetworks,
"--logs-computed-vector-sink": reportComputedVectorSink,
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
"--logs-global-max-size": reportGlobalMaxSize,
"--logs-global-vector-image": reportGlobalVectorImage,
"--logs-global-vector-networks": reportGlobalVectorNetworks,
"--logs-global-vector-sink": reportGlobalVectorSink,
}
} else {
flags = map[string]common.ReportFunc{
"--logs-app-label-alias": reportAppLabelAlias,
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
"--logs-computed-max-size": reportComputedMaxSize,
"--logs-computed-vector-image": reportComputedVectorImage,
"--logs-computed-vector-networks": reportComputedVectorNetworks,
"--logs-computed-vector-sink": reportComputedVectorSink,
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
"--logs-global-max-size": reportGlobalMaxSize,
"--logs-global-vector-image": reportGlobalVectorImage,
"--logs-global-vector-networks": reportGlobalVectorNetworks,
"--logs-global-vector-sink": reportGlobalVectorSink,
"--logs-app-label-alias": reportAppLabelAlias,
"--logs-max-size": reportMaxSize,
"--logs-vector-global-image": reportVectorGlobalImage,
"--logs-vector-global-networks": reportVectorGlobalNetworks,
"--logs-vector-sink": reportVectorSink,
}
}
@@ -57,12 +65,15 @@ func reportComputedAppLabelAlias(appName string) string {
if value == "" {
value = reportGlobalAppLabelAlias(appName)
}
if value == "" {
value = AppLabelAlias
}
return value
}
func reportGlobalAppLabelAlias(appName string) string {
return common.PropertyGetDefault("logs", "--global", "app-label-alias", AppLabelAlias)
return common.PropertyGet("logs", "--global", "app-label-alias")
}
func reportAppLabelAlias(appName string) string {
@@ -74,22 +85,41 @@ func reportComputedMaxSize(appName string) string {
if value == "" {
value = reportGlobalMaxSize(appName)
}
if value == "" {
value = MaxSize
}
return value
}
func reportGlobalMaxSize(appName string) string {
return common.PropertyGetDefault("logs", "--global", "max-size", MaxSize)
return common.PropertyGet("logs", "--global", "max-size")
}
func reportVectorGlobalImage(appName string) string {
func reportGlobalVectorImage(appName string) string {
return common.PropertyGet("logs", "--global", "vector-image")
}
func reportComputedVectorImage(appName string) string {
return getComputedVectorImage()
}
func reportVectorGlobalNetworks(appName string) string {
func reportGlobalVectorNetworks(appName string) string {
return common.PropertyGet("logs", "--global", "vector-networks")
}
func reportComputedVectorNetworks(appName string) string {
return reportGlobalVectorNetworks(appName)
}
func reportComputedVectorSink(appName string) string {
value := reportVectorSink(appName)
if value == "" {
value = reportGlobalVectorSink(appName)
}
return value
}
func reportGlobalVectorSink(appName string) string {
value := common.PropertyGet("logs", "--global", "vector-sink")
if value == "" {

View File

@@ -17,11 +17,16 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{
"--network-global-attach-post-create": reportGlobalAttachPostCreate,
"--network-global-attach-post-deploy": reportGlobalAttachPostDeploy,
"--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces,
"--network-global-initial-network": reportGlobalInitialNetwork,
"--network-global-tld": reportGlobalTld,
"--network-computed-attach-post-create": reportComputedAttachPostCreate,
"--network-computed-attach-post-deploy": reportComputedAttachPostDeploy,
"--network-computed-bind-all-interfaces": reportComputedBindAllInterfaces,
"--network-computed-initial-network": reportComputedInitialNetwork,
"--network-computed-tld": reportComputedTld,
"--network-global-attach-post-create": reportGlobalAttachPostCreate,
"--network-global-attach-post-deploy": reportGlobalAttachPostDeploy,
"--network-global-bind-all-interfaces": reportGlobalBindAllInterfaces,
"--network-global-initial-network": reportGlobalInitialNetwork,
"--network-global-tld": reportGlobalTld,
}
} else {
flags = map[string]common.ReportFunc{
@@ -91,6 +96,9 @@ func reportComputedBindAllInterfaces(appName string) string {
if value == "" {
value = reportGlobalBindAllInterfaces(appName)
}
if value == "" {
value = "false"
}
return value
}
@@ -122,7 +130,7 @@ func reportGlobalAttachPostDeploy(appName string) string {
}
func reportGlobalBindAllInterfaces(appName string) string {
return common.PropertyGetDefault("network", "--global", "bind-all-interfaces", "false")
return common.PropertyGet("network", "--global", "bind-all-interfaces")
}
func reportGlobalInitialNetwork(appName string) string {

View File

@@ -184,9 +184,9 @@ func globalValue(appName string, property string) string {
case "bind-address-ipv6":
value = nginx_vhosts.GlobalBindAddressIPv6()
case "client-body-timeout":
value = nginx_vhosts.ComputedClientBodyTimeout(appName)
value = nginx_vhosts.GlobalClientBodyTimeout()
case "client-header-timeout":
value = nginx_vhosts.ComputedClientHeaderTimeout(appName)
value = nginx_vhosts.GlobalClientHeaderTimeout()
case "client-max-body-size":
value = nginx_vhosts.GlobalClientMaxBodySize()
case "disable-custom-config":
@@ -202,9 +202,9 @@ func globalValue(appName string, property string) string {
case "hsts":
value = nginx_vhosts.GlobalHSTS()
case "keepalive-timeout":
value = nginx_vhosts.ComputedKeepaliveTimeout(appName)
value = nginx_vhosts.GlobalKeepaliveTimeout()
case "lingering-timeout":
value = nginx_vhosts.ComputedLingeringTimeout(appName)
value = nginx_vhosts.GlobalLingeringTimeout()
case "nginx-conf-sigil-path":
value = nginx_vhosts.GlobalNginxConfSigilPath()
case "nginx-service-command":

View File

@@ -13,10 +13,13 @@ func getComputedProxyType(appName string) string {
if proxyType == "" {
proxyType = getGlobalProxyType()
}
if proxyType == "" {
proxyType = "nginx"
}
return proxyType
}
func getGlobalProxyType() string {
return common.PropertyGetDefault("proxy", "--global", "type", "nginx")
return common.PropertyGet("proxy", "--global", "type")
}

View File

@@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{
"--proxy-global-type": reportGlobalType,
"--proxy-computed-type": reportComputedType,
"--proxy-global-type": reportGlobalType,
}
} else {
flags = map[string]common.ReportFunc{
@@ -47,12 +48,7 @@ func reportEnabled(appName string) string {
}
func reportComputedType(appName string) string {
proxyType := getGlobalProxyType()
if proxyType == "" {
proxyType = getAppProxyType(appName)
}
return proxyType
return getComputedProxyType(appName)
}
func reportGlobalType(appName string) string {

View File

@@ -102,12 +102,15 @@ func reportComputedProcfilePath(appName string) string {
if value == "" {
value = reportGlobalProcfilePath(appName)
}
if value == "" {
value = "Procfile"
}
return value
}
func reportGlobalProcfilePath(appName string) string {
return common.PropertyGetDefault("ps", "--global", "procfile-path", "Procfile")
return common.PropertyGet("ps", "--global", "procfile-path")
}
func reportProcfilePath(appName string) string {
@@ -154,14 +157,17 @@ func reportComputedStopTimeoutSeconds(appName string) string {
if value == "" {
value = reportGlobalStopTimeoutSeconds(appName)
}
if value == "" {
value = "30"
}
return value
}
func reportGlobalStopTimeoutSeconds(appName string) string {
return common.PropertyGetDefault("ps", "--global", "stop-timeout-seconds", "30")
return common.PropertyGet("ps", "--global", "stop-timeout-seconds")
}
func reportStopTimeoutSeconds(appName string) string {
return common.PropertyGetDefault("ps", appName, "stop-timeout-seconds", "30")
return common.PropertyGet("ps", appName, "stop-timeout-seconds")
}

View File

@@ -45,6 +45,8 @@ cmd-scheduler-docker-local-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--scheduler-docker-local-computed-init-process: $(fn-scheduler-docker-local-computed-init-process "$APP")"
"--scheduler-docker-local-computed-parallel-schedule-count: $(fn-scheduler-docker-local-computed-parallel-schedule-count "$APP")"
"--scheduler-docker-local-global-init-process: $(fn-scheduler-docker-local-global-init-process "$APP")"
"--scheduler-docker-local-global-parallel-schedule-count: $(fn-scheduler-docker-local-global-parallel-schedule-count "$APP")"
)
@@ -107,12 +109,15 @@ fn-scheduler-docker-local-computed-init-process() {
if [[ -z "$value" ]]; then
value="$(fn-scheduler-docker-local-global-init-process "$APP")"
fi
if [[ -z "$value" ]]; then
value="true"
fi
echo "$value"
}
fn-scheduler-docker-local-global-init-process() {
declare APP="$1"
fn-plugin-property-get-default "scheduler-docker-local" "--global" "init-process" "true"
fn-plugin-property-get-default "scheduler-docker-local" "--global" "init-process" ""
}
fn-scheduler-docker-local-parallel-schedule-count() {
@@ -127,12 +132,15 @@ fn-scheduler-docker-local-computed-parallel-schedule-count() {
if [[ -z "$value" ]]; then
value="$(fn-scheduler-docker-local-global-parallel-schedule-count "$APP")"
fi
if [[ -z "$value" ]]; then
value="1"
fi
echo "$value"
}
fn-scheduler-docker-local-global-parallel-schedule-count() {
declare APP="$1"
fn-plugin-property-get-default "scheduler-docker-local" "--global" "parallel-schedule-count" "1"
fn-plugin-property-get-default "scheduler-docker-local" "--global" "parallel-schedule-count" ""
}
fn-scheduler-docker-local-get-checks-file-path() {

View File

@@ -15,7 +15,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{
"--scheduler-global-selected": reportGlobalSelected,
"--scheduler-computed-selected": reportComputedSelected,
"--scheduler-global-selected": reportGlobalSelected,
}
} else {
flags = map[string]common.ReportFunc{
@@ -41,12 +42,15 @@ func reportComputedSelected(appName string) string {
if value == "" {
value = reportGlobalSelected(appName)
}
if value == "" {
value = "docker-local"
}
return value
}
func reportGlobalSelected(appName string) string {
return common.PropertyGetDefault("scheduler", "--global", "selected", "docker-local")
return common.PropertyGet("scheduler", "--global", "selected")
}
func reportSelected(appName string) string {

View File

@@ -13,7 +13,7 @@ trigger-traefik-vhosts-certs-force() {
return
fi
if [[ -n "$(fn-traefik-letsencrypt-email)" ]]; then
if [[ -n "$(fn-traefik-computed-letsencrypt-email)" ]]; then
echo true
fi
}

View File

@@ -71,21 +71,36 @@ cmd-traefik-report-single() {
verify_app_name "$APP"
fi
local flag_map=(
"--traefik-api-enabled: $(fn-traefik-api-enabled)"
"--traefik-api-entry-point: $(fn-traefik-api-entry-point)"
"--traefik-api-entry-point-address: $(fn-traefik-api-entry-point-address)"
"--traefik-api-vhost: $(fn-traefik-api-vhost)"
"--traefik-basic-auth-password: $(fn-traefik-basic-auth-password)"
"--traefik-basic-auth-username: $(fn-traefik-basic-auth-username)"
"--traefik-challenge-mode: $(fn-traefik-challenge-mode)"
"--traefik-dashboard-enabled: $(fn-traefik-dashboard-enabled)"
"--traefik-dns-provider: $(fn-traefik-dns-provider)"
"--traefik-image: $(fn-traefik-image)"
"--traefik-letsencrypt-email: $(fn-traefik-letsencrypt-email)"
"--traefik-letsencrypt-server: $(fn-traefik-letsencrypt-server)"
"--traefik-log-level: $(fn-traefik-log-level)"
"--traefik-http-entry-point: $(fn-traefik-http-entry-point)"
"--traefik-https-entry-point: $(fn-traefik-https-entry-point)"
"--traefik-computed-api-enabled: $(fn-traefik-computed-api-enabled)"
"--traefik-computed-api-entry-point: $(fn-traefik-computed-api-entry-point)"
"--traefik-computed-api-entry-point-address: $(fn-traefik-computed-api-entry-point-address)"
"--traefik-computed-api-vhost: $(fn-traefik-computed-api-vhost)"
"--traefik-computed-basic-auth-password: $(fn-traefik-computed-basic-auth-password)"
"--traefik-computed-basic-auth-username: $(fn-traefik-computed-basic-auth-username)"
"--traefik-computed-challenge-mode: $(fn-traefik-computed-challenge-mode)"
"--traefik-computed-dashboard-enabled: $(fn-traefik-computed-dashboard-enabled)"
"--traefik-computed-dns-provider: $(fn-traefik-computed-dns-provider)"
"--traefik-computed-http-entry-point: $(fn-traefik-computed-http-entry-point)"
"--traefik-computed-https-entry-point: $(fn-traefik-computed-https-entry-point)"
"--traefik-computed-image: $(fn-traefik-computed-image)"
"--traefik-computed-letsencrypt-email: $(fn-traefik-computed-letsencrypt-email)"
"--traefik-computed-letsencrypt-server: $(fn-traefik-computed-letsencrypt-server)"
"--traefik-computed-log-level: $(fn-traefik-computed-log-level)"
"--traefik-global-api-enabled: $(fn-traefik-global-api-enabled)"
"--traefik-global-api-entry-point: $(fn-traefik-global-api-entry-point)"
"--traefik-global-api-entry-point-address: $(fn-traefik-global-api-entry-point-address)"
"--traefik-global-api-vhost: $(fn-traefik-global-api-vhost)"
"--traefik-global-basic-auth-password: $(fn-traefik-global-basic-auth-password)"
"--traefik-global-basic-auth-username: $(fn-traefik-global-basic-auth-username)"
"--traefik-global-challenge-mode: $(fn-traefik-global-challenge-mode)"
"--traefik-global-dashboard-enabled: $(fn-traefik-global-dashboard-enabled)"
"--traefik-global-dns-provider: $(fn-traefik-global-dns-provider)"
"--traefik-global-http-entry-point: $(fn-traefik-global-http-entry-point)"
"--traefik-global-https-entry-point: $(fn-traefik-global-https-entry-point)"
"--traefik-global-image: $(fn-traefik-global-image)"
"--traefik-global-letsencrypt-email: $(fn-traefik-global-letsencrypt-email)"
"--traefik-global-letsencrypt-server: $(fn-traefik-global-letsencrypt-server)"
"--traefik-global-log-level: $(fn-traefik-global-log-level)"
)
local dns_provider_env_vars

View File

@@ -68,7 +68,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
done < <(plugn trigger ports-get "$APP")
letsencrypt_email="$(fn-traefik-letsencrypt-email)"
letsencrypt_email="$(fn-traefik-computed-letsencrypt-email)"
if [[ -n "$letsencrypt_email" ]] && [[ -z "$proxy_container_https_port" ]]; then
proxy_container_https_port_candidate="$proxy_container_http_port_candidate"
proxy_host_https_port_candidate="$proxy_host_http_port_candidate"
@@ -107,7 +107,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
output="$output --label traefik.http.services.$APP-$PROC_TYPE-http.loadbalancer.server.port=$proxy_container_http_port"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-http-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-computed-http-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.service=$APP-$PROC_TYPE-http"
if [[ -n "$traefik_domains" ]]; then
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-http.rule=$traefik_domains\""
@@ -122,7 +122,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
output="$output --label traefik.http.services.$APP-$PROC_TYPE-https.loadbalancer.server.port=$proxy_container_https_port"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=$(fn-traefik-https-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=$(fn-traefik-computed-https-entry-point)"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.service=$APP-$PROC_TYPE-https"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.tls.certresolver=leresolver"
if [[ -n "$traefik_domains" ]]; then

View File

@@ -36,106 +36,209 @@ fn-traefik-template-compose-file() {
COMPOSE_TEMPLATE="$CUSTOM_COMPOSE_TEMPLATE"
fi
basic_auth_password="$(fn-traefik-basic-auth-password)"
basic_auth_username="$(fn-traefik-basic-auth-username)"
basic_auth_password="$(fn-traefik-computed-basic-auth-password)"
basic_auth_username="$(fn-traefik-computed-basic-auth-username)"
if [[ -n "$basic_auth_password" ]] && [[ -n "$basic_auth_username" ]]; then
basic_auth="$(htpasswd -nb "$basic_auth_username" "$basic_auth_password" | sed -e s/\\$/\\$\\$/g)"
fi
local dns_provider_env_vars=""
local dns_provider
dns_provider="$(fn-traefik-dns-provider)"
dns_provider="$(fn-traefik-computed-dns-provider)"
if [[ -n "$dns_provider" ]]; then
dns_provider_env_vars="$(fn-traefik-dns-provider-env-vars)"
fi
local api_entry_point_address api_entry_point_port=""
api_entry_point_address="$(fn-traefik-api-entry-point-address)"
api_entry_point_address="$(fn-traefik-computed-api-entry-point-address)"
if [[ -n "$api_entry_point_address" ]]; then
api_entry_point_port="${api_entry_point_address##*:}"
fi
local SIGIL_PARAMS=(TRAEFIK_API_ENABLED="$(fn-traefik-api-enabled)"
TRAEFIK_API_ENTRY_POINT="$(fn-traefik-api-entry-point)"
local SIGIL_PARAMS=(TRAEFIK_API_ENABLED="$(fn-traefik-computed-api-enabled)"
TRAEFIK_API_ENTRY_POINT="$(fn-traefik-computed-api-entry-point)"
TRAEFIK_API_ENTRY_POINT_ADDRESS="$api_entry_point_address"
TRAEFIK_API_ENTRY_POINT_PORT="$api_entry_point_port"
TRAEFIK_API_VHOST="$(fn-traefik-api-vhost)"
TRAEFIK_API_VHOST="$(fn-traefik-computed-api-vhost)"
TRAEFIK_BASIC_AUTH="$basic_auth"
TRAEFIK_CHALLENGE_MODE="$(fn-traefik-challenge-mode)"
TRAEFIK_DASHBOARD_ENABLED="$(fn-traefik-dashboard-enabled)"
TRAEFIK_CHALLENGE_MODE="$(fn-traefik-computed-challenge-mode)"
TRAEFIK_DASHBOARD_ENABLED="$(fn-traefik-computed-dashboard-enabled)"
TRAEFIK_DATA_DIR="${DOKKU_LIB_ROOT}/data/traefik"
TRAEFIK_DNS_PROVIDER="$dns_provider"
TRAEFIK_DNS_PROVIDER_ENV_VARS="$dns_provider_env_vars"
TRAEFIK_IMAGE="$(fn-traefik-image)"
TRAEFIK_LETSENCRYPT_EMAIL="$(fn-traefik-letsencrypt-email)"
TRAEFIK_LETSENCRYPT_SERVER="$(fn-traefik-letsencrypt-server)"
TRAEFIK_LOG_LEVEL="$(fn-traefik-log-level)")
TRAEFIK_IMAGE="$(fn-traefik-computed-image)"
TRAEFIK_LETSENCRYPT_EMAIL="$(fn-traefik-computed-letsencrypt-email)"
TRAEFIK_LETSENCRYPT_SERVER="$(fn-traefik-computed-letsencrypt-server)"
TRAEFIK_LOG_LEVEL="$(fn-traefik-computed-log-level)")
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
}
fn-traefik-api-enabled() {
fn-plugin-property-get-default "traefik" "--global" "api-enabled" "false"
fn-traefik-global-api-enabled() {
fn-plugin-property-get-default "traefik" "--global" "api-enabled" ""
}
fn-traefik-api-vhost() {
fn-plugin-property-get-default "traefik" "--global" "api-vhost" "traefik.dokku.me"
fn-traefik-computed-api-enabled() {
local value
value="$(fn-traefik-global-api-enabled)"
if [[ -z "$value" ]]; then
value="false"
fi
echo "$value"
}
fn-traefik-basic-auth-password() {
fn-traefik-global-api-vhost() {
fn-plugin-property-get-default "traefik" "--global" "api-vhost" ""
}
fn-traefik-computed-api-vhost() {
local value
value="$(fn-traefik-global-api-vhost)"
if [[ -z "$value" ]]; then
value="traefik.dokku.me"
fi
echo "$value"
}
fn-traefik-global-basic-auth-password() {
fn-plugin-property-get-default "traefik" "--global" "basic-auth-password" ""
}
fn-traefik-basic-auth-username() {
fn-traefik-computed-basic-auth-password() {
fn-traefik-global-basic-auth-password
}
fn-traefik-global-basic-auth-username() {
fn-plugin-property-get-default "traefik" "--global" "basic-auth-username" ""
}
fn-traefik-dashboard-enabled() {
fn-plugin-property-get-default "traefik" "--global" "dashboard-enabled" "false"
fn-traefik-computed-basic-auth-username() {
fn-traefik-global-basic-auth-username
}
fn-traefik-image() {
fn-plugin-property-get-default "traefik" "--global" "image" "$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/Dockerfile" | awk '{print $2}')"
fn-traefik-global-dashboard-enabled() {
fn-plugin-property-get-default "traefik" "--global" "dashboard-enabled" ""
}
fn-traefik-letsencrypt-email() {
fn-traefik-computed-dashboard-enabled() {
local value
value="$(fn-traefik-global-dashboard-enabled)"
if [[ -z "$value" ]]; then
value="false"
fi
echo "$value"
}
fn-traefik-global-image() {
fn-plugin-property-get-default "traefik" "--global" "image" ""
}
fn-traefik-computed-image() {
local value
value="$(fn-traefik-global-image)"
if [[ -z "$value" ]]; then
value="$(grep "FROM" "$PLUGIN_AVAILABLE_PATH/traefik-vhosts/Dockerfile" | awk '{print $2}')"
fi
echo "$value"
}
fn-traefik-global-letsencrypt-email() {
fn-plugin-property-get-default "traefik" "--global" "letsencrypt-email" ""
}
fn-traefik-letsencrypt-server() {
fn-plugin-property-get-default "traefik" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory"
fn-traefik-computed-letsencrypt-email() {
fn-traefik-global-letsencrypt-email
}
fn-traefik-log-level() {
local log_level
log_level="$(fn-plugin-property-get-default "traefik" "--global" "log-level" "ERROR")"
echo "${log_level^^}"
fn-traefik-global-letsencrypt-server() {
fn-plugin-property-get-default "traefik" "--global" "letsencrypt-server" ""
}
fn-traefik-http-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "http-entry-point" "http"
fn-traefik-computed-letsencrypt-server() {
local value
value="$(fn-traefik-global-letsencrypt-server)"
if [[ -z "$value" ]]; then
value="https://acme-v02.api.letsencrypt.org/directory"
fi
echo "$value"
}
fn-traefik-https-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "https-entry-point" "https"
fn-traefik-global-log-level() {
fn-plugin-property-get-default "traefik" "--global" "log-level" ""
}
fn-traefik-api-entry-point() {
fn-traefik-computed-log-level() {
local value
value="$(fn-traefik-global-log-level)"
if [[ -z "$value" ]]; then
value="ERROR"
fi
echo "${value^^}"
}
fn-traefik-global-http-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "http-entry-point" ""
}
fn-traefik-computed-http-entry-point() {
local value
value="$(fn-traefik-global-http-entry-point)"
if [[ -z "$value" ]]; then
value="http"
fi
echo "$value"
}
fn-traefik-global-https-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "https-entry-point" ""
}
fn-traefik-computed-https-entry-point() {
local value
value="$(fn-traefik-global-https-entry-point)"
if [[ -z "$value" ]]; then
value="https"
fi
echo "$value"
}
fn-traefik-global-api-entry-point() {
fn-plugin-property-get-default "traefik" "--global" "api-entry-point" ""
}
fn-traefik-api-entry-point-address() {
fn-traefik-computed-api-entry-point() {
fn-traefik-global-api-entry-point
}
fn-traefik-global-api-entry-point-address() {
fn-plugin-property-get-default "traefik" "--global" "api-entry-point-address" ""
}
fn-traefik-challenge-mode() {
fn-plugin-property-get-default "traefik" "--global" "challenge-mode" "tls"
fn-traefik-computed-api-entry-point-address() {
fn-traefik-global-api-entry-point-address
}
fn-traefik-dns-provider() {
fn-traefik-global-challenge-mode() {
fn-plugin-property-get-default "traefik" "--global" "challenge-mode" ""
}
fn-traefik-computed-challenge-mode() {
local value
value="$(fn-traefik-global-challenge-mode)"
if [[ -z "$value" ]]; then
value="tls"
fi
echo "$value"
}
fn-traefik-global-dns-provider() {
fn-plugin-property-get-default "traefik" "--global" "dns-provider" ""
}
fn-traefik-computed-dns-provider() {
fn-traefik-global-dns-provider
}
fn-traefik-dns-provider-env-vars() {
declare desc="returns all dns-provider-* environment variables"
fn-plugin-property-get-all-by-prefix "traefik" "--global" "dns-provider-"