forked from UKMNorge/servere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
91 lines (77 loc) · 3.32 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
90
91
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Require colors..
require './color'
# Lets get this party started
if !ARGV.include?("halt") && !ARGV.include?("destroy")
puts "Welcome, developer! 😎".green
puts "Human contact possible @ https://github.com/orgs/UKMNorge/teams/developers".green
end
# Global vars
$localNFSpath = "#{Dir.pwd}/"
$boxNames = []
# Files we kinda need
require './filesystem' # File system functions
require './dependencies' # Vagrant plugin dependencies
require './boxconfig' # Different vagrant-box configs
require './utils' # VM conf utilities
# Configure vagrant!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/bionic64"
# Share the salt config with the guest
config.vm.synced_folder "salt", "/srv/salt/"
config.vm.synced_folder "pillar", "/srv/pillar"
# Setup host manager
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.include_offline = true # So every box knows each other, even if currently offline
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", $boxConf['main'][:memory]]
end
## main MAIN SERVER (UKM.no)
config.vm.define "main", primary: true do |main|
# Box basic config
commonConf('main', main)
# Share wordpress folders
share(main, 'main/plugins', '/var/www/wordpress/wp-content/plugins/')
share(main, 'main/themes', '/var/www/wordpress/wp-content/themes/')
# Share UKMlib folder
share(main, 'main/ukmlib', '/etc/php-includes/UKM/')
# Share folders and setup hosts file for subdomains
shareAndConfigureSubdomains('main', main, config);
# Provision (salt-stack)
doProvision('main',main)
end
## LITE main SERVER (for project fun)
config.vm.define "lite" do |lite|
# Box basic config
commonConf('lite', lite)
# Share web and UKMlib folder
share(lite, 'lite/www', '/var/www/lite/')
share(lite, 'lite/ukmlib', '/etc/php-includes/UKM/')
# Share folders and setup hosts file for subdomains
shareAndConfigureSubdomains('lite', lite, config);
##############################################
# Temp workaround
# https://github.com/UKMNorge/servere/issues/2
lite.hostmanager.aliases << 'ukm.dev'
##############################################
# Provision (salt-stack)
doProvision('lite',lite)
end
## playback Mediefiler-server (playback.ukm.no)
config.vm.define "playback" do |playback|
commonConf('playback', playback)
share(playback, 'playback/www', '/var/www/playback/')
shareAndConfigureSubdomains('playback', playback, config)
doProvision('playback', playback)
end
config.vm.define "videoconverter" do |videoconverter|
commonConf('videoconverter', videoconverter)
#share(videoconverter, 'videoconverter', '/var/www/videoconverter')
shareAndConfigureSubdomains('videoconverter', videoconverter, config)
doProvision('videoconverter', videoconverter)
end
end