Skip to content

Instantly share code, notes, and snippets.

@sanderpick
Last active January 4, 2019 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanderpick/d9bfe8d051bae09db56841495050f20c to your computer and use it in GitHub Desktop.
Save sanderpick/d9bfe8d051bae09db56841495050f20c to your computer and use it in GitHub Desktop.
Deploys a Textile cafe node to a remote Linux host
#!/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
@carsonfarmer
Copy link

carsonfarmer commented Dec 31, 2018

Usage:

./cafe_init.sh -k mykey.pem -r 1.0.0.0 -p 18.144.12.134 -u https://mycafe.com

@sanderpick
Copy link
Author

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