Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save byteshiva/14e9bc560ca7d3d7dc6218b6020dc664 to your computer and use it in GitHub Desktop.

Select an option

Save byteshiva/14e9bc560ca7d3d7dc6218b6020dc664 to your computer and use it in GitHub Desktop.
Consul cluster EC2
# First node
export PRIVATE_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
docker run -d -h node1 -v /data:/data \
-p 8300:8300 \
-p 8301:8301 \
-p 8301:8301/udp \
-p 8302:8302 \
-p 8302:8302/udp \
-p 8400:8400 \
-p 8500:8500 \
-p 172.17.42.1:53:53/udp \
progrium/consul -server -advertise $PRIVATE_IP -bootstrap-expect 3
# Any other node
export PRIVATE_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
docker run -d -h $HOSTNAME.$ENV -v /data:/data \
-p 8300:8300 \
-p 8301:8301 \
-p 8301:8301/udp \
-p 8302:8302 \
-p 8302:8302/udp \
-p 8400:8400 \
-p 8500:8500 \
-p 172.17.42.1:53:53/udp \
progrium/consul -server -advertise $PRIVATE_IP -join consul-staging.import.io
# All the other nodes
docker run -d --name registrator \
-v /var/run/docker.sock:/tmp/docker.sock \
-h $HOSTNAME progrium/registrator consul://$PRIVATE_IP:8500
# Test Consul KV
curl -X PUT -d '362' http://consul-iodev.import.io:8500/v1/kv/frontend/staging/workflow_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment