-
-
Save andragabr/349fc91e871d5743d7cbe34a3f137905 to your computer and use it in GitHub Desktop.
Revisions
-
christianberg revised this gist
Aug 29, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -66,7 +66,8 @@ IP_ADDRESS=`curl -s "$BASE_URL/droplets/$DROPLET_ID?$AUTH" | jq -r '.droplet.ip_ echo "Execute bootstrap script" BOOTSTRAP_URL="https://gist.github.com/christianberg/6082234/raw/bootstrap.sh" ssh-keygen -R $IP_ADDRESS SSH_OPTIONS="-o StrictHostKeyChecking=no" ssh $SSH_OPTIONS root@$IP_ADDRESS "curl -s $BOOTSTRAP_URL | bash" echo "*****************************" -
christianberg revised this gist
Jul 30, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -65,7 +65,7 @@ fi IP_ADDRESS=`curl -s "$BASE_URL/droplets/$DROPLET_ID?$AUTH" | jq -r '.droplet.ip_address'` echo "Execute bootstrap script" BOOTSTRAP_URL="https://gist.github.com/christianberg/6082234/raw/bootstrap.sh" SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ssh $SSH_OPTIONS root@$IP_ADDRESS "curl -s $BOOTSTRAP_URL | bash" -
christianberg revised this gist
Jul 30, 2013 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -55,12 +55,21 @@ for i in {1..60}; do echo -n '.' sleep 5 done echo if [ "$DROPLET_STATUS" != 'active' ]; then echo "Droplet did not boot in time. Status: $DROPLET_STATUS" exit 1 fi IP_ADDRESS=`curl -s "$BASE_URL/droplets/$DROPLET_ID?$AUTH" | jq -r '.droplet.ip_address'` echo "Execute bootstrap script" BOOTSTRAP_URL="https://gist.github.com/christianberg/6082234/raw/de37a310f4cd161846849abfc661371f01d7f4a7/bootstrap.sh" SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ssh $SSH_OPTIONS root@$IP_ADDRESS "curl -s $BOOTSTRAP_URL | bash" echo "*****************************" echo "* Droplet is ready to use!" echo "* IP address: $IP_ADDRESS" echo "*****************************" -
christianberg revised this gist
Jul 29, 2013 . 1 changed file with 23 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,29 @@ DROPLET_NAME="droplet-$TIMESTAMP" echo "Creating new Droplet $DROPLET_NAME with these specifications..." RESULT=`curl -s "$BASE_URL/droplets/new?$AUTH&name=$DROPLET_NAME&size_id=$SIZE_ID&image_id=$IMAGE_ID®ion_id=$REGION_ID&ssh_key_ids=$SSH_KEY_ID"` STATUS=`echo $RESULT | jq -r '.status'` echo "Status: $STATUS" if [ "$STATUS" != "OK" ]; then echo "Something went wrong:" echo $RESULT | jq . exit 1 fi DROPLET_ID=`echo $RESULT | jq '.droplet.id'` echo "Droplet with ID $DROPLET_ID created!" echo "Waiting for droplet to boot" for i in {1..60}; do DROPLET_STATUS=`curl -s "$BASE_URL/droplets/$DROPLET_ID?$AUTH" | jq -r '.droplet.status'` [ "$DROPLET_STATUS" == 'active' ] && break echo -n '.' sleep 5 done if [ "$DROPLET_STATUS" != 'active' ]; then echo "Droplet did not boot in time. Status: $DROPLET_STATUS" exit 1 fi IP_ADDRESS=`curl -s "$BASE_URL/droplets/$DROPLET_ID?$AUTH" | jq -r '.droplet.ip_address'` echo "Droplet is ready to use!" echo "IP address: $IP_ADDRESS" -
christianberg revised this gist
Jul 26, 2013 . 1 changed file with 44 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,44 @@ #!/bin/bash set -e SECRETFILE=~/.digitalocean if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then if [ -e $SECRETFILE ]; then . $SECRETFILE fi fi if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then echo "You need to set the environment variables DIGOCEAN_ID and DIGOCEAN_KEY" echo "or provide them in the file $SECRETFILE" exit 1 fi BASE_URL='https://api.digitalocean.com' AUTH="client_id=$DIGOCEAN_ID&api_key=$DIGOCEAN_KEY" REGION_NAME="Amsterdam 1" SIZE_NAME="512MB" IMAGE_NAME="Ubuntu 13.04 x64" REGION_ID=`curl -s "$BASE_URL/regions?$AUTH" | jq ".regions | map(select(.name==\"$REGION_NAME\"))[0].id"` echo "ID of Region $REGION_NAME is $REGION_ID" SIZE_ID=`curl -s "$BASE_URL/sizes?$AUTH" | jq ".sizes | map(select(.name==\"$SIZE_NAME\"))[0].id"` echo "ID of Size $SIZE_NAME is $SIZE_ID" IMAGE_ID=`curl -s "$BASE_URL/images?$AUTH" | jq ".images | map(select(.name==\"$IMAGE_NAME\"))[0].id"` echo "ID of Image $IMAGE_NAME is $IMAGE_ID" SSH_KEY_ID=`curl -s "$BASE_URL/ssh_keys?$AUTH" | jq '.ssh_keys[0].id'` echo "Activating SSH Key with ID $SSH_KEY_ID" TIMESTAMP=`date '+%Y%m%d%H%M%S'` DROPLET_NAME="droplet-$TIMESTAMP" echo "Creating new Droplet $DROPLET_NAME with these specifications..." RESULT=`curl -s "$BASE_URL/droplets/new?$AUTH&name=$DROPLET_NAME&size_id=$SIZE_ID&image_id=$IMAGE_ID®ion_id=$REGION_ID&ssh_key_ids=$SSH_KEY_ID"` STATUS=`echo $RESULT | jq '.status'` echo "Status: $STATUS" DROPLET_ID=`echo $RESULT | jq '.droplet.id'` echo "Droplet with ID $DROPLET_ID created!" -
christianberg created this gist
Jul 25, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ #!/bin/bash