Last active
August 29, 2015 14:04
-
-
Save rjminsha/34a551c08f84433a651a to your computer and use it in GitHub Desktop.
Updates auto-scaling groups for docker micro-scaler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| . ./env.sh | |
| usage() | |
| { | |
| echo "Usage: `basename $0` [-a appname] -m minInstances -x maxInstances -d desiredInstances" | |
| echo " -a optional. Defaults to acmeair_webapp. Valid values typically are acmeair_webapp | acmeacir_auth_service" | |
| echo "" | |
| } | |
| asgc_addr=$($docker_cmd inspect --format '{{ .NetworkSettings.IPAddress }}' microscaler) | |
| APP="" | |
| MIN="" | |
| MAX="" | |
| DESIRED="" | |
| while getopts "a:m:x:d:h" opt; do | |
| case $opt in | |
| a) APP="$OPTARG" | |
| ;; | |
| m) MIN="$OPTARG" | |
| ;; | |
| x) MAX="$OPTARG" | |
| ;; | |
| d) DESIRED="$OPTARG" | |
| ;; | |
| h) usage; | |
| exit;; | |
| ?) usage; | |
| echo "unrecognized option"; | |
| exit 1 | |
| esac | |
| done | |
| if [ -z "$APP" ]; then | |
| APP="acmeair_webapp" | |
| fi | |
| if [ -z "$MIN" ]; then | |
| usage | |
| exit 1 | |
| fi | |
| if [ -z "$MAX" ]; then | |
| usage | |
| exit 1 | |
| fi | |
| if [ -z "$DESIRED" ]; then | |
| usage | |
| exit 1 | |
| fi | |
| echo "setting MIN=$MIN, MAX=$MAX and DESIRED=$DESIRED" | |
| ssh -i id_rsa root@$asgc_addr << EOF | |
| cd /usr/local/microscaler-cli/bin &&\ | |
| ./ms login --target http://localhost:56785/asgcc/ --user user01 --key key &&\ | |
| \ | |
| ./ms update-asg \ | |
| --asg-name $APP \ | |
| --asg-min-size $MIN \ | |
| --asg-desired-capacity $DESIRED \ | |
| --asg-max-size $MAX \ | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment