forked from opendevshop/devshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
89 lines (71 loc) · 3.08 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Require YAML
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Load Variables
settings = YAML.load_file(File.dirname(__FILE__) + "/vars.yml")
development_mode = settings["vagrant_development"] || File.exist?(File.dirname(__FILE__) + '/.development_mode')
# Base Box & Config
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.memory = settings['vagrant_virtualbox_memory']
end
# Prepare host for development
if (development_mode && ARGV[0] == 'up')
system('bash ' + File.dirname(__FILE__) + '/vagrant-prepare-host.sh ' + File.dirname(__FILE__) + ' ' + settings["devshop_version"])
end
# Uncomment to test with other types of boxes.
# config.vm.box = "hashicorp/precise64"
# config.vm.box = "bento/centos-6.5"
# config.vm.box = "bento/centos-7.1"
# DevShop Master
# Set to be the default machine.
# Use `vagrant up` to launch.
config.vm.define "devmaster", primary: true do |devmaster|
devmaster.vm.hostname = settings["server_hostname"]
devmaster.vm.network "private_network", ip: settings["vagrant_private_network_ip"]
# Set SH as our provisioner
devmaster.vm.provision "shell",
path: settings["vagrant_install_script"],
args: settings["vagrant_install_script_args"]
# Prepare development environment
if (development_mode)
devmaster.vm.synced_folder "source/devmaster-" + settings["devshop_version"], "/var/aegir/devmaster-" + settings["devshop_version"],
mount_options: ["uid=12345,gid=12345"]
devmaster.vm.synced_folder "source/drush", "/var/aegir/.drush/commands",
mount_options: ["uid=12345,gid=12345"]
# config.vm.synced_folder "source/projects", "/var/aegir/projects",
# mount_options: ["uid=12345,gid=12345"]
devmaster.vm.provision "shell",
path: 'vagrant-prepare-guest.sh'
end
end
# DevShop Remote
# Does not start automatically on vagrant up.
# Use `vagrant up remote` to launch.
config.vm.define "remote", autostart: false do |remote|
remote.vm.hostname = settings["remote_server_hostname"]
remote.vm.network "private_network", ip: settings["remote_vagrant_private_network_ip"]
remote.vm.provider "virtualbox" do |v|
v.memory = 1024
end
end
config.vm.define "remote2", autostart: false do |remote|
remote.vm.hostname = settings["remote2_server_hostname"]
remote.vm.network "private_network", ip: settings["remote2_vagrant_private_network_ip"]
remote.vm.provider "virtualbox" do |v|
v.memory = 1024
end
end
end
if (ARGV[0] == 'destroy')
settings = YAML.load_file(File.dirname(__FILE__) + "/vars.yml")
print "DEVSHOP: Vagrant Destroy detected. \n"
print "DEVSHOP: You must delete the 'source/devmaster-" + settings["devshop_version"] + "/sites/devshop.site' folder before you 'vagrant up' again. \n"
end
class NoSettingsException < Vagrant::Errors::VagrantError
error_message('Project settings file not found. Create attributes.json file then try again.')
end