die(){ echo "error: $1" >&2 exit 1 } set -e export HOME=/root cd "$HOME" stop rsyslog echo "configuring hostname from cloudformation and aws metadata service" configured_hostname="${CFN_INSTANCE_HOSTNAME}" configured_hostname_short=$(echo "${configured_hostname}" | cut -d'.' -f 1) private_hostname=$(curl -sL http://169.254.169.254/latest/meta-data/local-hostname) private_hostname_short=$(echo "${private_hostname}" | cut -d'.' -f 1) private_ipv4=$(curl -fsL http://169.254.169.254/latest/meta-data/local-ipv4) public_hostname=$(curl -fsL http://169.254.169.254/latest/meta-data/public-hostname || :) public_hostname_short=$(echo "${public_hostname}" | cut -d'.' -f 1) public_ipv4=$(curl -fsL http://169.254.169.254/latest/meta-data/public-ipv4 || :) echo "${configured_hostname_short}" > /etc/hostname hostname -b -F /etc/hostname sed -i '/127\.0\./d' /etc/hosts cat >>/etc/hosts <>/etc/hosts </etc/rsyslog.d/91-receive-container-logs.conf < /etc/ssl/certs/papertrail.pem cat >/etc/rsyslog.d/99-papertrail.conf </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" <