feat: add a subcommand for retrieving failed app deploy logs
This can be useful in cases where a developer wishes to see what error messages are available for a failed deploy, but does not wish to spelunk around `docker ps -a` output. Note that the logs are not made available once a further deploy is triggered, or after the containers have been garbage collected.
This commit is contained in:
1 parent
8b932971df
commit
78f467852e
11 files changed
+172
-44
No files matched your search
@@ -1,24 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/logs/internal-functions"
|
||||
|
||||
logs_default_cmd() {
|
||||
declare desc="shows the last logs for an app via command line"
|
||||
declare desc="display recent log output"
|
||||
local cmd="logs"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local APP="$2"; verify_app_name "$2"
|
||||
local APP_ROOT="$DOKKU_ROOT/$APP"
|
||||
local COLORS=(36 33 32 35 31)
|
||||
|
||||
if ! (is_deployed "$APP"); then
|
||||
echo "Application's container not found"
|
||||
exit 1
|
||||
fi
|
||||
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
|
||||
|
||||
shift 2;
|
||||
local TEMP=$(getopt -o htqn:p: --long help,tail,quiet,num:,ps: -n 'dokku logs' -- "$@")
|
||||
local EXIT_CODE="$?"
|
||||
if [[ "$EXIT_CODE" != 0 ]]; then usage >&2 ; exit 1 ; fi
|
||||
if [[ "$EXIT_CODE" != 0 ]]; then fn-logs-usage >&2 ; exit 1 ; fi
|
||||
eval set -- "$TEMP"
|
||||
|
||||
local DOKKU_LOGS_LINE_NUMBERS="100"
|
||||
@@ -29,7 +27,7 @@ logs_default_cmd() {
|
||||
-p|--ps) local DOKKU_LOGS_ONLY_PROCESS="$2"; shift 2 ;;
|
||||
-q|--quiet) local DOKKU_LOGS_NO_PRETTY_PRINT="true"; shift ;;
|
||||
--) shift; break ;;
|
||||
*) echo "Internal error"; exit 1;;
|
||||
*) dokku_log_fail "Internal error";;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
Reference in new issue
Block a user