2013-05-01 14:20:10 -04:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2013-05-01 18:25:58 -04:00
|
|
|
BOX_NAME = "ubuntu-dev"
|
|
|
|
BOX_URI = "http://cloud-images.ubuntu.com/raring/current/raring-server-cloudimg-vagrant-amd64-disk1.box"
|
2013-05-01 14:20:10 -04:00
|
|
|
VM_IP = "192.168.33.21"
|
|
|
|
USER = "vagrant"
|
|
|
|
GOPATH = "/data/docker"
|
|
|
|
DOCKER_PATH = "#{GOPATH}/src/github.com/dotcloud/docker"
|
|
|
|
CFG_PATH = "#{DOCKER_PATH}/hack/environment"
|
|
|
|
BUILDBOT_PATH = "/data/buildbot"
|
|
|
|
|
|
|
|
Vagrant::Config.run do |config|
|
|
|
|
# Setup virtual machine box
|
|
|
|
config.vm.box = BOX_NAME
|
|
|
|
config.vm.box_url = BOX_URI
|
|
|
|
config.vm.share_folder "v-data", DOCKER_PATH, "#{File.dirname(__FILE__)}/.."
|
|
|
|
config.vm.network :hostonly, VM_IP
|
|
|
|
# Stop if deployment has been done
|
|
|
|
config.vm.provision :shell, :inline => "[ ! -f /usr/bin/git ]"
|
|
|
|
# Touch for makefile
|
|
|
|
pkg_cmd = "touch #{DOCKER_PATH}; "
|
|
|
|
# Install docker dependencies
|
|
|
|
pkg_cmd << "export DEBIAN_FRONTEND=noninteractive; apt-get -qq update; " \
|
2013-06-14 08:09:07 -04:00
|
|
|
"apt-get install -q -y lxc bsdtar git aufs-tools golang make linux-image-extra-3.8.0-19-generic; " \
|
2013-05-01 14:20:10 -04:00
|
|
|
"chown -R #{USER}.#{USER} #{GOPATH}; " \
|
|
|
|
"install -m 0664 #{CFG_PATH}/bash_profile /home/#{USER}/.bash_profile"
|
|
|
|
config.vm.provision :shell, :inline => pkg_cmd
|
|
|
|
# Deploy buildbot CI
|
|
|
|
pkg_cmd = "apt-get install -q -y python-dev python-pip supervisor; " \
|
|
|
|
"pip install -r #{CFG_PATH}/requirements.txt; " \
|
|
|
|
"chown #{USER}.#{USER} /data; cd /data; " \
|
|
|
|
"#{CFG_PATH}/setup.sh #{USER} #{GOPATH} #{DOCKER_PATH} #{CFG_PATH} #{BUILDBOT_PATH}"
|
|
|
|
config.vm.provision :shell, :inline => pkg_cmd
|
|
|
|
end
|