summaryrefslogtreecommitdiffstats
path: root/bin/helpers/launch-mail
blob: 91ba1239cd697d8feaf3b476fc46490e8f8008ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -eu
set -o pipefail

echo "Creating droplet for mail..."
id=$(doctl \
    -t "$(cat /mnt/digitalocean)" \
    compute droplet create \
    mail \
    --image debian-9-x64 \
    --region nyc3 \
    --size s-1vcpu-1gb \
    --ssh-keys 23160354 \
    --format ID \
    --no-header \
    --wait)
echo "Created droplet with id $id"

echo "Assigning floating ip to mail..."
# 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 \
    -t "$(cat /mnt/digitalocean)" \
    compute floating-ip-action assign \
    159.89.254.14 \
    "$id" || true
echo "Done assigning floating ip"

echo "Provisioning droplet..."

# ...

echo "Done"