Last active
August 29, 2015 14:23
-
-
Save darron/89a5e46599b0ab8937c1 to your computer and use it in GitHub Desktop.
Userdata for octohost on Digital Ocean with ZFS - be careful - it might eat your data.
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
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 | |
service docker stop | |
mkdir -p /var/zfs/ | |
truncate -s 20GB /var/zfs/docker.img # Use whatever size you'd like. | |
zpool create -f zroot /var/zfs/docker.img | |
zfs create -o mountpoint=/var/lib/docker-zfs zroot/docker | |
sudo cat > /etc/default/docker << EOL | |
# Docker Upstart and SysVinit configuration file | |
# Customize location of Docker binary (especially for development testing). | |
#DOCKER="/usr/local/bin/docker" | |
# Use DOCKER_OPTS to modify the daemon startup options. | |
DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --dns 8.8.8.8 --dns 8.8.4.4 --graph=/var/lib/docker-zfs --storage-driver=zfs" | |
# If you need Docker to use an HTTP proxy, it can also be specified here. | |
#export http_proxy="http://127.0.0.1:3128/" | |
# This is also a handy place to tweak where Docker's temporary files go. | |
#export TMPDIR="/mnt/bigdrive/docker-tmp" | |
EOL | |
service docker start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment