./priv/roles/Common.sh in stacco-0.1.63 vs ./priv/roles/Common.sh in stacco-0.1.64

- old
+ new

@@ -60,5 +60,45 @@ fi chown -R root:syslog /var/log/upstart start rsyslog + + +provision_volume() { + device="$1"; shift + mntpt="$1"; shift + + mkfs.btrfs "${device}" 2>/dev/null || : + + mount "${device}" /mnt 2>/dev/null || : + btrfs filesystem resize max /mnt 2>/dev/null || : + umount /mnt 2>/dev/null || : + + mkdir -p "${mntpt}" + mount -t btrfs -o "rw,noatime,space_cache" "${device}" "${mntpt}" +} + +if [ -b "/dev/xvdc" ]; then + provision_volume "/dev/xvdc" "/var/lib/docker" +fi + +if [ -b "/dev/xvdd" ]; then + provision_volume "/dev/xvdd" "/var/lib/docker/vfs/dir" +fi + +if ! hash docker; then + echo "installing docker..." + echo 'deb http://get.docker.io/ubuntu docker main' > /etc/apt/sources.list.d/docker.list + apt-key adv --keyserver 'hkp://pgp.mit.edu:80' --recv-keys '36A1D7869245C8950F966E92D8576A8BA88D21E9' + apt-get update + apt-get install -qy lxc-docker + gpasswd -a ubuntu docker +fi + +echo "logging into ${DOCKER_REGISTRY_URL}..." +cat >"$HOME/.dockercfg" <<EOF +{"${DOCKER_REGISTRY_URL}": { + "auth": "${DOCKER_REGISTRY_AUTH}", + "email": "${DOCKER_REGISTRY_EMAIL}" +}} +EOF