-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVagrantfile
58 lines (42 loc) · 1.65 KB
/
Vagrantfile
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# require 'class/io'
require 'json'
vmName = File.basename(File.expand_path(File.dirname(__FILE__)))
# 512MB enough for basic install but solr needs more, trying 1024MB
begin
config = File.read('config.foswiki')
cfg = JSON.parse(config)
rescue
cfg = {}
end
hostName = cfg['hostName'] || vmName
www_port = cfg['www_port'] || 8080
ssh_port = cfg['ssh_port'] || 2220
web_serv = cfg['web_server'] || 'nginx'
memory = cfg['memory'] || 1024
box = cfg['box'] || "ubuntu/trusty64"
git_user = cfg['git_user'] || "This User"
git_email= cfg['git_email'] || "This.User@project.org"
puts cfg['Desc'] || "Foswiki on #{web_serv} using ports #{www_port} and #{ssh_port}"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = box
config.vm.hostname = hostName
config.vm.boot_timeout = 600
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "#{memory}"]
config.vm.network "forwarded_port", guest: 80, host: www_port
config.vm.network "forwarded_port", guest: 22, host: ssh_port
end
config.vm.provider "hyperv" do |vb|
vb.memory = memory
end
# Provisioning with file and shell: easy for FW devs to learn, other provisioners may have more long term value
config.vm.provision "file", source: "apache_install.sh", destination: "/home/vagrant/apache_install.sh"
config.vm.provision "file", source: "nginx_install.sh", destination: "/home/vagrant/nginx_install.sh"
config.vm.provision "shell" do |s|
s.path = "fw-install.sh"
s.args = "#{www_port} #{web_serv} #{git_user} #{git_email}"
end
end