feat: sanitize docker inspect output with ps:inspect

Often-times, we will want to have the container inspect output for debugging purposes, but this process is:

- error prone, as the user needs to know what their containers are
- potentially insecure, as the output must be sanitized of sensitive data

Instead of making users wade through this process, we provide a helper `ps:inspect` command, that can be used to diagnose problems associated with containers that may or may not exist for an application.
This commit is contained in:
Jose Diaz-Gonzalez
2018-10-14 19:39:24 -04:00
parent 44d8eb4cb7
commit 15a2b7cbce
8 changed files with 116 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ case "$1" in
declare desc="return ps plugin help content"
cat<<help_content
ps <app>, List processes running in app container(s)
ps:inspect <app>, Displays a sanitized version of docker inspect for an app
ps:scale <app> <proc>=<count> [<proc>=<count>...], Get/Set how many instances of a given process to run
ps:start <app>, Start app container(s)
ps:startall, Starts all apps via command line

View File

@@ -4,6 +4,16 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-ps-inspect() {
declare desc="displays a sanitized version of docker inspect for an app"
local cmd="ps:inspect"
local APP="$2"
verify_app_name "$APP"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-inspect "$DOKKU_SCHEDULER" "$APP"
}
cmd-ps-report() {
declare desc="displays a ps report for one or more apps"
local cmd="ps:report"

5
plugins/ps/subcommands/inspect Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-ps-inspect "$@"