diff options
Diffstat (limited to 'demo/nginx_proxy/demo-2/Vagrantfile')
-rw-r--r-- | demo/nginx_proxy/demo-2/Vagrantfile | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/demo/nginx_proxy/demo-2/Vagrantfile b/demo/nginx_proxy/demo-2/Vagrantfile new file mode 100644 index 0000000..dbd703a --- /dev/null +++ b/demo/nginx_proxy/demo-2/Vagrantfile @@ -0,0 +1,116 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +boxes = [ + { + :name => "rproxy-client", + :hostname => "rproxy-client", + :mem => "1024", + :cpu => "1" + }, + { + :name => "rproxy-server1", + :hostname => "rproxy-server1", + :mem => "1024", + :cpu => "1" + }, + { + :name => "rproxy-server2", + :hostname => "rproxy-server2", + :mem => "1024", + :cpu => "1" + }, + { + :name => "rproxy-proxy", + :hostname => "rproxy-proxy", + :mem => "10144", + :cpu => "4" + } +] + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1604 + distro = ( ENV['DMM_VAGRANT_DISTRO'] || "ubuntu") + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.2-64-nocm" + else + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + end + + config.vm.box_check_update = false + #ddconfig.ssh.password = vagrant + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Define some physical ports for your VMs to be used by DPDK + #nics = (ENV['DMM_VAGRANT_NICS'] || "2").to_i(10) + #for i in 1..nics + # config.vm.network "private_network", type: "dhcp" + #end + + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + config.ssh.forward_agent = true + config.ssh.forward_x11 = true + + boxes.each do |opts| + config.vm.define opts[:name] do |srv| + srv.vm.hostname = opts[:hostname] + srv.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.customize ["modifyvm", :id, "--memory", opts[:mem]] + vb.customize ["modifyvm", :id, "--cpus", opts[:cpu]] + end + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"../../../scripts/install_prereq.sh") + puts ' '..srv.vm.hostname + + if opts[:name] == "rproxy-proxy" + puts 'NGINX Proxy Server, Run nginx in below way ' + puts 'export LD_LIBRARY_PATH=/DMM/stacks/lwip_stack/release/lib64' + puts './DMM/thirdparty/apps/nginx/release/nginx' + srv.vm.synced_folder "../../../", "/DMM", type: "rsync" + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"adjust_hugepage.sh"), run: 'always' + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"apply_patch.sh"), run: 'always' + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"../../../stacks/lwip_stack/vagrant/build.sh"), :args => "/DMM vagrant" + srv.vm.network "private_network", ip: "192.168.50.20" + srv.vm.network "private_network", ip: "172.167.50.20" + srv.vm.network "private_network", ip: "182.167.50.20" + srv.vm.network "private_network", type: "dhcp" + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"../../../stacks/lwip_stack/vagrant/start_nstackMain.sh"), :args => "/DMM vagrant" + #possibly overwrite by previous script so adjust again + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"adjust_hugepage.sh"), run: 'always' + srv.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"setup_proxy.sh"), run: 'always' + end + if opts[:name] == "rproxy-client" + puts 'Client use command for TCP: curl http://192.168.50.20' + puts 'Client use command for UDP: ./udpclient' + srv.vm.synced_folder "./", "/CLIENT", type: "rsync" + srv.vm.network "private_network", type: "dhcp" + srv.vm.network "private_network", ip: "192.168.50.10" + srv.vm.provision "up", type: "shell", :path => File.join(File.dirname(__FILE__),"setup_client.sh"), run: 'always' + end + if opts[:name] == "rproxy-server1" + puts 'Upstream server 1' + + srv.vm.synced_folder "./", "/NGINX", type: "rsync" + srv.vm.network "private_network", type: "dhcp" + srv.vm.provision "up", type: "shell", :path => File.join(File.dirname(__FILE__),"setup_upstream.sh"), run: 'always' + srv.vm.network "private_network", ip: "172.167.50.30" + end + if opts[:name] == "rproxy-server2" + puts 'Upstream server 2 ' + + srv.vm.synced_folder "./", "/UDPSERVER", type: "rsync" + srv.vm.network "private_network", type: "dhcp" + srv.vm.provision "up", type: "shell", :path => File.join(File.dirname(__FILE__),"setup_udpserver.sh"), run: 'always' + srv.vm.network "private_network", ip: "182.167.50.30" + end + end + end +end |