Compare commits
No commits in common. "65ea59f48525cadddfef2c16c90136be30dd3097" and "26d1ca89508517d9c260a44b7290ee84e4df470c" have entirely different histories.
65ea59f485
...
26d1ca8950
3 changed files with 1 additions and 54 deletions
14
deploy.sh
14
deploy.sh
|
@ -18,12 +18,6 @@ else
|
||||||
echo "Firewall rule already exists"
|
echo "Firewall rule already exists"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: also add this to config create
|
|
||||||
if [ $DOMAIN ]; then
|
|
||||||
echo "Creating a domain record..."
|
|
||||||
domain A create
|
|
||||||
fi
|
|
||||||
|
|
||||||
versionprompt
|
versionprompt
|
||||||
echo -n "Waiting for machine to respond"
|
echo -n "Waiting for machine to respond"
|
||||||
# tests if ssh is up, waiting one second between attempts
|
# tests if ssh is up, waiting one second between attempts
|
||||||
|
@ -43,13 +37,7 @@ fi
|
||||||
echo "Now installing!"
|
echo "Now installing!"
|
||||||
ssh root@$ipv4_address < <(cat <(echo VERSION=$version) ./automate.sh)
|
ssh root@$ipv4_address < <(cat <(echo VERSION=$version) ./automate.sh)
|
||||||
|
|
||||||
if [ $DOMAIN ]; then
|
echo "Minecraft server started at IP: $ipv4_address"
|
||||||
echo "Minecraft server started on domain: auto-mc.$DOMAIN"
|
|
||||||
echo "(IP: $ipv4_address)"
|
|
||||||
else
|
|
||||||
echo "Minecraft server started at IP: $ipv4_address"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Would you like to enter the server console?"
|
echo "Would you like to enter the server console?"
|
||||||
|
|
||||||
if yes; then
|
if yes; then
|
||||||
|
|
37
functions.sh
37
functions.sh
|
@ -203,43 +203,6 @@ keys(){
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
domain(){
|
|
||||||
local type="$1"; shift
|
|
||||||
local command="$1"; shift
|
|
||||||
|
|
||||||
case $type in
|
|
||||||
A)
|
|
||||||
case $command in
|
|
||||||
create)
|
|
||||||
# requires $ipv4_address and $DOMAIN to be set
|
|
||||||
# we use a very short ttl on the record to avoid
|
|
||||||
# caching a deleted server
|
|
||||||
curl -s -X POST \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
|
||||||
-d '{"type":"A","name":"auto-mc","data":"'$ipv4_address'","ttl":180}' \
|
|
||||||
"https://api.digitalocean.com/v2/domains/$DOMAIN/records" > /dev/null
|
|
||||||
;;
|
|
||||||
delete)
|
|
||||||
# requires $DOMAIN to be set
|
|
||||||
domain_id="$(domain A show | jq .id)"
|
|
||||||
curl -s -X DELETE \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
|
||||||
"https://api.digitalocean.com/v2/domains/$DOMAIN/records/$domain_id" > /dev/null
|
|
||||||
;;
|
|
||||||
show)
|
|
||||||
curl -s -X GET \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
|
||||||
"https://api.digitalocean.com/v2/domains/$DOMAIN/records" |\
|
|
||||||
jq '.domain_records[] | select(.type == "A") | select(.name == "auto-mc")'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
machine(){
|
machine(){
|
||||||
local command="$1"; shift
|
local command="$1"; shift
|
||||||
local arg="$1"; shift
|
local arg="$1"; shift
|
||||||
|
|
|
@ -3,10 +3,6 @@ install_dir="$(dirname "$(readlink -f "$0")")" # find the install directory
|
||||||
source "$install_dir/functions.sh"
|
source "$install_dir/functions.sh"
|
||||||
|
|
||||||
data_dir get
|
data_dir get
|
||||||
config get
|
|
||||||
machine show ipv4 | jq -r .ip_address | read ipv4_address
|
machine show ipv4 | jq -r .ip_address | read ipv4_address
|
||||||
ssh root@$ipv4_address <<<mc-backup > "$data_dir/server.tar.zstd"
|
ssh root@$ipv4_address <<<mc-backup > "$data_dir/server.tar.zstd"
|
||||||
if [ $DOMAIN ]; then
|
|
||||||
domain A destroy
|
|
||||||
fi
|
|
||||||
machine destroy
|
machine destroy
|
||||||
|
|
Loading…
Add table
Reference in a new issue