extract vagrantfile shared bits
This commit is contained in:
1 parent
a48777e482
commit
d24e75f76b
3 files changed
+75
-68
No files matched your search
Vendored
+7
-53
@@ -1,8 +1,8 @@
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
vm_ip = "172.16.0.3" # arbitrary private IP
|
||||
require './vagrant-common.rb'
|
||||
|
||||
go_version = "1.4.2"
|
||||
vm_ip = "172.16.0.3" # arbitrary private IP
|
||||
|
||||
pkgs = %w(
|
||||
lxc-docker
|
||||
@@ -16,52 +16,6 @@ pkgs = %w(
|
||||
bc
|
||||
)
|
||||
|
||||
go_path = "/usr/local/go/bin"
|
||||
|
||||
$install_build_deps = <<SCRIPT
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-key adv \
|
||||
--keyserver hkp://keyserver.ubuntu.com:80 \
|
||||
--recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
|
||||
echo 'deb https://get.docker.io/ubuntu docker main' \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
apt-get -qq update
|
||||
apt-get -qq install --no-install-recommends #{pkgs.join(' ')}
|
||||
SCRIPT
|
||||
|
||||
$install_go_toochain = <<SCRIPT
|
||||
curl -s https://storage.googleapis.com/golang/go#{go_version}.linux-amd64.tar.gz \
|
||||
| tar xz -C /usr/local
|
||||
#{go_path}/go clean -i net
|
||||
#{go_path}/go install -tags netgo std
|
||||
SCRIPT
|
||||
|
||||
$tweak_user_env = <<SCRIPT
|
||||
echo 'export GOPATH="${HOME}"' \
|
||||
>> ~vagrant/.profile
|
||||
echo 'export PATH="${HOME}/bin:#{go_path}:${PATH}"' \
|
||||
>> ~vagrant/.profile
|
||||
ln -sf ~vagrant/src/github.com/weaveworks/weave ~vagrant/
|
||||
sudo chown -R vagrant:vagrant ~vagrant/src
|
||||
SCRIPT
|
||||
|
||||
$tweak_docker_daemon = <<SCRIPT
|
||||
usermod -a -G docker vagrant
|
||||
echo 'DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"' \
|
||||
>> /etc/default/docker
|
||||
service docker restart
|
||||
SCRIPT
|
||||
|
||||
$cleanup = <<SCRIPT
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
## Who the hell thinks official images have to have both of these?
|
||||
/etc/init.d/chef-client stop
|
||||
/etc/init.d/puppet stop
|
||||
apt-get -qq remove puppet chef
|
||||
apt-get -qq autoremove
|
||||
killall -9 chef-client
|
||||
SCRIPT
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
config.vm.box = "ubuntu/ubuntu-14.10-amd64"
|
||||
@@ -76,11 +30,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.synced_folder ".", "/home/vagrant/src/github.com/weaveworks/weave"
|
||||
|
||||
config.vm.provision :shell, :inline => $install_build_deps
|
||||
config.vm.provision :shell, :inline => $install_go_toochain
|
||||
config.vm.provision :shell, :inline => $tweak_user_env, :privileged => false
|
||||
config.vm.provision :shell, :inline => $tweak_docker_daemon
|
||||
config.vm.provision :shell, :inline => $cleanup
|
||||
install_build_deps config.vm, pkgs
|
||||
install_go_toochain config.vm
|
||||
tweak_user_env config.vm
|
||||
tweak_docker_daemon config.vm
|
||||
cleanup config.vm
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user