Last active
August 29, 2015 14:14
-
-
Save darron/fbcf00c2a3ee88de27cf to your computer and use it in GitHub Desktop.
User data for Digital Ocean octohost first boot.
This file contains hidden or 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 | |
export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) | |
export CONSUL_KEY=$(consul keygen) | |
service consul stop | |
rm -rf /var/cache/octohost/* | |
sudo cat > /etc/consul.d/default.json << EOL | |
{ | |
"data_dir": "/var/cache/octohost", | |
"server": true, | |
"bootstrap": true, | |
"client_addr": "0.0.0.0", | |
"advertise_addr": "$PUBLIC_IPV4", | |
"datacenter": "dc1", | |
"node_name": "octohost", | |
"enable_syslog": true, | |
"encrypt": "$CONSUL_KEY" | |
} | |
EOL | |
service consul start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment