Last active
January 4, 2019 03:13
-
-
Save sanderpick/d9bfe8d051bae09db56841495050f20c to your computer and use it in GitHub Desktop.
Deploys a Textile cafe node to a remote Linux host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
while getopts k:r:u:p: option | |
do | |
case "${option}" | |
in | |
k) KEY=${OPTARG};; | |
r) RELEASE=${OPTARG};; | |
u) URL=${OPTARG};; | |
p) IP=${OPTARG};; | |
esac | |
done | |
[[ -z "$KEY" ]] && { echo "Please specify an SSH key, e.g., -k mykey.pem" ; exit 1; } | |
[[ -z "$RELEASE" ]] && { echo "Please specify a release tag, e.g., -r v1.0.0" ; exit 1; } | |
[[ -z "$URL" ]] && { echo "Please specify a public host URL, e.g., -u https://mycafe.com" ; exit 1; } | |
[[ -z "$IP" ]] && { echo "Please specify a public host IP address, e.g., -p 18.144.12.134" ; exit 1; } | |
# upload installer | |
scp -i "$KEY" cafe_install.sh ec2-user@"$IP":~/ | |
# run installer | |
echo "./cafe_install.sh -r $RELEASE -u $URL -p $IP" | ssh -i "$KEY" ec2-user@"$IP" /bin/bash |
Updated usage above ^. -u
is really only useful if you need HTTPS via a load balancer. We should probably make it optional to further convey that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: