Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5075 from nathansamson/restart-apps-contrib
Browse files Browse the repository at this point in the history
feat(contrib): Add script to restart all apps.
  • Loading branch information
mboersma committed Aug 8, 2016
2 parents a371230 + 1429fa8 commit d369fd7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contrib/util/reset-ps-all-apps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apps=$(curl -H "Authorization: token $DEIS_TOKEN" http://$DEIS_SERVER/v1/apps | jq -r '.results | map(.id) | join(" ")')

for app in $apps; do
echo "Resetting containers of $app"

originalscale=$(curl -H "Authorization: token $DEIS_TOKEN" http://$DEIS_SERVER/v1/apps/$app/containers/ 2>/dev/null | jq -r '(.results) | [group_by(.type)[] | max_by(.num)] | [map(.type), map(.num)] | transpose | map([.[0], .[1] | tostring] | join("=")) | join(" ")')
zeroscale=$(curl -H "Authorization: token $DEIS_TOKEN" http://$DEIS_SERVER/v1/apps/$app/containers/ 2>/dev/null | jq -r '(.results) | unique_by(.type) | map([.type, "0"] | join("=")) | join(" ")')

deis ps:scale $zeroscale -a $app
deis ps:scale $originalscale -a $app
echo
done

0 comments on commit d369fd7

Please sign in to comment.