add ps:restore to start applications which weren't manually stopped
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
[[ " ps ps:start ps:stop ps:rebuild ps:rebuildall ps:restart ps:restartall ps:scale help ps:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
[[ " ps ps:start ps:stop ps:rebuild ps:rebuildall ps:restart ps:restartall ps:restore ps:scale help ps:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
@@ -84,6 +84,20 @@ case "$1" in
|
|||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
ps:restore)
|
||||||
|
shopt -s nullglob
|
||||||
|
for app in $DOKKU_ROOT/*; do
|
||||||
|
[[ ! -d $app ]] && continue
|
||||||
|
APP=$(basename $app)
|
||||||
|
RESTORE=$(dokku config:get $APP RESTORE || true)
|
||||||
|
if [[ $RESTORE != 0 ]]; then
|
||||||
|
echo "Restoring app $APP ..."
|
||||||
|
dokku ps:start $APP
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
shopt -u nullglob
|
||||||
|
;;
|
||||||
|
|
||||||
ps:scale)
|
ps:scale)
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
|
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
|
||||||
@@ -119,6 +133,7 @@ case "$1" in
|
|||||||
ps:rebuildall, Rebuild all apps
|
ps:rebuildall, Rebuild all apps
|
||||||
ps:restart <app>, Restart app container(s)
|
ps:restart <app>, Restart app container(s)
|
||||||
ps:restartall, Restart all deployed app containers
|
ps:restartall, Restart all deployed app containers
|
||||||
|
ps:restore, Start previously running apps e.g. after reboot
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
8
plugins/ps/post-deploy
Executable file
8
plugins/ps/post-deploy
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
|
APP="$1"
|
||||||
|
|
||||||
|
dokku config:set --no-restart $APP RESTORE=1
|
||||||
8
plugins/ps/post-stop
Executable file
8
plugins/ps/post-stop
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
|
APP="$1"
|
||||||
|
|
||||||
|
dokku config:set --no-restart $APP RESTORE=0
|
||||||
Reference in New Issue
Block a user