demo / network-computer
Public
Copy of github.com/askrobots/network-computer (MIT): a desk you reach from anything. The original lives on GitHub.
GitStable demo
README: say this is a copy and where the original is
cde82c2
13 hours, 36 minutes ago
History
create-vultr.sh · 1.3 KB · 26 lines
| 1 | #!/bin/sh |
| 2 | # Create a Vultr instance in Dallas (dfw) and provision it. |
| 3 | # Needs: vultr-cli (brew install vultr-cli) and VULTR_API_KEY set, |
| 4 | # or ~/.vultr-cli.yaml. Get a key at https://my.vultr.com/settings/#settingsapi |
| 5 | # Usage: infra/create-vultr.sh [name] [region] [plan] |
| 6 | set -e |
| 7 | NAME=${1:-nc-dallas}; REGION=${2:-dfw}; PLAN=${3:-vc2-2c-4gb} |
| 8 | DIR=$(dirname "$0") |
| 9 | command -v vultr-cli >/dev/null || { echo "install vultr-cli: brew install vultr-cli"; exit 1; } |
| 10 | |
| 11 | # newest Ubuntu 24.04 image id, and an SSH key id (upload your key if none) |
| 12 | OS=$(vultr-cli os list | awk '/Ubuntu 24.04/{print $1; exit}') |
| 13 | [ -n "$OS" ] || { echo "could not find Ubuntu 24.04 OS id"; exit 1; } |
| 14 | KEY=$(vultr-cli ssh-key list | awk 'NR==2{print $1}') |
| 15 | [ -n "$KEY" ] || { echo "no SSH key in Vultr. Add one:"; echo " vultr-cli ssh-key create --name mac --key \"\$(cat ~/.ssh/id_ed25519.pub)\""; exit 1; } |
| 16 | |
| 17 | echo "creating $NAME in $REGION ($PLAN)..." |
| 18 | ID=$(vultr-cli instance create --region "$REGION" --plan "$PLAN" --os "$OS" --host "$NAME" --ssh-keys "$KEY" | awk '/^ID/{print $2}') |
| 19 | echo "instance $ID, waiting for IP..." |
| 20 | IP="" |
| 21 | for i in $(seq 1 40); do |
| 22 | IP=$(vultr-cli instance get "$ID" | awk '/^MAIN IP/{print $3}') |
| 23 | [ -n "$IP" ] && [ "$IP" != "0.0.0.0" ] && break; sleep 5 |
| 24 | done |
| 25 | echo "ip: $IP" |
| 26 | sh "$DIR/provision-host.sh" "$IP" "$NAME" |