Skip to content

Commit

Permalink
Don't deploy if there's no release (plushu/plusku#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartpb committed Aug 20, 2014
1 parent 6ef7d46 commit 6bffb90
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions hooks/deploy-app
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ set -eo pipefail; [[ -n "$PLUSHU_TRACE" ]] && set -x

app=$1
app_dir=$PLUSHU_ROOT/apps/$app
cidfile=$app_dir/proc/web.cid

mkdir -p "$app_dir/proc"
# If there's a release to run
if [[ -f "$app_dir/release.iid" ]]; then

# kill the app when running
if [[ -f "$cidfile" ]]; then
oldcid=$(<"$cidfile")
docker stop "$oldcid" > /dev/null && docker rm "$oldcid" > /dev/null
rm "$cidfile"
fi
cidfile=$app_dir/proc/web.cid

mkdir -p "$app_dir/proc"

{ "$PLUSHU_ROOT/lib/plushook" run-app-docker-opts "$app";
printf '%s /start web\n' "$(<"$app_dir/release.iid")"; } |
xargs -x docker run -d -e PORT=5000 --expose=5000 >"$cidfile"
# kill the app when running
if [[ -f "$cidfile" ]]; then
oldcid=$(<"$cidfile")
docker stop "$oldcid" > /dev/null && docker rm "$oldcid" > /dev/null
rm "$cidfile"
fi

"$PLUSHU_ROOT/lib/plushook" vhost-app "$app"
{ "$PLUSHU_ROOT/lib/plushook" run-app-docker-opts "$app";
printf '%s /start web\n' "$(<"$app_dir/release.iid")"; } |
xargs -x docker run -d -e PORT=5000 --expose=5000 >"$cidfile"

"$PLUSHU_ROOT/lib/plushook" vhost-app "$app"
fi

0 comments on commit 6bffb90

Please sign in to comment.