Merge branch 'master' into feature-run-env
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core standard plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -17,7 +17,7 @@ dokku_report_cmd() {
|
||||
docker -D info | sed "s/^/ /"
|
||||
dokku_log_info1 "sigil version: $(sigil -v)"
|
||||
dokku_log_info1 "herokuish version: "
|
||||
docker run --rm gliderlabs/herokuish:latest herokuish version | sed "s/^/ /"
|
||||
docker run --rm "$DOKKU_IMAGE" herokuish version | sed "s/^/ /"
|
||||
dokku_log_info1 "dokku version: $(dokku version)"
|
||||
dokku_log_info1 "dokku plugins: "
|
||||
dokku plugin:list | sed "s/^/ /"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core events logging plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -85,7 +85,7 @@ execute_script() {
|
||||
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
is_image_herokuish_based "$IMAGE" && IMAGE_SOURCE_TYPE="herokuish"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE")
|
||||
|
||||
# eval args as array to respect escapes
|
||||
declare -a ARG_ARRAY
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core app-json plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -85,6 +85,7 @@ apps_help_content_func() {
|
||||
apps:clone <old-app> <new-app>, Clones an app
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
apps:exists <app>, Checks if an app exists
|
||||
apps:list, List your apps
|
||||
apps:lock <app>, Locks an app for deployment
|
||||
apps:locked <app>, Checks if an app is locked for deployment
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core apps plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core build-env plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core buildpacks plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core certificate management plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core checks plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -291,6 +291,10 @@ is_image_herokuish_based() {
|
||||
declare IMAGE="$1"
|
||||
local USER_VALUE
|
||||
|
||||
if [[ -z "$IMAGE" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# due to how the build process works, all herokuish images have the Environment variable USER=herokuishuser
|
||||
USER_VALUE="$(docker inspect -f '{{range .Config.Env}}{{if eq . "USER=herokuishuser" }}{{println .}}{{end}}{{end}}' "$IMAGE")"
|
||||
[[ "$USER_VALUE" == "" ]] && return 1
|
||||
@@ -380,7 +384,10 @@ copy_from_image() {
|
||||
fi
|
||||
fi
|
||||
local CID=$(docker create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE")
|
||||
docker cp "$CID:$SRC_FILE" "$DST_DIR"
|
||||
if ! docker cp "$CID:$SRC_FILE" "$DST_DIR"; then
|
||||
docker rm -f "$CID" &>/dev/null
|
||||
return 1
|
||||
fi
|
||||
docker rm -f "$CID" &>/dev/null
|
||||
else
|
||||
return 1
|
||||
@@ -450,14 +457,10 @@ get_app_running_container_types() {
|
||||
is_deployed() {
|
||||
declare desc="return 0 if given app has a running container"
|
||||
local APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(
|
||||
ls "$DOKKU_ROOT/$APP"/CONTAINER.* &>/dev/null
|
||||
echo $?
|
||||
) -eq 0 ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||
plugn trigger scheduler-is-deployed "$DOKKU_SCHEDULER" "$APP"
|
||||
}
|
||||
|
||||
is_container_running() {
|
||||
@@ -535,7 +538,7 @@ dokku_build() {
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
local IMAGE_SOURCE_TYPE="herokuish"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE")
|
||||
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
@@ -563,7 +566,7 @@ dokku_build() {
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE")
|
||||
|
||||
# strip --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core common plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core config plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core docker-options plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -176,6 +176,14 @@ domains_add_global() {
|
||||
done
|
||||
}
|
||||
|
||||
domains_clear_global() {
|
||||
declare desc="remove all domains"
|
||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
|
||||
rm "$GLOBAL_VHOST_PATH"
|
||||
touch "$GLOBAL_VHOST_PATH"
|
||||
}
|
||||
|
||||
domains_remove_global() {
|
||||
declare desc="remove list of domains"
|
||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||
@@ -249,7 +257,7 @@ get_default_vhosts() {
|
||||
local SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
local hostname=$(: | plugn trigger nginx-hostname "$APP" "$SUBDOMAIN" "$VHOST")
|
||||
if [[ -z $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
if [[ "$APP" == *.* ]]; then
|
||||
local hostname="${APP/\//-}"
|
||||
else
|
||||
local hostname="${APP/\//-}.$VHOST"
|
||||
|
||||
@@ -44,13 +44,13 @@ cmd-domains-report-single() {
|
||||
verify_app_name "$APP"
|
||||
app_flags=(
|
||||
"--domains-app-enabled: $(fn-domains-app-enabled "$APP")"
|
||||
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")"
|
||||
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP" | awk '{$1=$1};1')"
|
||||
)
|
||||
fi
|
||||
|
||||
global_flags=(
|
||||
"--domains-global-enabled: $(fn-domains-global-enabled)"
|
||||
"--domains-global-vhosts: $(fn-domains-global-vhosts)"
|
||||
"--domains-global-vhosts: $(fn-domains-global-vhosts | awk '{$1=$1};1')"
|
||||
)
|
||||
|
||||
flag_map=("${app_flags[@]}" "${global_flags[@]}")
|
||||
@@ -91,6 +91,7 @@ domains_help_content_func() {
|
||||
domains:add <app> <domain> [<domain> ...], Add domains to app
|
||||
domains:add-global <domain> [<domain> ...], Add global domain names
|
||||
domains:clear <app>, Clear all domains for app
|
||||
domains:clear-global, Clear global domain names
|
||||
domains:disable <app>, Disable VHOST support
|
||||
domains:enable <app>, Enable VHOST support
|
||||
domains:remove <app> <domain> [<domain> ...], Remove domains from app
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core domains plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
15
plugins/domains/subcommands/clear-global
Executable file
15
plugins/domains/subcommands/clear-global
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
domains_clear_global_cmd() {
|
||||
declare desc="clear global domain names via command line"
|
||||
local cmd="domains:clear-global"
|
||||
shift 1
|
||||
|
||||
domains_clear_global "$@"
|
||||
}
|
||||
|
||||
domains_add_global_cmd "$@"
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core enter plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core git plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core logs plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core network plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core nginx-vhosts plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
20
plugins/nginx-vhosts/subcommands/show-conf
Executable file
20
plugins/nginx-vhosts/subcommands/show-conf
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
nginx_show_conf_cmd() {
|
||||
declare desc="display app nginx conf"
|
||||
declare cmd="nginx:show-conf" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
dokku_log_fail "No nginx.conf exists for $APP"
|
||||
fi
|
||||
|
||||
cat "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
}
|
||||
|
||||
nginx_show_conf_cmd "$@"
|
||||
@@ -26,7 +26,7 @@ server {
|
||||
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
|
||||
@@ -8,13 +8,14 @@ case "$1" in
|
||||
help_content_func() {
|
||||
declare desc="return plugin plugin help content"
|
||||
cat <<help_content
|
||||
plugin:list, Print active plugins
|
||||
plugin:disable <name>, Disable an installed plugin (third-party only)
|
||||
plugin:enable <name>, Enable a previously disabled plugin
|
||||
plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]], Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones)
|
||||
plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones)
|
||||
plugin:update [name [committish]], Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins
|
||||
plugin:enable <name>, Enable a previously disabled plugin
|
||||
plugin:disable <name>, Disable an installed plugin (third-party only)
|
||||
plugin:list, Print active plugins
|
||||
plugin:trigger <args...>, Trigger an arbitrary plugin hook
|
||||
plugin:uninstall <name>, Uninstall a plugin (third-party only)
|
||||
plugin:update [name [committish]], Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins
|
||||
help_content
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core plugin plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
13
plugins/plugin/subcommands/trigger
Executable file
13
plugins/plugin/subcommands/trigger
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
plugin_trigger_cmd() {
|
||||
declare desc="trigger an arbitrary plugin hook"
|
||||
local cmd="plugin:trigger"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
plugn trigger "$@"
|
||||
}
|
||||
|
||||
plugin_trigger_cmd "$@"
|
||||
@@ -80,12 +80,13 @@ proxy_help_content_func() {
|
||||
declare desc="return proxy plugin help content"
|
||||
cat <<help_content
|
||||
proxy <app>, [DEPRECATED] Show proxy settings for app
|
||||
proxy:enable <app>, Enable proxy for app
|
||||
proxy:disable <app>, Disable proxy for app
|
||||
proxy:enable <app>, Enable proxy for app
|
||||
proxy:ports <app>, List proxy port mappings for app
|
||||
proxy:ports-clear <app>, Clear all proxy port mappings for app
|
||||
proxy:ports-add <app> <scheme>:<host-port>:<container-port> [<scheme>:<host-port>:<container-port>...], Set proxy port mappings for app
|
||||
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...], Unset proxy port mappings for app
|
||||
proxy:ports-add <app> [<scheme>:<host-port>:<container-port>...], Add proxy port mappings to an app
|
||||
proxy:ports-clear <app>, Clear all proxy port mappings for an app
|
||||
proxy:ports-remove <app> [<host-port>|<scheme>:<host-port>:<container-port>...], Remove specific proxy port mappings from an app
|
||||
proxy:ports-set <app> [<scheme>:<host-port>:<container-port>...], Set proxy port mappings for an app
|
||||
proxy:report [<app>] [<flag>], Displays a proxy report for one or more apps
|
||||
proxy:set <app> <proxy-type>, Set proxy type for app
|
||||
help_content
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core proxy plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
proxy_ports_add_cmd() {
|
||||
declare desc="add proxy port mappings from an app"
|
||||
declare desc="add proxy port mappings to an app"
|
||||
local cmd="proxy:add"
|
||||
local APP="$2"
|
||||
verify_app_name "$APP"
|
||||
|
||||
@@ -5,14 +5,14 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
proxy_ports_set_cmd() {
|
||||
declare desc="add proxy port mappings from an app"
|
||||
local cmd="proxy:add"
|
||||
declare desc="set proxy port mappings for an app"
|
||||
local cmd="proxy:set"
|
||||
local APP="$2"
|
||||
verify_app_name "$APP"
|
||||
shift 2
|
||||
|
||||
set_proxy_ports "$APP" "$@"
|
||||
plugn trigger post-proxy-ports-update "$APP" "add"
|
||||
plugn trigger post-proxy-ports-update "$APP" "set"
|
||||
}
|
||||
|
||||
proxy_ports_set_cmd "$@"
|
||||
|
||||
@@ -62,7 +62,12 @@ generate_scale_file() {
|
||||
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||
verify_app_name "$APP"
|
||||
|
||||
copy_from_image "$IMAGE" "DOKKU_SCALE" "$DOKKU_ROOT/$APP" 2>/dev/null || true
|
||||
if copy_from_image "$IMAGE" "DOKKU_SCALE" "$DOKKU_ROOT/$APP" >/dev/null 2>&1; then
|
||||
cp "$DOKKU_SCALE_FILE" "${DOKKU_SCALE_FILE}.extracted"
|
||||
else
|
||||
rm -f "${DOKKU_SCALE_FILE}.extracted"
|
||||
fi
|
||||
|
||||
if [[ ! -f $DOKKU_SCALE_FILE ]]; then
|
||||
dokku_log_info1_quiet "DOKKU_SCALE file not found in app image. Generating one based on Procfile..."
|
||||
|
||||
@@ -182,20 +187,24 @@ ps_scale() {
|
||||
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||
shift 1
|
||||
|
||||
[[ ! -e $DOKKU_SCALE_FILE ]] && generate_scale_file "$APP" "$IMAGE_TAG"
|
||||
[[ ! -e $DOKKU_SCALE_FILE ]] && generate_scale_file "$APP" "$IMAGE_TAG" >/dev/null 2>&1
|
||||
if [[ -z "$@" ]]; then
|
||||
dokku_log_info1_quiet "Scaling for $APP"
|
||||
dokku_col_log_info1_quiet "proctype" "qty"
|
||||
dokku_col_log_info1_quiet "--------" "---"
|
||||
dokku_col_log_msg_quiet "proctype" "qty"
|
||||
dokku_col_log_msg_quiet "--------" "---"
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ -z "$line" ]] && continue
|
||||
local PROC_NAME=${line%%=*}
|
||||
local PROC_COUNT=${line#*=}
|
||||
dokku_col_log_info1 "$PROC_NAME" "$PROC_COUNT"
|
||||
dokku_col_log_msg "${PROC_NAME}:" "$PROC_COUNT"
|
||||
done <"$DOKKU_SCALE_FILE"
|
||||
else
|
||||
set_scale "$APP" "$@"
|
||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
||||
if [[ "$(fn-ps-can-scale "$APP")" == "true" ]]; then
|
||||
set_scale "$APP" "$@"
|
||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
||||
else
|
||||
dokku_log_fail "App contains DOKKU_SCALE file and cannot be manually scaled"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -241,3 +250,17 @@ fn-ps-is-app-running() {
|
||||
APP_STATUS=$(fn-ps-app-status "$APP")
|
||||
echo "$APP_STATUS" | cut -d ' ' -f 2
|
||||
}
|
||||
|
||||
fn-ps-can-scale() {
|
||||
declare APP="$1"
|
||||
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
||||
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local CAN_SCALE=false
|
||||
|
||||
[[ ! -e $DOKKU_SCALE_FILE ]] && generate_scale_file "$APP" "$IMAGE_TAG" >/dev/null 2>&1
|
||||
if [[ ! -f "${DOKKU_SCALE_FILE}.extracted" ]]; then
|
||||
CAN_SCALE=true
|
||||
fi
|
||||
|
||||
echo "$CAN_SCALE"
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ cmd-ps-report-single() {
|
||||
|
||||
if (is_deployed "$APP"); then DEPLOYED="true"; else DEPLOYED="false"; fi
|
||||
local passed_phases="deploy"
|
||||
RESTARTPOLICY=$(get_restart_policies "$(get_phase_file_path "$passed_phases")" || true)
|
||||
local RESTARTPOLICY=$(get_restart_policies "$(get_phase_file_path "$passed_phases")" || true)
|
||||
local CAN_SCALE="$(fn-ps-can-scale "$APP")"
|
||||
|
||||
local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" 2>/dev/null | sort -t . -k 2 -n | xargs)"
|
||||
local CONTAINER_FILE
|
||||
@@ -70,6 +71,7 @@ cmd-ps-report-single() {
|
||||
"--running: $RUNNING"
|
||||
"--restore: $RESTORE"
|
||||
"--restart-policy: $RESTARTPOLICY"
|
||||
"--ps-can-scale: $CAN_SCALE"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core ps plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core repo plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core resource plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -75,11 +75,11 @@ func GetResourceValue(appName string, processType string, resourceType string, k
|
||||
}
|
||||
|
||||
defaultValue := ""
|
||||
for key, value := range resources {
|
||||
if key == propertyKey("_default_", resourceType, key) {
|
||||
for k, value := range resources {
|
||||
if k == propertyKey("_default_", resourceType, key) {
|
||||
defaultValue = value
|
||||
}
|
||||
if key == propertyKey(processType, resourceType, key) {
|
||||
if k == propertyKey(processType, resourceType, key) {
|
||||
return value, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
if parts[1] == "cpu" {
|
||||
parts[1] = "cpus"
|
||||
}
|
||||
|
||||
limits[parts[1]] = value
|
||||
}
|
||||
if parts[0] == "reserve" {
|
||||
|
||||
@@ -14,8 +14,8 @@ func main() {
|
||||
flag.Parse()
|
||||
appName := flag.Arg(0)
|
||||
processType := flag.Arg(1)
|
||||
resourceType := flag.Arg(1)
|
||||
key := flag.Arg(1)
|
||||
resourceType := flag.Arg(2)
|
||||
key := flag.Arg(3)
|
||||
|
||||
value, err := resource.GetResourceValue(appName, processType, resourceType, key)
|
||||
if err != nil {
|
||||
|
||||
@@ -121,10 +121,11 @@ func setResourceType(appName string, processType string, r Resource, resourceTyp
|
||||
common.LogInfo2Quiet(message)
|
||||
|
||||
for key, value := range resources {
|
||||
if value != "" {
|
||||
common.LogVerbose(fmt.Sprintf("%v: %v", key, value))
|
||||
if value == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
common.LogVerbose(fmt.Sprintf("%v: %v", key, value))
|
||||
property := propertyKey(processType, resourceType, key)
|
||||
err := common.PropertyWrite("resource", appName, property, value)
|
||||
if err != nil {
|
||||
@@ -142,7 +143,9 @@ func reportResourceType(appName string, processType string, resourceType string)
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("resource %v %v information", noun, appName)
|
||||
if processType != "_default_" {
|
||||
if processType == "_default_" {
|
||||
message = fmt.Sprintf("%v [defaults]", message)
|
||||
} else {
|
||||
message = fmt.Sprintf("%v (%v)", message, processType)
|
||||
}
|
||||
common.LogInfo2Quiet(message)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core scheduler-docker-local plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
23
plugins/scheduler-docker-local/scheduler-is-deployed
Executable file
23
plugins/scheduler-docker-local/scheduler-is-deployed
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
scheduler-docker-local-scheduler-is-deployed() {
|
||||
declare desc="checks if an app is deployed"
|
||||
declare DOKKU_SCHEDULER="$1" APP="$2"
|
||||
|
||||
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(
|
||||
ls "$DOKKU_ROOT/$APP"/CONTAINER.* &>/dev/null
|
||||
echo $?
|
||||
) -eq 0 ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
scheduler-docker-local-scheduler-is-deployed "$@"
|
||||
@@ -32,8 +32,13 @@ scheduler-docker-local-scheduler-run() {
|
||||
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
is_image_herokuish_based "$IMAGE" && IMAGE_SOURCE_TYPE="herokuish"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE")
|
||||
DOCKER_ARGS+=" -e DYNO=run.$RANDOM"
|
||||
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
local DOKKU_RUN_OPTS=" -e DYNO=run.$RANDOM"
|
||||
if [[ "$DOKKU_RM_CONTAINER" ]]; then
|
||||
DOCKER_ARGS+=" --rm"
|
||||
elif [[ "$DOKKU_DETACH_CONTAINER" ]]; then
|
||||
@@ -52,11 +57,11 @@ scheduler-docker-local-scheduler-run() {
|
||||
DOKKU_QUIET_OUTPUT=1 extract_procfile "$APP"
|
||||
|
||||
POTENTIAL_PROCFILE_KEY="$1"
|
||||
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" || echo '')
|
||||
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" 2>/dev/null || echo '')
|
||||
remove_procfile "$APP"
|
||||
|
||||
if [[ -n "$PROC_CMD" ]]; then
|
||||
dokku_log_info1 "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
|
||||
dokku_log_info1_quiet "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
|
||||
set -- "$PROC_CMD" "${@:2}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core shell plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -14,9 +14,14 @@ verify_ssh_key_file() {
|
||||
declare desc="Test that public key is valid"
|
||||
[[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found."
|
||||
local key line=0
|
||||
local TMP_KEY_FILE
|
||||
TMP_KEY_FILE=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
|
||||
trap 'rm -rf "$TMP_KEY_FILE" >/dev/null' RETURN INT TERM EXIT
|
||||
|
||||
while read -r key; do
|
||||
line=$((line + 1))
|
||||
ssh-keygen -l -f /dev/stdin <<<"$key" &>/dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys line $line failed ssh-keygen check."
|
||||
echo "$key" >"$TMP_KEY_FILE"
|
||||
ssh-keygen -lf "$TMP_KEY_FILE" &>/dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys line $line failed ssh-keygen check."
|
||||
done <"${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core ssh-keys plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -7,22 +7,33 @@ source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
|
||||
add_keys() {
|
||||
declare desc="add a new key via sshcommand"
|
||||
local cmd="ssh-keys:add"
|
||||
shift
|
||||
local name="$1" key_file="$2" key_contents key_from_pipe
|
||||
[[ -p /dev/stdin ]] && read -r key_from_pipe
|
||||
if [[ -n "$key_from_pipe" ]]; then
|
||||
ssh-keygen -lf /dev/stdin <<<"$key_from_pipe" &>/dev/null || dokku_log_fail "Key piped in is not a valid ssh public key"
|
||||
key_contents="$key_from_pipe"
|
||||
elif [[ -n "$key_file" ]]; then
|
||||
key_contents="$(cat "$key_file")"
|
||||
ssh-keygen -lf /dev/stdin <<<"$key_contents" &>/dev/null || dokku_log_fail "Key from file is not a valid ssh public key"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare NAME="$1" KEY_FILE="$2"
|
||||
local TMP_KEY_FILE
|
||||
TMP_KEY_FILE=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
|
||||
trap 'rm -rf "$TMP_KEY_FILE" >/dev/null' RETURN INT TERM EXIT
|
||||
|
||||
if [[ -n "$KEY_FILE" ]]; then
|
||||
true
|
||||
elif [[ -p /dev/stdin ]]; then
|
||||
local key_contents
|
||||
read -r key_contents
|
||||
echo "$key_contents" >"$TMP_KEY_FILE"
|
||||
KEY_FILE="$TMP_KEY_FILE"
|
||||
else
|
||||
dokku_log_fail "No key specified via file or pipe"
|
||||
fi
|
||||
[[ -n "$name" && -n "$key_contents" ]] || dokku_log_fail "Two arguments are required if not piping, ie: dokku ssh-keys:add <NAME> <KEY_FILE>"
|
||||
local count="$(wc -l <<<"$key_contents")"
|
||||
[ "$count" -eq 1 ] || dokku_log_fail 'Too many keys provided, set one per invocation of dokku ssh-keys:add <NAME> <KEY_FILE>'
|
||||
|
||||
if [[ ! -s "$KEY_FILE" ]]; then
|
||||
dokku_log_fail "Empty key was specified"
|
||||
fi
|
||||
|
||||
local count="$(wc -l "$KEY_FILE" | awk '{ print $1; }')"
|
||||
[[ "$count" -eq 1 ]] || dokku_log_fail "Too many keys provided, set one per invocation of dokku ssh-keys:add <NAME> <KEY_FILE>"
|
||||
ssh-keygen -lf "$KEY_FILE" &>/dev/null || dokku_log_fail "Key specified in is not a valid ssh public key"
|
||||
create_ssh_key_file
|
||||
verify_ssh_key_exists
|
||||
echo "$key_contents" | sshcommand acl-add dokku "$name" || dokku_log_fail "sshcommand returned an error: $?"
|
||||
sshcommand acl-add dokku "$NAME" "$KEY_FILE" || dokku_log_fail "sshcommand returned an error: $?"
|
||||
verify_ssh_key_file
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core storage plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core tags plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core tar plugin"
|
||||
version = "0.15.5"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
|
||||
16
plugins/trace/commands
Executable file
16
plugins/trace/commands
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help trace:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/trace/internal-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | trace:help)
|
||||
trace_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
|
||||
esac
|
||||
28
plugins/trace/internal-functions
Executable file
28
plugins/trace/internal-functions
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trace_help_content_func() {
|
||||
declare desc="return trace plugin help content"
|
||||
cat <<help_content
|
||||
trace, [DEPRECATED] Enables/Disables trace mode
|
||||
trace:on, Clones an app
|
||||
trace:off, Create a new app
|
||||
help_content
|
||||
}
|
||||
|
||||
trace_help_cmd() {
|
||||
if [[ $1 == "trace:help" ]]; then
|
||||
echo -e 'Usage: dokku trace[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage trace mode'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
trace_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
trace_help_content_func
|
||||
else
|
||||
cat <<help_desc
|
||||
trace, Manage trace mode
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
4
plugins/trace/plugin.toml
Executable file
4
plugins/trace/plugin.toml
Executable file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core trace plugin"
|
||||
version = "0.16.4"
|
||||
[plugin.config]
|
||||
@@ -3,23 +3,25 @@ set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
dokku_trace_cmd() {
|
||||
declare desc="enables/disables DOKKU_TRACE"
|
||||
trace_default_cmd() {
|
||||
declare desc="enables/disables trace mode"
|
||||
local cmd="trace"
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
|
||||
dokku_log_fail "Valid trace options are [on/off]"
|
||||
}
|
||||
|
||||
dokku_log_warn "Deprecated: Please use trace:on or trace:off"
|
||||
|
||||
if [[ "$2" == "on" ]]; then
|
||||
echo "Enabling dokku trace"
|
||||
dokku_log_info1 "Enabling trace mode"
|
||||
echo "export DOKKU_TRACE=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
fi
|
||||
|
||||
if [[ "$2" == "off" ]]; then
|
||||
echo "Disabling dokku trace"
|
||||
dokku_log_info1 "Disabling trace mode"
|
||||
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_trace_cmd "$@"
|
||||
trace_default_cmd "$@"
|
||||
15
plugins/trace/subcommands/off
Executable file
15
plugins/trace/subcommands/off
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trace_off_cmd() {
|
||||
declare desc="disables trace mode"
|
||||
local cmd="trace"
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||
|
||||
dokku_log_info1 "Disabling trace mode"
|
||||
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
}
|
||||
|
||||
trace_off_cmd "$@"
|
||||
15
plugins/trace/subcommands/on
Executable file
15
plugins/trace/subcommands/on
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trace_on_cmd() {
|
||||
declare desc="enables trace mode"
|
||||
local cmd="trace"
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||
|
||||
dokku_log_info1 "Enabling trace mode"
|
||||
echo "export DOKKU_TRACE=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
|
||||
}
|
||||
|
||||
trace_on_cmd "$@"
|
||||
Reference in New Issue
Block a user