allow tagging and deployment of tagged app images
This commit is contained in:
@@ -6,24 +6,23 @@ source "$(dirname $0)/functions"
|
||||
case "$1" in
|
||||
ps)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; CONTAINER_IDS=$(get_app_container_ids $APP)
|
||||
APP="$2"; verify_app_name "$APP"; local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
for CID in $CONTAINER_IDS; do
|
||||
for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do
|
||||
has_tty && DOKKU_RUN_OPTS="-i -t"
|
||||
dokku_log_info1_quiet "running processes in container: $CID"
|
||||
docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww"
|
||||
done
|
||||
;;
|
||||
|
||||
ps:start)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"; APP="$2"
|
||||
APP="$2"; TAG=$(get_running_image_tag "$APP"); verify_app_name "$APP" "$TAG"
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
if ! (is_app_running $APP); then
|
||||
release_and_deploy $APP
|
||||
release_and_deploy "$APP" "$TAG"
|
||||
else
|
||||
echo "App $APP already running"
|
||||
fi
|
||||
@@ -31,12 +30,9 @@ case "$1" in
|
||||
|
||||
ps:stop)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; CONTAINER_IDS=$(get_app_container_ids $APP)
|
||||
APP="$2"; verify_app_name "$APP"; local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
||||
echo "Stopping $APP ..."
|
||||
docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
||||
@@ -47,8 +43,7 @@ case "$1" in
|
||||
|
||||
ps:rebuild)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
APP="$2"; verify_app_name "$APP"
|
||||
|
||||
pluginhook -p receive-app $APP
|
||||
;;
|
||||
@@ -65,12 +60,10 @@ case "$1" in
|
||||
|
||||
ps:restart)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"
|
||||
APP="$2"; TAG=$(get_running_image_tag $APP); verify_app_name "$APP" "$TAG"
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
release_and_deploy $APP
|
||||
release_and_deploy "$APP" "$TAG"
|
||||
;;
|
||||
|
||||
ps:restartall)
|
||||
@@ -85,18 +78,18 @@ case "$1" in
|
||||
|
||||
ps:scale)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"; TAG=$(get_running_image_tag "$APP"); verify_app_name "$APP" "$TAG"
|
||||
|
||||
APP="$2"; DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
shift 2
|
||||
|
||||
generate_scale_file "$APP"
|
||||
generate_scale_file "$APP" "$TAG"
|
||||
if [[ -z "$@" ]];then
|
||||
dokku_log_info1 "Scaling for $APP"
|
||||
dokku_log_info2 "$(< $DOKKU_SCALE_FILE)"
|
||||
else
|
||||
set_scale "$APP" "$@"
|
||||
release_and_deploy "$APP"
|
||||
release_and_deploy "$APP" "$TAG"
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
@@ -2,27 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
|
||||
release_and_deploy() {
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
local APP="$1"; local IMAGE="dokku/$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
if is_image_herokuish_based "$IMAGE"; then
|
||||
IMAGE_SOURCE_TYPE="herokuish"
|
||||
else
|
||||
IMAGE_SOURCE_TYPE="dockerfile"
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Releasing $APP ..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
|
||||
dokku_log_info1 "Deploying $APP ..."
|
||||
dokku deploy "$APP"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls $APP | sed "s/^/ /"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
print_dokku_scale_file(){
|
||||
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
while read line || [ -n "$line" ]
|
||||
@@ -32,7 +11,8 @@ print_dokku_scale_file(){
|
||||
}
|
||||
|
||||
generate_scale_file() {
|
||||
local APP="$1"; local IMAGE="dokku/$APP"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local APP="$1"; local TAG="$3"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
verify_app_name "$APP" "$TAG"
|
||||
copy_from_image "$IMAGE" "/app/DOKKU_SCALE" "$DOKKU_ROOT/$APP" 2>/dev/null || true
|
||||
if [[ ! -f $DOKKU_SCALE_FILE ]]; then
|
||||
dokku_log_info1_quiet "DOKKU_SCALE file not found in app image. Defaulting to a single web process"
|
||||
@@ -62,4 +42,3 @@ set_scale() {
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user