-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
152 lines (131 loc) · 4.77 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# -*- mode: ruby -*-
# vi: set ft=ruby :
features = {
# enable if provisioning fails
:chef_verbose => false,
# boot VirtualBox with GUI - usually just an annoying window, but helpful if you can't connect via SSH
:gui => false,
# run a SOLR server
:solr => true,
# enable Rabbit MQ
:rabbit_mq => true,
# if enabled, set the "t3org.dev" hostname to 192.168.156.124 in your local /etc/hosts
:varnish => false,
# is configured for PHPSTORM on port 9000 by default - check below to change the settings
:xdebug => false,
}
# if you don't want to develop on the TER FE or Solr search itself, feel free to comment out the t3o-solr part
vms = {
"t3o-web" => {
:hostname => "t3org.dev",
:ipaddress => "192.168.156.122",
:run_list => "role[typo3],role[t3org]",
:cpus => "2",
:memory => "1024"
},
}
if features[:rabbit_mq]
vms["t3o-web"][:run_list] += ',role[t3org-rabbitmq]'
end
if features[:solr]
vms["t3o-solr"] = {
:hostname => "t3o-solr.dev",
:ipaddress => "192.168.156.123",
:run_list => "role[solr]",
:cpus => "1",
:memory => "1024"
}
end
if features[:varnish]
vms["t3o-proxy"] = {
:hostname => "t3-proxy.dev",
:ipaddress => "192.168.156.124",
:run_list => "role[t3org-proxy]",
:cpus => "1",
:memory => "512"
}
end
if defined?(::VagrantPlugins::LibrarianChef)
# it will just use its own cookbooks and not the one we added in this repo
raise 'The vagrant plugin "vagrant-librarian-chef" is known to cause issues during provision. Please uninstall it by running "vagrant plugin uninstall vagrant-librarian-chef".'
end
Vagrant::Config.run do |global_config|
vms.each_pair do |name, options|
global_config.vm.define name do |config|
ipaddress = options[:ipaddress]
config.ssh.max_tries = 100
config.vm.box = "squeeze"
config.vm.box_url = "http://st-g.de/fileadmin/downloads/2012-10/squeeze.box"
config.vm.boot_mode = features[:gui] ? :gui : :headless
config.vm.network :hostonly, ipaddress
config.vm.host_name = name
if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.2')
share_folder_options = {:create => true, :nfs => false, :mount_options => ['dmode=777','fmode=777']}
else
share_folder_options = {:create => true, :nfs => false, :extra => 'dmode=777,fmode=777'}
end
if name == "t3o-web"
if (RUBY_PLATFORM =~ /mingw32/).nil?
# May only run on non-Windows systems (symlinks won't work otherwise)
config.vm.share_folder "package", "/var/cache/t3org.dev", "./tmp/package", share_folder_options
config.vm.share_folder "web", "/var/www/vhosts/t3org.dev", "./web", share_folder_options
end
end
config.vm.share_folder "apt-cache", "/var/cache/apt/archives", "./tmp/apt", {:create => true}
# set auto_update to false, if do NOT want to check the correct additions
# version when booting this machine
#config.vbguest.auto_update = false
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.roles_path = ["roles"]
chef.data_bags_path = ["data_bags"]
chef.json = {}
unless ENV['REINSTALL'].nil?
chef.json.merge! ({
:t3org => {
:forceInstall => true,
}
})
end
# uncomment to enable xdebug
if features[:xdebug]
chef.json.merge! ({
:dev => {
:xdebug => {
:remote => {
:enable => true,
:host => '10.0.2.2',
:port => 9000,
:idekey => 'PHPSTORM',
}
}
}
})
end
# Turn on verbose Chef logging if necessary
chef.log_level = features[:chef_verbose] ? :debug : :info
# List the recipies you are going to work on/need.
run_list = []
run_list << "role[debian]"
run_list << "role[base]"
run_list << "role[vagrant]"
run_list << ENV['CHEF_RUN_LIST'].split(",") if ENV.has_key?('CHEF_RUN_LIST')
chef.run_list = [run_list, options[:run_list].split(",")].flatten
end
config.vm.customize [
"modifyvm", :id,
"--name", name,
"--memory", options[:memory] || "1024",
"--cpus", options[:cpus] || "1"
]
config.vm.customize [
"setextradata", :id,
"VBoxInternal2/SharedFoldersEnableSymlinksCreate/package", "1"
]
config.vm.customize [
"setextradata", :id,
"VBoxInternal2/SharedFoldersEnableSymlinksCreate/web", "1"
]
end
end
end