|
@@ -2,8 +2,8 @@
|
|
# vi: set ft=ruby :
|
|
# vi: set ft=ruby :
|
|
|
|
|
|
BOX_NAME = "docker-ci"
|
|
BOX_NAME = "docker-ci"
|
|
-BOX_URI = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
|
|
|
|
-AWS_AMI = "ami-10314d79"
|
|
|
|
|
|
+BOX_URI = "http://files.vagrantup.com/precise64.box"
|
|
|
|
+AWS_AMI = "ami-d0f89fb9"
|
|
DOCKER_PATH = "/data/docker"
|
|
DOCKER_PATH = "/data/docker"
|
|
CFG_PATH = "#{DOCKER_PATH}/testing/buildbot"
|
|
CFG_PATH = "#{DOCKER_PATH}/testing/buildbot"
|
|
on_vbox = File.file?("#{File.dirname(__FILE__)}/.vagrant/machines/default/virtualbox/id") | \
|
|
on_vbox = File.file?("#{File.dirname(__FILE__)}/.vagrant/machines/default/virtualbox/id") | \
|
|
@@ -23,16 +23,13 @@ Vagrant::Config.run do |config|
|
|
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
|
|
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
|
|
# Add memory limitation capabilities
|
|
# Add memory limitation capabilities
|
|
pkg_cmd = 'sed -Ei \'s/^(GRUB_CMDLINE_LINUX_DEFAULT)=.+/\\1="cgroup_enable=memory swapaccount=1 quiet"/\' /etc/default/grub; '
|
|
pkg_cmd = 'sed -Ei \'s/^(GRUB_CMDLINE_LINUX_DEFAULT)=.+/\\1="cgroup_enable=memory swapaccount=1 quiet"/\' /etc/default/grub; '
|
|
- # Adjust kernel
|
|
|
|
- pkg_cmd << "apt-get update -qq; "
|
|
|
|
- if on_vbox
|
|
|
|
- pkg_cmd << "apt-get install -q -y linux-image-extra-`uname -r`; "
|
|
|
|
- else
|
|
|
|
- pkg_cmd << "apt-get install -q -y linux-image-generic; "
|
|
|
|
- end
|
|
|
|
|
|
+ # Install new kernel
|
|
|
|
+ pkg_cmd << "apt-get update -qq; apt-get install -q -y linux-image-generic-lts-raring; "
|
|
|
|
|
|
# Deploy buildbot CI
|
|
# Deploy buildbot CI
|
|
- pkg_cmd << "apt-get install -q -y python-dev python-pip supervisor; " \
|
|
|
|
|
|
+ pkg_cmd << "echo 'America/Los_Angeles' > /etc/timezone; " \
|
|
|
|
+ "dpkg-reconfigure --frontend noninteractive tzdata; " \
|
|
|
|
+ "apt-get install -q -y python-dev python-pip supervisor; " \
|
|
"pip install -r #{CFG_PATH}/requirements.txt; " \
|
|
"pip install -r #{CFG_PATH}/requirements.txt; " \
|
|
"chown #{USER}.#{USER} /data; cd /data; " \
|
|
"chown #{USER}.#{USER} /data; cd /data; " \
|
|
"#{CFG_PATH}/setup.sh #{USER} #{CFG_PATH} #{ENV['BUILDBOT_PWD']} " \
|
|
"#{CFG_PATH}/setup.sh #{USER} #{CFG_PATH} #{ENV['BUILDBOT_PWD']} " \
|
|
@@ -40,12 +37,27 @@ Vagrant::Config.run do |config|
|
|
"#{ENV['SMTP_PWD']} #{ENV['EMAIL_RCP']}; " \
|
|
"#{ENV['SMTP_PWD']} #{ENV['EMAIL_RCP']}; " \
|
|
"#{CFG_PATH}/setup_credentials.sh #{USER} " \
|
|
"#{CFG_PATH}/setup_credentials.sh #{USER} " \
|
|
"#{ENV['REGISTRY_USER']} #{ENV['REGISTRY_PWD']}; "
|
|
"#{ENV['REGISTRY_USER']} #{ENV['REGISTRY_PWD']}; "
|
|
- # Install docker and testing dependencies
|
|
|
|
|
|
+ # Install docker
|
|
|
|
+ pkg_cmd << "mkdir /mnt/docker; ln -s /mnt/docker /var/lib/docker; " \
|
|
|
|
+ "wget -q -O - https://get.docker.io/gpg | apt-key add -; " \
|
|
|
|
+ "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list; " \
|
|
|
|
+ "apt-get update -qq; apt-get install -yq lxc-docker; "
|
|
|
|
+ # Enable docker host to run docker daemon in containers (dind)
|
|
|
|
+ pkg_cmd << "/sbin/stop docker; "
|
|
|
|
+ pkg_cmd << "DIND_CMD=\" umount /sys/fs/cgroup/*; umount /sys/fs/cgroup\\n" \
|
|
|
|
+ " mount -t tmpfs none /sys/fs/cgroup; cd /sys/fs/cgroup\\n" \
|
|
|
|
+ " for C in \x5C\x24(awk '{print \x5C\x241}' < /proc/cgroups | grep -v subsys | grep -v memory);\\n" \
|
|
|
|
+ " do mkdir \x5C\x24C; mount -t cgroup none -o \x5C\x24C \x5C\x24C; done;\\n" \
|
|
|
|
+ " /usr/bin/docker -d\"; "
|
|
|
|
+ pkg_cmd << "sed -Ei 's~start on filesystem.+~start on filesystem and started lxc-net~' /etc/init/docker.conf; "
|
|
|
|
+ pkg_cmd << "sed -Ei 's~ /usr/bin/docker -d~'\"$DIND_CMD\"'~' /etc/init/docker.conf; "
|
|
|
|
+ # Install testing dependencies
|
|
pkg_cmd << "curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | " \
|
|
pkg_cmd << "curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | " \
|
|
" tar -v -C /usr/local -xz; ln -s /usr/local/go/bin/go /usr/bin/go; " \
|
|
" tar -v -C /usr/local -xz; ln -s /usr/local/go/bin/go /usr/bin/go; " \
|
|
"curl -s https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2 | " \
|
|
"curl -s https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2 | " \
|
|
" tar jx -C /usr/bin --strip-components=2 phantomjs-1.9.1-linux-x86_64/bin/phantomjs; " \
|
|
" tar jx -C /usr/bin --strip-components=2 phantomjs-1.9.1-linux-x86_64/bin/phantomjs; " \
|
|
- "DEBIAN_FRONTEND=noninteractive apt-get install -q -y lxc git mercurial aufs-tools make libfontconfig; " \
|
|
|
|
|
|
+ "DEBIAN_FRONTEND=noninteractive apt-get install -qy lxc git mercurial aufs-tools " \
|
|
|
|
+ " make libfontconfig libevent-dev; " \
|
|
"export GOPATH=/data/docker-dependencies; go get -d github.com/dotcloud/docker; " \
|
|
"export GOPATH=/data/docker-dependencies; go get -d github.com/dotcloud/docker; " \
|
|
"rm -rf ${GOPATH}/src/github.com/dotcloud/docker; "
|
|
"rm -rf ${GOPATH}/src/github.com/dotcloud/docker; "
|
|
# Activate new kernel options
|
|
# Activate new kernel options
|