Merge branch 'master' into fix/ignore-cache-directories-when-clone

This commit is contained in:
Kohki YAMAGIWA
2019-02-04 00:30:58 +09:00
committed by GitHub
99 changed files with 415 additions and 280 deletions

View File

@@ -43,7 +43,7 @@ ExecStart=$dokku_path ps:restore
WantedBy=docker.service
EOF
if command -v systemctl &>/dev/null; then
systemctl reenable dokku-redeploy
systemctl --quiet reenable dokku-redeploy
fi
fi

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core standard plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -10,7 +10,7 @@ get_phase_script() {
declare IMAGE_TAG="$1" PHASE_SCRIPT_KEY="$2"
local GET_PHASE_SCRIPT_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_get_phase_script.XXXX")
local APP_JSON_FILE="$GET_PHASE_SCRIPT_TMP_WORK_DIR/app.json"
trap 'rm -rf "$GET_PHASE_SCRIPT_TMP_WORK_DIR" > /dev/null' RETURN INT TERM
trap 'rm -rf "$GET_PHASE_SCRIPT_TMP_WORK_DIR" >/dev/null' RETURN INT TERM
copy_from_image "$IMAGE" "app.json" "$GET_PHASE_SCRIPT_TMP_WORK_DIR" 2>/dev/null || true
@@ -68,14 +68,14 @@ execute_script() {
COMMAND+=" if [[ ! -x \"$SCRIPT_BIN\" ]]; then "
COMMAND+=" echo specified binary is not executable ; "
COMMAND+=" exit 1 ; "
COMMAND+=" fi "
COMMAND+=" fi ; "
fi
COMMAND+=" $SCRIPT_CMD || exit 1;"
COMMAND+=" if [[ -d '/cache' ]]; then "
COMMAND+=" echo removing installation cache... ; "
COMMAND+=" rm -f /tmp/cache ; "
COMMAND+=" fi "
COMMAND+=" fi ; "
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
local CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$APP/cache"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core app-json plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core apps plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -44,7 +44,7 @@ certs_set() {
elif is_tar_import; then
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs_set.XXXX")
pushd "$CERTS_SET_TMP_WORK_DIR" &>/dev/null
trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN
trap 'popd &>/dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR >/dev/null' RETURN
tar xvf - <&0
local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f | grep ".crt$")

View File

@@ -15,7 +15,7 @@ certs_generate_cmd() {
if [[ ! -f "$APP_SSL_PATH/server.key" ]] && [[ ! -f "$APP_SSL_PATH/server.crt" ]]; then
local CERTS_GENERATE_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs.XXXXXXXXX")
pushd "$CERTS_GENERATE_TMP_WORK_DIR" >/dev/null
trap 'popd &> /dev/null || true; rm -rf "$CERTS_GENERATE_TMP_WORK_DIR" > /dev/null' INT TERM EXIT
trap 'popd &>/dev/null || true; rm -rf "$CERTS_GENERATE_TMP_WORK_DIR" >/dev/null' INT TERM EXIT
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr

View File

@@ -12,15 +12,14 @@ migrate_checks_vars_0_5_0() {
local app
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"
for app in $APPS; do
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)"
config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
@@ -34,23 +33,19 @@ migrate_checks_vars_0_5_0() {
dokku_log_info1 "Removing global zero downtime settings"
config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
fi
dokku_log_info2 "Migration complete"
dokku_log_info2 ""
}
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"
local APPS="$(dokku_apps)"
local app
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"
for app in $APPS; 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 [[ "$APP_DOKKU_CHECKS_ENABLED" == "0" ]]; then
dokku_log_info2 ""
dokku_log_info2 "zero downtime checks disabled for app ($app)"
@@ -59,8 +54,7 @@ migrate_checks_vars_0_6_0() {
config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
fi
done
dokku_log_info2 "Migration complete"
dokku_log_info2 ""
}
migrate_checks_vars_0_5_0 "$@"
migrate_checks_vars_0_6_0 "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core checks plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -168,7 +168,7 @@ dokku_container_log_verbose_quiet() {
is_valid_app_name() {
declare desc="verify app name format"
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "APP must not be null"
[[ -z "$APP" ]] && dokku_log_fail "APP must not be null"
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
return 0
@@ -1049,7 +1049,7 @@ suppress_output() {
declare desc="suppress all output from a given command unless there is an error"
local TMP_COMMAND_OUTPUT
TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf "$TMP_COMMAND_OUTPUT" >/dev/null' RETURN INT TERM EXIT
"$@" >"$TMP_COMMAND_OUTPUT" 2>&1 || {
local exit_code="$?"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core common plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -9,7 +9,7 @@ build-in-docker: clean
-v $$PWD/../..:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT)/plugins/config \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
build: commands subcommands

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core config plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config"
columnize "github.com/ryanuber/columnize"
)
@@ -43,10 +44,18 @@ func main() {
merged := args.Bool("merged", false, "--merged: display the app's environment merged with the global environment")
args.Parse(os.Args[2:])
config.CommandShow(args.Args(), *global, *shell, *export, *merged)
case "help":
fmt.Print("\n config, Manages global and app-specific config vars\n")
case "config:help":
usage()
case "help":
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
command.ShowOutput = false
output, err := command.Output()
if err == nil && strings.Contains(string(output), "--all") {
fmt.Println(helpContent)
} else {
fmt.Print("\n config, Manages global and app-specific config vars\n")
}
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
if err != nil {
@@ -58,11 +67,11 @@ func main() {
}
func usage() {
fmt.Println(helpHeader)
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

View File

@@ -32,7 +32,7 @@ docker_args() {
local line
read -r line || local DONE=true
[[ ! -n "$line" ]] && continue
[[ -z "$line" ]] && continue
# shellcheck disable=SC1001
case "$line" in

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -248,7 +248,7 @@ get_default_vhosts() {
if ! ([[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]]); then
local SUBDOMAIN=${APP/%\.${VHOST}/}
local hostname=$(: | plugn trigger nginx-hostname "$APP" "$SUBDOMAIN" "$VHOST")
if [[ ! -n $hostname ]]; then
if [[ -z $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
local hostname="${APP/\//-}"
else

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core domains plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core enter plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -25,7 +25,7 @@ enter_default_cmd() {
if [[ "$3" == "--container-id" ]]; then
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP"))
if [[ ! -n "$4" ]]; then
if [[ -z "$4" ]]; then
dokku_log_warn "No container id specified."
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[*]}"
fi
@@ -38,7 +38,7 @@ enter_default_cmd() {
else
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP" "$CONTAINER_TYPE"))
local ID=${DOKKU_APP_CIDS[0]}
if [[ ! -n $ID ]]; then
if [[ -z $ID ]]; then
dokku_log_warn "No containers found for type '$CONTAINER_TYPE'"
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[*]}"
fi

View File

@@ -32,7 +32,7 @@ git_build_app_repo() {
# clean up after ourselves
local GIT_BUILD_APP_REPO_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_git.XXXX")
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" >/dev/null' RETURN INT TERM EXIT
local TMP_TAG="dokku/$REV"
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core git plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core logs plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -9,9 +9,10 @@ build-in-docker: clean
-v $$PWD/../..:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT)/plugins/network \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
build: commands subcommands triggers triggers-copy
build: commands subcommands triggers
$(MAKE) triggers-copy
commands: **/**/commands.go
go build $(GO_ARGS) -o commands src/commands/commands.go

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core network plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
columnize "github.com/ryanuber/columnize"
)
@@ -34,7 +35,15 @@ func main() {
case "network", "network:help":
usage()
case "help":
fmt.Print("\n network, Manages network settings for an app\n")
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
command.ShowOutput = false
output, err := command.Output()
if err == nil && strings.Contains(string(output), "--all") {
fmt.Println(helpContent)
} else {
fmt.Print("\n network, Manages network settings for an app\n")
}
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
if err != nil {
@@ -46,11 +55,11 @@ func main() {
}
func usage() {
fmt.Println(helpHeader)
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

View File

@@ -23,12 +23,17 @@ nginx_needs_upgrade() {
echo $NEEDS_UPGRADE
}
nginx_install() {
declare desc="install nginx and dnsutils"
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
}
nginx_dependencies() {
declare desc="installs dependencies for the nginx-vhosts plugin"
case "$DOKKU_DISTRO" in
debian)
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
nginx_install
;;
ubuntu)
@@ -38,17 +43,22 @@ nginx_dependencies() {
return
fi
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
if ! which nginx >/dev/null 2>&1; then
nginx_install
return
fi
ubuntu_year=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[1]}')
ubuntu_month=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[2]}')
[[ "$ubuntu_year" -ge "16" ]] && exit 0
[[ "$ubuntu_year" -eq "15" ]] && [[ "$ubuntu_month" -eq "10" ]] && exit 0
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
add-apt-repository -y ppa:nginx/stable
apt-get update -qq >/dev/null
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
nginx_install
;;
opensuse)

View File

@@ -304,7 +304,7 @@ nginx_build_config() {
local NGINX_CONF=$(mktemp --tmpdir="${NGINX_BUILD_CONFIG_TMP_WORK_DIR}" "nginx.conf.XXXXXX")
local CUSTOM_NGINX_TEMPLATE="$NGINX_BUILD_CONFIG_TMP_WORK_DIR/$NGINX_TEMPLATE_NAME"
# shellcheck disable=SC2086
trap 'rm -rf $NGINX_CONF $NGINX_BUILD_CONFIG_TMP_WORK_DIR > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf $NGINX_CONF $NGINX_BUILD_CONFIG_TMP_WORK_DIR >/dev/null' RETURN INT TERM EXIT
get_custom_nginx_template "$APP" "$CUSTOM_NGINX_TEMPLATE" 2>/dev/null
if [[ -f "$CUSTOM_NGINX_TEMPLATE" ]]; then

View File

@@ -59,7 +59,7 @@ fi
# revert dokku group changes
gpasswd -a dokku adm
chgrp -R adm /var/log/nginx
chgrp --quiet -R adm /var/log/nginx
gpasswd -M "$(egrep ^dokku: /etc/group | awk -F ":" '{ print $4 }')" dokku
[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/create 0640 www-data dokku/create 0640 www-data adm/g' /etc/logrotate.d/nginx
@@ -73,12 +73,14 @@ cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/500-error.html" "${DOKK
[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/invoke-rc.d/service/g' /etc/logrotate.d/nginx
# @TODO: Remove this after a few versions
dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated"
dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT"
dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT"
for app in $(dokku_apps); do
nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)"
nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)"
if [[ -n "$nginx_port" ]] || [[ -n "$nginx_ssl_port" ]]; then
dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated"
dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT"
dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT"
fi
if [[ -n "$nginx_port" ]]; then
dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app"
config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port"
@@ -90,7 +92,6 @@ for app in $(dokku_apps); do
config_unset --no-restart "$app" DOKKU_NGINX_SSL_PORT
fi
done
dokku_log_info2 "Migration complete"
case "$DOKKU_DISTRO" in
debian)

View File

@@ -28,7 +28,7 @@ nginx_vhosts_is_valid_nginx_config_func() {
declare APP="$1"
local VALIDATE_TEMPLATE="$PLUGIN_AVAILABLE_PATH/nginx-vhosts/templates/validate.conf.sigil"
local TMP_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
trap 'rm -rf "$TMP_OUTPUT" > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf "$TMP_OUTPUT" >/dev/null' RETURN INT TERM EXIT
sigil -f "$VALIDATE_TEMPLATE" NGINX_CONF="$DOKKU_ROOT/$APP/nginx.conf" | cat -s >"$TMP_OUTPUT"
sudo "$NGINX_LOCATION" -t -c "$TMP_OUTPUT" 2>/dev/null

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core plugin plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core proxy plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -69,7 +69,7 @@ generate_scale_file() {
dokku_log_info1_quiet "DOKKU_SCALE file not found in app image. Generating one based on Procfile..."
local GENERATE_SCALE_FILE_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_scale.XXXX")
trap 'rm -rf "$GENERATE_SCALE_FILE_TMP_WORK_DIR" > /dev/null' RETURN
trap 'rm -rf "$GENERATE_SCALE_FILE_TMP_WORK_DIR" >/dev/null' RETURN
if [[ -f $DOKKU_PROCFILE ]]; then
while read -r line || [[ -n "$line" ]]; do

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ps plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -9,7 +9,7 @@ build-in-docker: clean
-v $$PWD/../..:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT)/plugins/repo \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
build: commands subcommands

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core repo plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
columnize "github.com/ryanuber/columnize"
)
@@ -32,7 +33,15 @@ func main() {
case "repo", "repo:help":
usage()
case "help":
fmt.Print("\n repo, Runs commands that interact with the app's repo\n")
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
command.ShowOutput = false
output, err := command.Output()
if err == nil && strings.Contains(string(output), "--all") {
fmt.Println(helpContent)
} else {
fmt.Print("\n repo, Runs commands that interact with the app's repo\n")
}
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
if err != nil {
@@ -44,11 +53,11 @@ func main() {
}
func usage() {
fmt.Println(helpHeader)
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

View File

@@ -121,6 +121,7 @@ scheduler-docker-local-check-deploy() {
! (is_container_status "$DOKKU_APP_CONTAINER_ID" "Running") && dokku_log_fail "App container failed to start!!"
local container_restarts="$(docker inspect -f "{{ .RestartCount }}" "$DOKKU_APP_CONTAINER_ID")"
if [[ $container_restarts -ne 0 ]]; then
docker container update --restart=no "$DOKKU_APP_CONTAINER_ID" &>/dev/null || true
docker stop "$DOKKU_APP_CONTAINER_ID" || true
dokku_log_fail "App container failed to start!!"
fi

View File

@@ -40,7 +40,7 @@ Description=Run dokku-retire.service every 5 minutes
OnCalendar=*:0/5
EOF
if command -v systemctl &>/dev/null; then
systemctl reenable dokku-redeploy
systemctl --quiet reenable dokku-retire
fi
else
cat <<EOF >/etc/cron.d/dokku-retire

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core scheduler-docker-local plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -48,6 +48,10 @@ scheduler-docker-local-scheduler-deploy() {
local cid proctype_oldids="$(get_app_running_container_ids "$APP" "$PROC_TYPE")"
for cid in $proctype_oldids; do
dokku_log_info2 "stopping $APP.$PROC_TYPE ($cid)"
# Disable the container restart policy
docker container update --restart=no "$cid" &>/dev/null || true
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$cid" &>/dev/null
# remove cid from oldids to skip the old container finish processing
@@ -107,7 +111,11 @@ scheduler-docker-local-scheduler-deploy() {
declare CID="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
echo "${CID} ${PROC_TYPE}.${CONTAINER_INDEX}" >>"${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
docker inspect "$CID" &>/dev/null && docker stop "$CID" >/dev/null && docker kill "$CID" &>/dev/null
docker inspect "$CID" &>/dev/null && {
# Disable the container restart policy
docker container update --restart=no "$CID" &>/dev/null || true
docker stop "$CID" >/dev/null && docker kill "$CID" &>/dev/null
}
trap - INT TERM EXIT
kill -9 $$
}
@@ -169,6 +177,9 @@ scheduler-docker-local-scheduler-deploy() {
trap '' INT HUP
sleep "$WAIT"
for oldid in $oldids; do
# Disable the container restart policy
docker container update --restart=no "$oldid" &>/dev/null || true
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.

View File

@@ -14,7 +14,7 @@ scheduler-docker-local-scheduler-inspect() {
fi
local TMP_INSPECT_CMD=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
trap 'rm -rf "$TMP_INSPECT_CMD" > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf "$TMP_INSPECT_CMD" >/dev/null' RETURN INT TERM EXIT
cat >"$TMP_INSPECT_CMD" <<EOF
import json
import sys

View File

@@ -46,7 +46,7 @@ scheduler-docker-local-scheduler-run() {
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" || echo '')
remove_procfile "$APP"
if [ ! -z "$PROC_CMD" ]; then
if [[ -n "$PROC_CMD" ]]; then
dokku_log_info1 "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
set -- "$PROC_CMD" "${@:2}"
fi

View File

@@ -19,6 +19,10 @@ scheduler-docker-local-scheduler-stop() {
[[ -n "$DOKKU_DOCKER_STOP_TIMEOUT" ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
# Disable the container restart policy
# shellcheck disable=SC2086
docker container update --restart=no $DOKKU_APP_RUNNING_CONTAINER_IDS &>/dev/null || true
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS >/dev/null || true
fi

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core shell plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ssh-keys plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core storage plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core tags plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]

View File

@@ -12,7 +12,7 @@ tar_build() {
# clean up after ourselves
local TAR_BUILD_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_tar.XXXX")
trap 'rm -rf "$TAR_BUILD_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
trap 'rm -rf "$TAR_BUILD_TMP_WORK_DIR" >/dev/null' RETURN INT TERM EXIT
# extract tar file
chmod 755 "$TAR_BUILD_TMP_WORK_DIR"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core tar plugin"
version = "0.14.2"
version = "0.14.5"
[plugin.config]