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"
|
2013-06-24 18:01:51 -04:00
|
|
|
BOX_URI = "http://files.vagrantup.com/precise64.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
|
2013-06-24 18:01:51 -04:00
|
|
|
pkg_cmd << "apt-get update -qq; apt-get install -y python-software-properties; " \
|
|
|
|
"add-apt-repository -y ppa:dotcloud/docker-golang/ubuntu; apt-get update -qq; " \
|
|
|
|
"apt-get install -y linux-image-generic-lts-raring lxc git aufs-tools golang-stable make; " \
|
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; " \
|
2013-06-24 18:01:51 -04:00
|
|
|
"pip install -q -r #{CFG_PATH}/requirements.txt; " \
|
2013-05-01 14:20:10 -04:00
|
|
|
"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
|