Merge pull request #3079 from dokku/refactor-app-status
fix: move container status exclusively to ps plugin
This commit is contained in:
3 files changed
+3
-19
No files matched your search
@@ -155,15 +155,11 @@ dokku apps:report
|
|||||||
=====> node-js-app
|
=====> node-js-app
|
||||||
App dir: /home/dokku/node-js-app
|
App dir: /home/dokku/node-js-app
|
||||||
Git sha: dbddc3f
|
Git sha: dbddc3f
|
||||||
App cid: 7b18489c98be
|
|
||||||
Status: running
|
|
||||||
=====> python-sample
|
=====> python-sample
|
||||||
not deployed
|
not deployed
|
||||||
=====> ruby-sample
|
=====> ruby-sample
|
||||||
App dir: /home/dokku/ruby-sample
|
App dir: /home/dokku/ruby-sample
|
||||||
Git sha: a2d477c
|
Git sha: a2d477c
|
||||||
App cid: 78a44d71012a
|
|
||||||
Status: running
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can run the command for a specific app also.
|
You can run the command for a specific app also.
|
||||||
@@ -176,8 +172,6 @@ dokku apps:report node-js-app
|
|||||||
=====> node-js-app
|
=====> node-js-app
|
||||||
App dir: /home/dokku/node-js-app
|
App dir: /home/dokku/node-js-app
|
||||||
Git sha: dbddc3f
|
Git sha: dbddc3f
|
||||||
App cid: 7b18489c98be
|
|
||||||
Status: running
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can pass flags which will output only the value of the specific information you want. For example:
|
You can pass flags which will output only the value of the specific information you want. For example:
|
||||||
|
|||||||
@@ -12,21 +12,9 @@ report_single_app() {
|
|||||||
INFO_FLAG=""
|
INFO_FLAG=""
|
||||||
fi
|
fi
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
|
||||||
if [[ -n $DOKKU_APP_CIDS ]]; then
|
|
||||||
local cid
|
|
||||||
for CID in $DOKKU_APP_CIDS; do
|
|
||||||
local APP_CONTAINER_STATUS
|
|
||||||
local DOKKU_APP_CID
|
|
||||||
DOKKU_APP_CID=$CID
|
|
||||||
APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' "$CID")
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
local flag_map=(
|
local flag_map=(
|
||||||
"--app-dir: $APP_DIR"
|
"--app-dir: $APP_DIR"
|
||||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
||||||
"--app-cid: ${DOKKU_APP_CID:0:12}"
|
|
||||||
"--status: $APP_CONTAINER_STATUS"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ -z "$INFO_FLAG" ]]; then
|
if [[ -z "$INFO_FLAG" ]]; then
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ report_single_app() {
|
|||||||
local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
||||||
local STATUSES=()
|
local STATUSES=()
|
||||||
if [[ "$DOKKU_APP_RESTORE" != 0 ]]; then RESTORE="true"; else RESTORE="false"; fi
|
if [[ "$DOKKU_APP_RESTORE" != 0 ]]; then RESTORE="true"; else RESTORE="false"; fi
|
||||||
|
local APP_CONTAINER_STATUS
|
||||||
for CONTAINER_FILE in $CONTAINER_FILES; do
|
for CONTAINER_FILE in $CONTAINER_FILES; do
|
||||||
CID=$(< "$DOKKU_ROOT/$APP/$CONTAINER_FILE")
|
CID=$(< "$DOKKU_ROOT/$APP/$CONTAINER_FILE")
|
||||||
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID")
|
APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2> /dev/null)
|
||||||
|
[[ -z "$APP_CONTAINER_STATUS" ]] && APP_CONTAINER_STATUS="dead"
|
||||||
STATUSES+=("${CONTAINER_FILE#*.}:$APP_CONTAINER_STATUS#${CID:0:12}")
|
STATUSES+=("${CONTAINER_FILE#*.}:$APP_CONTAINER_STATUS#${CID:0:12}")
|
||||||
done
|
done
|
||||||
local flag_map=(
|
local flag_map=(
|
||||||
|
|||||||
Reference in new issue
Block a user