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/bash | |
| set -e | |
| SECRETFILE=~/.digitalocean | |
| if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then | |
| if [ -e $SECRETFILE ]; then | |
| . $SECRETFILE | |
| fi | |
| fi |
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
| # this script expects $DOTOKEN variable with your digital ocean token | |
| # this script gets or creates smallest DO droplet and remotely executes script on it | |
| # afterwards, droplet is destroyed | |
| DROPLETNAME=example.com | |
| DOHOME="https://api.digitalocean.com/v2" | |
| cat <<EOF > .curlargs | |
| -s | |
| -H "Authorization: Bearer $DOTOKEN" |