Last active
November 24, 2017 15:20
-
-
Save karampok/171701458b14c394387d359429197695 to your computer and use it in GitHub Desktop.
install-run-consul.sh
This file contains 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
#! /bin/bash | |
echo "Installing dependencies ..." | |
sudo apt-get update | |
sudo apt-get install -y unzip curl jq | |
echo "Determining Consul version to install ..." | |
CHECKPOINT_URL="https://checkpoint-api.hashicorp.com/v1/check" | |
if [ -z "$CONSUL_DEMO_VERSION" ]; then | |
CONSUL_DEMO_VERSION=$(curl -s "${CHECKPOINT_URL}"/consul | jq .current_version | tr -d '"') | |
fi | |
echo "Fetching Consul version ${CONSUL_DEMO_VERSION} ..." | |
cd /tmp/ | |
curl -s https://releases.hashicorp.com/consul/${CONSUL_DEMO_VERSION}/consul_${CONSUL_DEMO_VERSION}_linux_amd64.zip -o consul.zip | |
echo "Installing Consul version ${CONSUL_DEMO_VERSION} ..." | |
unzip consul.zip | |
sudo chmod +x consul | |
sudo mv consul /usr/bin/consul | |
sudo mkdir /etc/consul.d | |
sudo chmod a+w /etc/consul.d | |
consul agent -dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment