Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Userdata for octohost on Digital Ocean with ZFS - be careful - it might eat your data.
export PUBLIC_IPV4=$(curl -s
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": "",
"advertise_addr": "$PUBLIC_IPV4",
"datacenter": "dc1",
"node_name": "octohost",
"enable_syslog": true,
"encrypt": "$CONSUL_KEY"
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).
# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="-H tcp:// -H unix:///var/run/docker.sock --dns --dns --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=""
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
service docker start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment