-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
53 lines (40 loc) · 1.63 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
# TODO: https://linear.app/quible/issue/QUI-63/reporting-cloudformation-installation-errors
set -e
set -x
BUCKET_LOCATION=https://quible-releases.s3.amazonaws.com
LATEST_COMMIT_SHA=`curl ${BUCKET_LOCATION}/latest`
SURREAL_DEB_FILENAME=surreal_1.5.5-1_amd64.deb
PACKAGE_DEB_FILENAME=quible-node_${LATEST_COMMIT_SHA}_amd64.deb
SURREAL_DEB_URL=${BUCKET_LOCATION}/${SURREAL_DEB_FILENAME}
PACKAGE_DEB_URL=${BUCKET_LOCATION}/${PACKAGE_DEB_FILENAME}
set +x
if [ ! -f /etc/quible-signer-key ]; then
echo "Signer key not configured. Configuring now..."
read -p "Enter hexadecimal ECDSA signer key: " QUIBLE_SIGNER_KEY
QUIBLE_SIGNER_KEY=${QUIBLE_SIGNER_KEY#0x}
if [ ${#QUIBLE_SIGNER_KEY} -ne 64 ]; then
echo "Error: key $QUIBLE_SIGNER_KEY does not match expected length"
exit 1
fi
echo $QUIBLE_SIGNER_KEY | sudo tee /etc/quible-signer-key
fi
set -x
curl -Sso /tmp/${SURREAL_DEB_FILENAME} ${SURREAL_DEB_URL}
curl -Sso /tmp/${PACKAGE_DEB_FILENAME} ${PACKAGE_DEB_URL}
sudo dpkg -i /tmp/${SURREAL_DEB_FILENAME}
sudo dpkg -i /tmp/${PACKAGE_DEB_FILENAME}
sudo ufw allow 9013
sudo ufw allow 9014
if ! curl -Ss -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"quible_checkHealth","params":[],"id":67}' 127.0.0.1:9013; then
set +x
echo healthcheck failed
exit 1
fi
set +x
EC2_PUBLIC_IP=`curl https://checkip.amazonaws.com`
echo "Local health check succeeded!"
echo "Use this command to check health from an external machine:"
cat <<EOF
curl -Ss -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"quible_checkHealth","params":[],"id":67}' ${EC2_PUBLIC_IP}:9013 | grep -q healthy
EOF