#!/bin/bash set -ex # Deploy a vm for garage server with mycelium for s3 server tfcmd deploy vm --name s3_server --ssh ~/.ssh/id_rsa.pub --cpu 8 --memory 16 --disk 50 --rootfs 10 sleep 6 # wait deployment OUTPUT=$(tfcmd get vm s3_server 2>&1 | tail -n +3 | tr { '\n' | tr , '\n' | tr } '\n') MYCELIUM_IP=$(echo "$OUTPUT" | grep -Eo '"mycelium_ip"[^,]*' | awk -F'"' '{print $4}') # Expose S3 server over mycelium IP ssh root@$MYCELIUM_IP " wget https://garagehq.deuxfleurs.fr/_releases/v1.0.0/x86_64-unknown-linux-musl/garage chmod +x garage mv garage /usr/local/bin cat > /etc/garage.toml < output.log 2>&1 & "