-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
70 lines (55 loc) · 1.86 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "vagrant"
if Vagrant::VERSION < "1.2.1"
raise "The Omnibus Build Lab is only compatible with Vagrant 1.2.1+"
end
host_project_path = File.expand_path("..", __FILE__)
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
project_name = "Aqueducts"
Vagrant.configure("2") do |config|
config.vm.hostname = "#{project_name}-omnibus-build-lab"
config.vm.define 'centos64' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "centos64"
end
config.vm.provider :virtualbox do |vb|
# Give enough horsepower to build without taking all day.
vb.customize [
"modifyvm", :id,
"--memory", "1536",
"--cpus", "2"
]
end
# Ensure a recent version of the Chef Omnibus packages are installed
config.omnibus.chef_version = :latest
# Enable the berkshelf-vagrant plugin
config.berkshelf.enabled = true
# The path to the Berksfile to use with Vagrant Berkshelf
config.berkshelf.berksfile_path = "./Berksfile"
#config.ssh.max_tries = 40
#config.ssh.timeout = 120
config.ssh.forward_agent = true
host_project_path = File.expand_path("..", __FILE__)
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
config.vm.synced_folder host_project_path, guest_project_path
# prepare VM to be an Omnibus builder
config.vm.provision :chef_solo do |chef|
chef.json = {
"omnibus" => {
"build_user" => "vagrant",
"build_dir" => guest_project_path,
"install_dir" => "/opt/#{project_name}"
}
}
chef.run_list = [
"recipe[omnibus::default]"
]
end
config.vm.provision :shell, :inline => <<-OMNIBUS_BUILD
export PATH=/usr/local/bin:$PATH
cd #{guest_project_path}
su vagrant -c "bundle install --binstubs"
su vagrant -c "bin/omnibus build project #{project_name}"
OMNIBUS_BUILD
end