From 15e89564f96458b4b9123b69b1dcb7f2c8ed0efd Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 14 Oct 2018 06:34:46 -0400 Subject: add some scripts to launch and terminate the machine --- bin/launch | 30 ++++++++++++++++++++++++++++++ bin/terminate | 5 +++++ 2 files changed, 35 insertions(+) create mode 100755 bin/launch create mode 100755 bin/terminate (limited to 'bin') diff --git a/bin/launch b/bin/launch new file mode 100755 index 0000000..b6db692 --- /dev/null +++ b/bin/launch @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -eu +set -o pipefail + +echo "Creating droplet for tozt..." +id=$(doctl compute droplet create \ + tozt \ + --image debian-9-x64 \ + --region nyc3 \ + --size s-1vcpu-1gb \ + --ssh-keys 23160354 \ + --volumes 4206344e-cf4f-11e8-a5a7-0a58ac1465db \ + --format ID \ + --no-header \ + --wait) +echo "Created droplet with id $id" + +echo "Assigning floating ip to tozt..." +# XXX this returns an error for some reason, but actually succeeds: +# Error: could not assign IP to droplet: json: cannot unmarshal number +# 2328181259 into Go struct field Action.resource_id of type int +doctl compute floating-ip-action assign 138.197.58.11 "$id" || true +echo "Done assigning floating ip" + +sleep 5 + +echo "Provisioning droplet..." +"$(dirname "$0")/bootstrap" + +echo "Done" diff --git a/bin/terminate b/bin/terminate new file mode 100755 index 0000000..ad4c337 --- /dev/null +++ b/bin/terminate @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -eu +set -o pipefail + +doctl compute droplet delete tozt -- cgit v1.2.3-54-g00ecf