Blame view

Vagrantfile 2.13 KB
89ea5a93   Antonio Terceiro   Add basic Vagrant...
1
2
3
# -*- mode: ruby -*-
# vi: set ft=ruby :

aede9435   Antonio Terceiro   centralize IP con...
4
5
require 'yaml'

bf4e46ee   Antonio Terceiro   lxc: cache sudo c...
6
load './local.rake' if File.exists?('local.rake')
bf4e46ee   Antonio Terceiro   lxc: cache sudo c...
7

89ea5a93   Antonio Terceiro   Add basic Vagrant...
8
9
10
11
# 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|
0bffa549   Rodrigo Souto   Change centos box...
12
  config.vm.box = ENV.fetch("VAGRANT_BOX", 'seocam/centos-7.0')
9749cb50   Antonio Terceiro   simplify deployme...
13
14
  proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
  if proxy
cdd7e562   Antonio Terceiro   start over
15
    config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy]
9749cb50   Antonio Terceiro   simplify deployme...
16
17
  end

57ea5789   Antonio Terceiro   Support using lxc...
18
19
20
21
22
23
24
  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
aede9435   Antonio Terceiro   centralize IP con...
25

a435fc6c   Antonio Terceiro   Vagrantfile: move...
26
  config.vm.define 'database' do |database|
dcbacf46   Sergio Oliveira   Override vm confi...
27
28
    database.vm.provider "virtualbox" do |vm, override|
      override.vm.network 'private_network', ip: ips['database'] if ips
57ea5789   Antonio Terceiro   Support using lxc...
29
    end
a435fc6c   Antonio Terceiro   Vagrantfile: move...
30
  end
9de7b2b9   Paulo Tada   Adding the mezuro...
31

b02ece51   Antonio Terceiro   Prepare for multi...
32
  config.vm.define 'integration' do |integration|
dcbacf46   Sergio Oliveira   Override vm confi...
33
34
    integration.vm.provider "virtualbox" do |vm, override|
      override.vm.network 'private_network', ip: ips['integration'] if ips
57ea5789   Antonio Terceiro   Support using lxc...
35
36
      vm.memory = 1024
      vm.cpus = 2
4af809f5   Antonio Terceiro   integration: incr...
37
    end
b02ece51   Antonio Terceiro   Prepare for multi...
38
  end
9de7b2b9   Paulo Tada   Adding the mezuro...
39

b02ece51   Antonio Terceiro   Prepare for multi...
40
  config.vm.define 'email' do |email|
dcbacf46   Sergio Oliveira   Override vm confi...
41
42
    email.vm.provider "virtualbox" do |vm, override|
      override.vm.network 'private_network', ip: ips['email'] if ips
57ea5789   Antonio Terceiro   Support using lxc...
43
    end
b02ece51   Antonio Terceiro   Prepare for multi...
44
  end
9de7b2b9   Paulo Tada   Adding the mezuro...
45

b02ece51   Antonio Terceiro   Prepare for multi...
46
  config.vm.define 'social' do |social|
dcbacf46   Sergio Oliveira   Override vm confi...
47
48
    social.vm.provider "virtualbox" do |vm, override|
      override.vm.network 'private_network', ip: ips['social'] if ips
57ea5789   Antonio Terceiro   Support using lxc...
49
    end
b02ece51   Antonio Terceiro   Prepare for multi...
50
  end
9de7b2b9   Paulo Tada   Adding the mezuro...
51
52
53
54
55
56
57

  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

65f108fe   Paulo Tada   Adding machine on...
58
59
60
61
62
63
  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

37b9ba48   Paulo Tada   Removing workarou...
64
  config.vm.define 'reverseproxy' do |reverseproxy|
dcbacf46   Sergio Oliveira   Override vm confi...
65
66
    reverseproxy.vm.provider "virtualbox" do |vm, override|
      override.vm.network 'private_network', ip: ips['reverseproxy'] if ips
57ea5789   Antonio Terceiro   Support using lxc...
67
68
69
    end
    if File.exist?("tmp/preconfig.#{env}.stamp")
      reverseproxy.ssh.port =  File.read("tmp/preconfig.#{env}.stamp").strip.to_i
0433524f   Antonio Terceiro   Add `preconfig` t...
70
71
      reverseproxy.ssh.host = ips['reverseproxy']
    end
b02ece51   Antonio Terceiro   Prepare for multi...
72
  end
89ea5a93   Antonio Terceiro   Add basic Vagrant...
73
end