Skip to content

Instantly share code, notes, and snippets.

@sanderpick
Last active August 13, 2019 09:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanderpick/016c2662edb46e1d4dcddfd0a1f2d28c to your computer and use it in GitHub Desktop.
Save sanderpick/016c2662edb46e1d4dcddfd0a1f2d28c to your computer and use it in GitHub Desktop.
Installs a Textile cafe node on Linux
#!/usr/bin/env bash
set -e
while getopts r:u:p: option
do
case "${option}"
in
r) RELEASE=${OPTARG};;
u) URL=${OPTARG};;
p) IP=${OPTARG};;
esac
done
[[ -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; }
# install
wget https://github.com/textileio/textile-go/releases/download/"$RELEASE"/textile-go_"$RELEASE"_linux-amd64.tar.gz
tar xvfz textile-go_"$RELEASE"_linux-amd64.tar.gz
rm textile-go_"$RELEASE"_linux-amd64.tar.gz
sudo ./install.sh
# init
textile init -s $(textile wallet init | tail -n1) --server --cafe-open --cafe-url="$URL" --cafe-public-ip="$IP" --cafe-bind-addr=0.0.0.0:40601 --gateway-bind-addr=0.0.0.0:5050 --swarm-ports=4001
# textile systemctl service
sudo bash -c 'cat >/lib/systemd/system/textile.service <<EOL
[Unit]
Description=textile
[Service]
ExecStart=/usr/local/bin/textile daemon
Restart=always
User=ec2-user
Group=ec2-user
[Install]
WantedBy=multi-user.target
EOL'
# enable the new services
sudo systemctl daemon-reload
sudo systemctl enable textile.service
sudo systemctl start textile
# echo new node info
sleep 5
echo "version:" $(textile version)
echo "peer: " $(textile peer)
echo "address:" $(textile address)
@carsonfarmer
Copy link

carsonfarmer commented Dec 31, 2018

Usage:

./cafe_install.sh -r 1.0.0 -u https://mycafe.com -p 18.144.12.134

@bafu
Copy link

bafu commented Aug 13, 2019

@sanderpick I updated this script based on current release (v0.6.9) and verified it on an AWS EC2 instance. Fell free to check it: https://gist.github.com/bafu/dc7487929268050ca48a0fd7a8a98b72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment