Skip to content

Instantly share code, notes, and snippets.

@cbednarski
Last active September 27, 2020 17:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save cbednarski/8a999e51d8b094ccd74b to your computer and use it in GitHub Desktop.
Save cbednarski/8a999e51d8b094ccd74b to your computer and use it in GitHub Desktop.
Ubuntu installer script for consul
set -x
mkdir -p /tmp/consul
cd /tmp/consul
# Consul Configuration File
tee consul.json <<CONSULCONFIG
{
"bootstrap_expect": 3,
"client_addr": "0.0.0.0",
"data_dir": "/var/lib/consul",
"datacenter": "vagrant",
"enable_syslog": true,
"log_level": "INFO",
"server": true,
"ui_dir": "/opt/consul-ui"
}
CONSULCONFIG
# Consul Upstart Script
tee consul.upstart.conf <<CONSULUPSTART
# /etc/inid/consul.conf
exec consul agent -config-dir /etc/consul
CONSULUPSTART
# Download things
wget -q -nc https://dl.bintray.com/mitchellh/consul/0.5.0_linux_amd64.zip
wget -q -nc https://dl.bintray.com/mitchellh/consul/0.5.0_web_ui.zip
# Update
apt-get update -qq
apt-get install -y unzip
# Install everything
unzip -o 0.5.0_linux_amd64.zip
unzip -o 0.5.0_web_ui.zip
stop consul || true
cp consul /usr/local/bin/consul
mkdir -p /opt/consul-ui
cp -R dist/* /opt/consul-ui
mkdir -p /etc/consul
mkdir -p /var/lib/consul
cp consul.json /etc/consul/consul.json
cp consul.upstart.conf /etc/init/consul.conf
restart consul || start consul
@malceore
Copy link

Works great, thanks a bunch!

@peppiii
Copy link

peppiii commented Apr 5, 2019

Works great, Thanks

@peppiii
Copy link

peppiii commented Apr 5, 2019

Works great, Thanks

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