Vagrantfile
2.13 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
load './local.rake' if File.exists?('local.rake')
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = ENV.fetch("VAGRANT_BOX", 'seocam/centos-7.0')
proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
if proxy
config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy]
end
env = ENV.fetch('SPB_ENV', 'local')
if File.exist?("config/#{env}/ips.yaml")
ips = YAML.load_file("config/#{env}/ips.yaml")
else
ips = nil
end
config.vm.define 'database' do |database|
database.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['database'] if ips
end
end
config.vm.define 'integration' do |integration|
integration.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['integration'] if ips
vm.memory = 1024
vm.cpus = 2
end
end
config.vm.define 'email' do |email|
email.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['email'] if ips
end
end
config.vm.define 'social' do |social|
social.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['social'] if ips
end
end
config.vm.define 'mezuro' do |mezuro|
mezuro.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['mezuro'] if ips
end
end
config.vm.define 'monitor' do |monitor|
monitor.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['monitor'] if ips
end
end
config.vm.define 'reverseproxy' do |reverseproxy|
reverseproxy.vm.provider "virtualbox" do |vm, override|
override.vm.network 'private_network', ip: ips['reverseproxy'] if ips
end
if File.exist?("tmp/preconfig.#{env}.stamp")
reverseproxy.ssh.port = File.read("tmp/preconfig.#{env}.stamp").strip.to_i
reverseproxy.ssh.host = ips['reverseproxy']
end
end
end