From 57d13a0e637f3cfa2c09ec9d001e4476aef40cbe Mon Sep 17 00:00:00 2001 From: Paulo Tada Date: Thu, 29 Oct 2015 09:50:22 -0200 Subject: [PATCH] Changing provider from virtualbox to lxc --- Rakefile | 2 +- Vagrantfile | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Rakefile b/Rakefile index bad4894..db2379a 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ chake_rsync_options += ' --exclude src' ENV['CHAKE_RSYNC_OPTIONS'] = chake_rsync_options if $SPB_ENV == 'lxc' - system("mkdir -p config/lxc; sudo lxc-ls -f -F name,ipv4 | sed -e '/^softwarepublico/ !d; s/softwarepublico_//; s/_[0-9_]*/:/ ' > #{ips_file}.new") + system("mkdir -p config/lxc; sudo lxc-ls -f -F name,ipv4 | sed -e '/^[deirs]/ !d ; s/\s/:/' > #{ips_file}.new") begin ips = YAML.load_file("#{ips_file}.new") raise ArgumentError unless ips.is_a?(Hash) diff --git a/Vagrantfile b/Vagrantfile index 833c48a..8d2aedd 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,7 +9,10 @@ load './local.rake' if File.exists?('local.rake') VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = ENV.fetch("VAGRANT_BOX", 'seocam/centos-7.0') + + # Place the main box + config.vm.box = ENV.fetch("VAGRANT_BOX", 'frensjan/centos-7-64-lxc') + proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] if proxy config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy] @@ -24,30 +27,32 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end config.vm.define 'database' do |database| - database.vm.provider "virtualbox" do |vm, override| - override.vm.network 'private_network', ip: ips['database'] if ips + database.vm.provider :lxc do |vm| + vm.container_name = :machine 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 + integration.vm.provider :lxc do |vm| + vm.container_name = :machine 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 + email.vm.provider :lxc do |vm| + vm.container_name = :machine 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 + social.vm.provider :lxc do |vm| + vm.container_name = :machine 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 + reverseproxy.vm.provider :lxc do |vm| + vm.container_name = :machine end if File.exist?("tmp/preconfig.#{env}.stamp") reverseproxy.ssh.port = File.read("tmp/preconfig.#{env}.stamp").strip.to_i -- libgit2 0.21.2