-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
50 lines (41 loc) · 1.62 KB
/
Vagrantfile
File metadata and controls
50 lines (41 loc) · 1.62 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
Vagrant.configure('2') do |config|
vm_define = 'config/vms/basic/machine_define.yml'
# Before work
if File.exists?(vm_define)
row_file = YAML.load_file(vm_define)
machines_names = row_file.keys
hw_httpd = row_file[machines_names[0]][0]
hw_request = row_file[machines_names[1]][0]
else
machines_names = ['apache_httpd', 'benchmark_requests']
hw_httpd = {memory: 1024, cpus: 2}
hw_request = {memory: 1024, cpus: 2}
end
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
# Define to run apache settings
config.vm.define machines_names[0] do |httpd|
httpd.vm.box = ENV['VM'] || 'bugyt/archlinux'
httpd.vm.network 'forwarded_port', guest: 80, host: 8080
httpd.vm.provider 'virtualbox' do |vm, override|
vm.memory = hw_httpd['memory']
vm.cpus = hw_httpd['cpus']
end
ssh_path = "#{ENV['HOME']}/.ssh/id_rsa.pub"
httpd.vm.provision 'shell', privileged: true, keep_color: true, args: "#{ENV['USER']}", path: 'vagrant/bootstrap.sh'
end
# Define vm to start requests
config.vm.define machines_names[1] do |requests|
requests.vm.box = 'minimal/trusty64'
requests.vm.provider 'virtualbox' do |vm, override|
vm.memory = hw_request['memory']
vm.cpus = hw_request['cpus']
end
requests.vm.network 'public_network', ip: "10.0.0.201"
requests.vm.network 'forwarded_port', guest: 80, host: 1234
requests.vm.provision 'shell', privileged: true, keep_color: true, args: "#{ENV['USER']}", path: 'vagrant/bootstrap.sh'
end
end