Merge branch 'master' into master
This commit is contained in:
@@ -1,38 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | apps:help)
|
||||
help_content_func () {
|
||||
declare desc="return apps plugin help content"
|
||||
cat<<help_content
|
||||
apps, List your apps
|
||||
apps:clone <old-app> <new-app>, Clones an app
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
apps:rename <old-app> <new-app>, Rename an app
|
||||
apps:report [<app>] [<flag>], Display report about an app
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "apps:help" ]] ; then
|
||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||
echo ''
|
||||
echo 'List your apps.'
|
||||
echo ''
|
||||
echo 'Example:'
|
||||
echo ''
|
||||
echo '$ dokku apps'
|
||||
echo '=====> My Apps'
|
||||
echo 'example'
|
||||
echo 'example2'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
apps_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
51
plugins/apps/internal-functions
Executable file
51
plugins/apps/internal-functions
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
apps_help_content_func() {
|
||||
declare desc="return apps plugin help content"
|
||||
cat<<help_content
|
||||
apps, [DEPRECATED] Alias for apps:list
|
||||
apps:clone <old-app> <new-app>, Clones an app
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
apps:list, List your apps
|
||||
apps:rename <old-app> <new-app>, Rename an app
|
||||
apps:report [<app>] [<flag>], Display report about an app
|
||||
help_content
|
||||
}
|
||||
|
||||
apps_help_cmd() {
|
||||
if [[ $1 = "apps:help" ]] ; then
|
||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps'
|
||||
echo ''
|
||||
echo 'Example:'
|
||||
echo ''
|
||||
echo '$ dokku apps'
|
||||
echo '=====> My Apps'
|
||||
echo 'example'
|
||||
echo 'example2'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
apps_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
apps_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
apps, Manage Dokku apps
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
|
||||
apps_list_cmd() {
|
||||
declare desc="lists all apps"
|
||||
local cmd="apps"
|
||||
local app
|
||||
|
||||
dokku_log_info2_quiet "My Apps"
|
||||
for app in $(dokku_apps); do
|
||||
echo "$app"
|
||||
done
|
||||
}
|
||||
@@ -1,16 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
apps_main_cmd() {
|
||||
declare desc="lists all apps"
|
||||
local cmd="apps"
|
||||
local app
|
||||
|
||||
dokku_log_info2_quiet "My Apps"
|
||||
for app in $(dokku_apps); do
|
||||
echo "$app"
|
||||
done
|
||||
}
|
||||
|
||||
apps_main_cmd "$@"
|
||||
dokku_log_warn "Deprecated: Please use apps:list"
|
||||
apps_list_cmd "$@"
|
||||
|
||||
5
plugins/apps/subcommands/list
Executable file
5
plugins/apps/subcommands/list
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
apps_list_cmd "$@"
|
||||
@@ -65,7 +65,7 @@ report_single_app() {
|
||||
}
|
||||
|
||||
apps_report_cmd() {
|
||||
declare desc="shows reports for an app"
|
||||
declare desc="displays the app report for one or more apps"
|
||||
local cmd="apps:report"
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | certs:help)
|
||||
help_content_func () {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate
|
||||
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
|
||||
certs:info <app>, Show certificate information for an ssl endpoint
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
|
||||
certs:remove <app>, Remove an SSL Endpoint from an app
|
||||
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
|
||||
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "certs:help" ]] ; then
|
||||
echo -e 'Usage: dokku certs:COMMAND'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
certs_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -2,39 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
certs_info_cmd() {
|
||||
# This is here because it's used in both the info and the default
|
||||
declare desc="prints SSL certificate info for app"
|
||||
local cmd="certs:info"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -n "$APP_SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
|
||||
dokku_log_info1 "Certificate details:"
|
||||
dokku_log_info2 "Common Name(s): "
|
||||
|
||||
for domain in $(get_ssl_hostnames "$APP" | xargs); do
|
||||
dokku_log_info2 " $domain"
|
||||
done
|
||||
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
local SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
else
|
||||
local SSL_SELF_SIGNED="self signed."
|
||||
fi
|
||||
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
|
||||
else
|
||||
dokku_log_info1 "$APP does not have an SSL endpoint"
|
||||
fi
|
||||
}
|
||||
|
||||
is_ssl_enabled() {
|
||||
declare desc="returns 0 if ssl is enabled for given app"
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
|
||||
71
plugins/certs/internal-functions
Executable file
71
plugins/certs/internal-functions
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
certs_help_content_func() {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
certs, [DEPRECATED] Alternative for certs:report
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate
|
||||
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
|
||||
certs:info <app>, [DEPRECATED] Alternative for certs:report
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
|
||||
certs:remove <app>, Remove an SSL Endpoint from an app
|
||||
certs:report [<app>] [<flag>], Displays an ssl report for one or more apps
|
||||
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
|
||||
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
help_content
|
||||
}
|
||||
|
||||
certs_help_cmd() {
|
||||
if [[ $1 = "certs:help" ]] ; then
|
||||
echo -e 'Usage: dokku certs[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
certs_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
certs_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
|
||||
certs_info_cmd() {
|
||||
# This is here because it's used in both the info and the default
|
||||
declare desc="prints SSL certificate info for app"
|
||||
local cmd="certs:info"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
|
||||
dokku_log_info1 "Certificate details:"
|
||||
dokku_log_info2 "Common Name(s): "
|
||||
|
||||
for domain in $(get_ssl_hostnames "$APP" | xargs); do
|
||||
dokku_log_info2 " $domain"
|
||||
done
|
||||
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
local SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
else
|
||||
local SSL_SELF_SIGNED="self signed."
|
||||
fi
|
||||
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
|
||||
else
|
||||
dokku_log_info1 "$APP does not have an SSL endpoint"
|
||||
fi
|
||||
}
|
||||
12
plugins/certs/subcommands/default
Normal file → Executable file
12
plugins/certs/subcommands/default
Normal file → Executable file
@@ -1,12 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
certs_main_cmd() {
|
||||
declare desc="an alias for certs:info"
|
||||
local cmd="certs"
|
||||
certs_info_cmd "$@"
|
||||
}
|
||||
|
||||
certs_main_cmd "$@"
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
certs_info_cmd "$@"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
certs_info_cmd "$@"
|
||||
|
||||
136
plugins/certs/subcommands/report
Executable file
136
plugins/certs/subcommands/report
Executable file
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
fn-ssl-enabled() {
|
||||
declare APP="$1"
|
||||
local SSL_ENABLED=false
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
SSL_ENABLED=true
|
||||
fi
|
||||
echo "$SSL_ENABLED"
|
||||
}
|
||||
|
||||
fn-ssl-expires-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }'
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-hostnames() {
|
||||
declare APP="$1"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
get_ssl_hostnames "$APP" | xargs
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-issuer() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-starts-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }'
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-subject() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-verified() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local SSL_VERIFY_OUTPUT=false SSL_SELF_SIGNED="self signed"
|
||||
|
||||
if ! is_ssl_enabled "$APP"; then
|
||||
return
|
||||
fi
|
||||
|
||||
SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
SSL_SELF_SIGNED="verified by a certificate authority"
|
||||
fi
|
||||
|
||||
echo "$SSL_SELF_SIGNED"
|
||||
}
|
||||
|
||||
certs_report_single_app() {
|
||||
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--ssl-dir: $APP_DIR/tls"
|
||||
"--ssl-enabled: $(fn-ssl-enabled "$APP")"
|
||||
"--ssl-hostnames: $(fn-ssl-hostnames "$APP")"
|
||||
"--ssl-expires-at: $(fn-ssl-expires-at "$APP")"
|
||||
"--ssl-issuer: $(fn-ssl-issuer "$APP")"
|
||||
"--ssl-starts-at: $(fn-ssl-starts-at "$APP")"
|
||||
"--ssl-subject: $(fn-ssl-subject "$APP")"
|
||||
"--ssl-verified: $(fn-ssl-verified "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP ssl information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
certs_report_cmd() {
|
||||
declare desc="displays an ssl report for one or more apps"
|
||||
local cmd="certs:report"
|
||||
local INSTALLED_APPS=$(dokku_apps); local APP
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
for APP in $INSTALLED_APPS; do
|
||||
certs_report_single_app "$APP" "true"
|
||||
done
|
||||
else
|
||||
certs_report_single_app "$2" "$3"
|
||||
fi
|
||||
}
|
||||
|
||||
certs_report_cmd "$@"
|
||||
@@ -1,30 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help checks:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | checks:help)
|
||||
help_content_func () {
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
checks <app>, Show zero-downtime status
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
echo -e 'Usage: dokku checks[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime settings.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
checks_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
32
plugins/checks/internal-functions
Executable file
32
plugins/checks/internal-functions
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
checks_help_content_func() {
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
checks <app>, [DEPRECATED] Alternative for checks:report
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:report [<app>] [<flag>], Displays a checks report for one or more apps
|
||||
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
help_content
|
||||
}
|
||||
|
||||
checks_help_cmd() {
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
echo -e 'Usage: dokku checks[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime settings.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
checks_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
checks_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
checks, Manage zero-downtime settings
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
@@ -12,6 +12,7 @@ checks_main_cmd() {
|
||||
local APPS="$1"
|
||||
fi
|
||||
|
||||
dokku_log_warn "Deprecated: Please use checks:report"
|
||||
dokku_col_log_info1_quiet "App Name" "Proctypes Disabled" "Proctypes Skipped"
|
||||
local app
|
||||
for app in $APPS; do
|
||||
|
||||
75
plugins/checks/subcommands/report
Executable file
75
plugins/checks/subcommands/report
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
fn-checks-disabled-list() {
|
||||
declare APP="$1"
|
||||
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED)
|
||||
DOKKU_CHECKS_DISABLED="${DOKKU_CHECKS_DISABLED:-none}"
|
||||
echo "$DOKKU_CHECKS_DISABLED"
|
||||
}
|
||||
|
||||
fn-checks-skipped-list() {
|
||||
declare APP="$1"
|
||||
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED)
|
||||
DOKKU_CHECKS_SKIPPED="${DOKKU_CHECKS_SKIPPED:-none}"
|
||||
echo "$DOKKU_CHECKS_SKIPPED"
|
||||
}
|
||||
|
||||
checks_report_single_app() {
|
||||
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--checks-disabled-list: $(fn-checks-disabled-list "$APP")"
|
||||
"--checks-skipped-list: $(fn-checks-skipped-list "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP checks information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks_report_cmd() {
|
||||
declare desc="shows reports for an app"
|
||||
local cmd="checks:report"
|
||||
local INSTALLED_APPS=$(dokku_apps); local APP
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
for APP in $INSTALLED_APPS; do
|
||||
checks_report_single_app "$APP" "true"
|
||||
done
|
||||
else
|
||||
checks_report_single_app "$2" "$3"
|
||||
fi
|
||||
}
|
||||
|
||||
checks_report_cmd "$@"
|
||||
@@ -1,35 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help domains:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | domains:help)
|
||||
help_content_func () {
|
||||
declare desc="return domains plugin help content"
|
||||
cat<<help_content
|
||||
domains [<app>], List domains
|
||||
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:disable <app>, Disable VHOST support
|
||||
domains:enable <app>, Enable VHOST support
|
||||
domains:remove <app> <domain> [<domain> ...], Remove domains from app
|
||||
domains:remove-global <domain> [<domain> ...], Remove global domain names
|
||||
domains:set <app> <domain> [<domain> ...], Set domains for app
|
||||
domains:set-global <domain> [<domain> ...], Set global domain names
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "domains:help" ]] ; then
|
||||
echo -e 'Usage: dokku domains[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage vhost domains used by the Dokku proxy.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
domains_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
36
plugins/domains/internal-functions
Executable file
36
plugins/domains/internal-functions
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
domains_help_content_func () {
|
||||
declare desc="return domains plugin help content"
|
||||
cat<<help_content
|
||||
domains [<app>], [DEPRECATED] Alternative for domains:report
|
||||
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:disable <app>, Disable VHOST support
|
||||
domains:enable <app>, Enable VHOST support
|
||||
domains:remove <app> <domain> [<domain> ...], Remove domains from app
|
||||
domains:remove-global <domain> [<domain> ...], Remove global domain names
|
||||
domains:report [<app>] [<flag>], Displays a domains report for one or more apps
|
||||
domains:set <app> <domain> [<domain> ...], Set domains for app
|
||||
domains:set-global <domain> [<domain> ...], Set global domain names
|
||||
help_content
|
||||
}
|
||||
|
||||
domains_help_cmd() {
|
||||
if [[ $1 = "domains:help" ]] ; then
|
||||
echo -e 'Usage: dokku domains[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage vhost domains used by the Dokku proxy.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
domains_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
domains_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
domains, Manage vhost domains used by the Dokku proxy
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
@@ -8,6 +8,7 @@ domains_main_cmd() {
|
||||
local cmd="domains"
|
||||
local APP="$2"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use domains:report"
|
||||
if [[ "$(is_global_vhost_enabled)" == "true" ]]; then
|
||||
dokku_log_info2_quiet "Global Domain Name"
|
||||
get_global_vhosts
|
||||
|
||||
92
plugins/domains/subcommands/report
Executable file
92
plugins/domains/subcommands/report
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
fn-domains-app-enabled() {
|
||||
declare APP="$1"
|
||||
local DOMAINS_APP_ENABLED=false
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then
|
||||
DOMAINS_APP_ENABLED=true
|
||||
fi
|
||||
echo "$DOMAINS_APP_ENABLED"
|
||||
}
|
||||
|
||||
fn-domains-app-vhosts() {
|
||||
declare APP="$1"
|
||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
if [[ -f "$APP_VHOST_FILE" ]]; then
|
||||
tr '\n' ' ' < "$APP_VHOST_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-domains-global-enabled() {
|
||||
local DOMAINS_GLOBAL_ENABLED=false
|
||||
if [[ "$(is_global_vhost_enabled)" == "true" ]]; then
|
||||
DOMAINS_GLOBAL_ENABLED=true
|
||||
fi
|
||||
echo "$DOMAINS_GLOBAL_ENABLED"
|
||||
}
|
||||
|
||||
fn-domains-global-vhosts() {
|
||||
if [[ "$(is_global_vhost_enabled)" == "true" ]]; then
|
||||
get_global_vhosts | tr '\n' ' '
|
||||
fi
|
||||
}
|
||||
|
||||
domains_report_single_app() {
|
||||
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--domains-app-enabled: $(fn-domains-app-enabled "$APP")"
|
||||
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")"
|
||||
"--domains-global-enabled: $(fn-domains-global-enabled)"
|
||||
"--domains-global-vhosts: $(fn-domains-global-vhosts)"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP domains information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
domains_report_cmd() {
|
||||
declare desc="displays a domains report for one or more apps"
|
||||
local cmd="domains:report"
|
||||
local INSTALLED_APPS=$(dokku_apps); local APP
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
for APP in $INSTALLED_APPS; do
|
||||
domains_report_single_app "$APP" "true"
|
||||
done
|
||||
else
|
||||
domains_report_single_app "$2" "$3"
|
||||
fi
|
||||
}
|
||||
|
||||
domains_report_cmd "$@"
|
||||
@@ -1,21 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
help | nginx:help)
|
||||
|
||||
|
||||
if [[ $1 = "nginx:help" ]] ; then
|
||||
help_formatted
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
;;
|
||||
nginx_vhosts_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -6,25 +6,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
help_formatted (){
|
||||
echo -e 'Usage: dokku nginx[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Interact with Dokku'"'"'s Nginx proxy.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
}
|
||||
|
||||
help_content_func () {
|
||||
declare desc="return nginx plugin help content"
|
||||
cat<<help_content
|
||||
nginx, Interact with Dokku's Nginx proxy
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
help_content
|
||||
}
|
||||
|
||||
validate_nginx() {
|
||||
declare desc="validate entire nginx config"
|
||||
set +e
|
||||
|
||||
28
plugins/nginx-vhosts/internal-functions
Executable file
28
plugins/nginx-vhosts/internal-functions
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
nginx_vhosts_help_content_func() {
|
||||
declare desc="return nginx plugin help content"
|
||||
cat<<help_content
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
help_content
|
||||
}
|
||||
|
||||
nginx_vhosts_help_cmd() {
|
||||
if [[ $1 = "nginx:help" ]] ; then
|
||||
echo -e 'Usage: dokku nginx[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Interact with Dokku'"'"'s Nginx proxy.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
nginx_vhosts_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
nginx_vhosts_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
nginx, Interact with Dokku's Nginx proxy
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
12
plugins/nginx-vhosts/subcommands/default
Normal file → Executable file
12
plugins/nginx-vhosts/subcommands/default
Normal file → Executable file
@@ -1,13 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||
|
||||
nginx_main_cmd() {
|
||||
declare desc="display nginx plugin help content"
|
||||
local cmd="nginx"
|
||||
help_formatted
|
||||
}
|
||||
|
||||
nginx_main_cmd "$@"
|
||||
nginx_vhosts_help_cmd "$@"
|
||||
|
||||
@@ -1,33 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help proxy:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | proxy:help)
|
||||
help_content_func () {
|
||||
declare desc="return proxy plugin help content"
|
||||
cat<<help_content
|
||||
proxy <app>, Show proxy settings for app
|
||||
proxy:enable <app>, Enable proxy for app
|
||||
proxy:disable <app>, Disable 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:set <app> <proxy-type>, Set proxy type for app
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "proxy:help" ]] ; then
|
||||
echo -e 'Usage: dokku proxy[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Control the proxy used by dokku, per app.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
proxy_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -24,10 +24,16 @@ get_app_proxy_type() {
|
||||
echo "$APP_PROXY_TYPE"
|
||||
}
|
||||
|
||||
get_app_proxy_port_map() {
|
||||
declare desc="return a list of configured port mappings"
|
||||
local APP="$1"; local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)"
|
||||
echo "$PROXY_PORT_MAP"
|
||||
}
|
||||
|
||||
list_app_proxy_ports() {
|
||||
declare desc="list proxy port mappings for an app"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)"
|
||||
local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")"
|
||||
|
||||
if [[ -n "$PROXY_PORT_MAP" ]]; then
|
||||
dokku_log_info1_quiet "Port mappings for $APP"
|
||||
@@ -45,7 +51,7 @@ filter_app_proxy_ports() {
|
||||
declare desc="list proxy port mappings for an app that start with a particular scheme and a host port"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local SCHEME="$2" HOST_PORT="$3"
|
||||
local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)"
|
||||
local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")"
|
||||
|
||||
if [[ -n "$PROXY_PORT_MAP" ]]; then
|
||||
local port_map
|
||||
@@ -62,7 +68,7 @@ filter_app_proxy_ports() {
|
||||
add_proxy_ports() {
|
||||
declare desc="add proxy port mappings from an app"
|
||||
local APP="$1"
|
||||
local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)"
|
||||
local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")"
|
||||
shift 1
|
||||
|
||||
local INPUT_PORTS="$*"
|
||||
@@ -78,7 +84,7 @@ add_proxy_ports() {
|
||||
remove_proxy_ports() {
|
||||
declare desc="remove specific proxy port mappings from an app"
|
||||
local APP="$1"
|
||||
local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)"
|
||||
local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")"
|
||||
local RE_PORT='^[0-9]+$'
|
||||
shift 1
|
||||
|
||||
|
||||
34
plugins/proxy/internal-functions
Executable file
34
plugins/proxy/internal-functions
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
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: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:report [<app>] [<flag>], Displays a proxy report for one or more apps
|
||||
proxy:set <app> <proxy-type>, Set proxy type for app
|
||||
help_content
|
||||
}
|
||||
|
||||
proxy_help_cmd() {
|
||||
if [[ $1 = "proxy:help" ]] ; then
|
||||
echo -e 'Usage: dokku proxy[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage the proxy used by dokku on a per app.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
proxy_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
proxy_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
proxy, Manage the proxy used by dokku on a per app
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
@@ -12,6 +12,7 @@ proxy_main_cmd() {
|
||||
local APPS="$1"
|
||||
fi
|
||||
|
||||
dokku_log_warn "Deprecated: Please use proxy:report"
|
||||
dokku_col_log_info1_quiet "App Name" "Proxy Type"
|
||||
local app
|
||||
for app in $APPS; do
|
||||
|
||||
70
plugins/proxy/subcommands/report
Executable file
70
plugins/proxy/subcommands/report
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
fn-proxy-enabled() {
|
||||
declare APP="$1"
|
||||
local PROXY_ENABLED=false
|
||||
|
||||
if [[ "$(is_app_proxy_enabled "$APP")" == "true" ]]; then
|
||||
PROXY_ENABLED=true
|
||||
fi
|
||||
echo "$PROXY_ENABLED"
|
||||
}
|
||||
|
||||
proxy_report_single_app() {
|
||||
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--proxy-enabled: $(fn-proxy-enabled "$APP")"
|
||||
"--proxy-type: $(get_app_proxy_type "$APP")"
|
||||
"--proxy-port-map: $(get_app_proxy_port_map "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP proxy information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
proxy_report_cmd() {
|
||||
declare desc="displays a proxy report for one or more apps"
|
||||
local cmd="proxy:report"
|
||||
local INSTALLED_APPS=$(dokku_apps); local APP
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
for APP in $INSTALLED_APPS; do
|
||||
proxy_report_single_app "$APP" "true"
|
||||
done
|
||||
else
|
||||
proxy_report_single_app "$2" "$3"
|
||||
fi
|
||||
}
|
||||
|
||||
proxy_report_cmd "$@"
|
||||
@@ -1,29 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help ssh-keys:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | ssh-keys:help)
|
||||
help_content_func () {
|
||||
declare desc="return ssh-keys plugin help content"
|
||||
cat<<help_content
|
||||
ssh-keys, Manage public ssh keys that are allowed to connect to Dokku
|
||||
ssh-keys:list, List of all authorized dokku public ssh keys
|
||||
ssh-keys:add <name> [/path/to/key], Add a new public key by pipe or path
|
||||
ssh-keys:remove <name>, Remove SSH public key by name
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "ssh-keys:help" ]] ; then
|
||||
echo -e 'Usage: dokku ssh-keys[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage public ssh keys that are allowed to connect to Dokku'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
ssh_keys_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
28
plugins/ssh-keys/internal-functions
Executable file
28
plugins/ssh-keys/internal-functions
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
ssh_keys_help_content_func() {
|
||||
declare desc="return ssh-keys plugin help content"
|
||||
cat<<help_content
|
||||
ssh-keys:list, List of all authorized dokku public ssh keys
|
||||
ssh-keys:add <name> [/path/to/key], Add a new public key by pipe or path
|
||||
ssh-keys:remove <name>, Remove SSH public key by name
|
||||
help_content
|
||||
}
|
||||
|
||||
ssh_keys_help_cmd() {
|
||||
if [[ $1 = "ssh-keys:help" ]] ; then
|
||||
echo -e 'Usage: dokku ssh-keys[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage public ssh keys that are allowed to connect to Dokku'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
ssh_keys_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
ssh_keys_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
ssh-keys, Manage public ssh keys that are allowed to connect to Dokku
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
11
plugins/ssh-keys/subcommands/default
Normal file → Executable file
11
plugins/ssh-keys/subcommands/default
Normal file → Executable file
@@ -1,12 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
|
||||
|
||||
ssh_keys_main_cmd() {
|
||||
declare desc="an alias for ssh-keys:list"
|
||||
local cmd="ssh-keys"
|
||||
list_ssh_keys
|
||||
}
|
||||
|
||||
ssh_keys_main_cmd "$@"
|
||||
ssh_keys_help_cmd "$@"
|
||||
|
||||
Reference in New Issue
Block a user