auto-mc-redux/deploy.sh

34 lines
870 B
Bash
Executable file

#!/usr/bin/env bash
# required for the complex pipes in the machine function
shopt -s lastpipe
install_dir="$(dirname "$(readlink -f "$0")")" # find the install directory
source "$install_dir/functions.sh"
#TODO: add these to config create, probably with a select menu or something
size="s-2vcpu-4gb"
reigon="sfo3"
config get
keys check
machine create
machine show ipv4 | jq .ip_address | read ipv4_address
echo "Machine created at $ipv4_address!"
if ! firewall check; then
firewall create
else
echo "Firewall rule already exists"
fi
latest=`curl -s https://api.papermc.io/v2/projects/paper/ | jq -r .versions[-1]`
versionprompt
echo "Waiting for machine to respond"
# send pings every second, waiting for 1 second
until ping -w 1 -c 1 $ip_address >/dev/null 2>&1; do
echo -n '.'
sleep 1
done
cat <(cat <(echo VERSION=$version) ./automate.sh)
#machine destroy