-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
67 lines (55 loc) · 2.42 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
59
60
61
62
63
64
65
66
67
# -*- mode: ruby -*-
# vi: set ft=ruby :
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.unix?
!OS.windows?
end
def OS.linux?
OS.unix? and not OS.mac?
end
end
require 'yaml'
current_dir = File.dirname(File.expand_path(__FILE__))
config = YAML.load_file("#{current_dir}/app/config/smart.yml")
if File.exists? ("#{current_dir}/app/config/parameters.yml")
params = YAML.load_file("#{current_dir}/app/config/parameters.yml")
smb_username = params['parameters']['smart_vagrant_smb_user']
smb_password = params['parameters']['smart_vagrant_smb_password']
else
smb_username = ''
smb_password = ''
end
ip = config['parameters']['smart.vagrant_ip']
name = config['parameters']['smart.project_name']
url = config['parameters']['smart.project_url']
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 80, host: 8012
config.vm.network "forwarded_port", guest: 3306, host: 3312
config.vm.network "forwarded_port", guest: 9200, host: 9212
config.vm.network "private_network", ip: ip
if Vagrant::Util::Platform.windows? then
config.vm.synced_folder ".", "/var/www", type: "smb", smb_username: smb_username, smb_password: smb_password
elsif OS.mac?
config.vm.synced_folder ".", "/var/www", type: "nfs", :linux__nfs_options => ["rw","no_root_squash","no_subtree_check"]
else
config.vm.synced_folder ".", "/var/www", type: "nfs", :linux__nfs_options => ["rw", "no_root_squash", "no_subtree_check"], nfs_version: "4", nfs_udp: false
end
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
end
config.vm.provision "file", source: "./deploy/apache/project.conf", destination: "/var/www/project.conf"
config.vm.provision "file", source: "./deploy/apache/ssl/project.crt", destination: "/var/www/project.crt"
config.vm.provision "file", source: "./deploy/apache/ssl/project.key", destination: "/var/www/project.key"
config.vm.provision "file", source: "./deploy/phpmyadmin/config.inc.php", destination: "/var/www/config.inc.php"
config.vm.provision "file", source: "./deploy/phpmyadmin/apache.conf", destination: "/var/www/apache.conf"
config.vm.provision "shell", path: "./deploy/script.sh", args: [ip, name, url, '1234']
end