forked from deis/deis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile.local.example
53 lines (42 loc) · 1.74 KB
/
Vagrantfile.local.example
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
=begin
This file augments the standard Vagrantfile with some developer-specific settings.
You can override any settings you want. This file is in .gitignore, so can be specific
to your own environment.
By default this file mounts your local development version of the Deis codebase onto the
Deis Controller. It does this by mounting your code onto the VM at /vagrant, then moving
the original installed code base to /opt/deis/controller_ORIG and symlinking
/opt/deis/controller to the mounted code at /vagrant.
Because the deployed environment creates some extra files, like /deis/local_settings.py
for example, these need to be then symlinked into the symlinked mount. Sound complicated?
Yo dawg, I heard you like symlinks.
=end
HOST_CODE_PATH = '/opt/deis/controller'
HOST_BAK_PATH = "#{HOST_CODE_PATH}_ORIG"
# These paths are either in .gitignore or created after installation.
# Therefore they need to be linked into the dev codebase.
symlinks = [
'deis/local_settings.py',
'.secret_key',
'logs',
'static',
'venv'
].map { |path|
"ln -s #{HOST_BAK_PATH}/#{path} #{HOST_CODE_PATH}/#{path}"
}.join("\n")
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vb|
#vb.customize ["modifyvm", :id, "--memory", "512"]
end
# Mount the entire Deis codebase onto the VM at /vagrant
# The first param is relative to the location of this file
config.vm.synced_folder ".", "/vagrant", owner: 'deis', group: 'deis'
config.vm.provision :shell, inline: <<-SCRIPT
if [ ! -d #{HOST_BAK_PATH} ]; then
mv #{HOST_CODE_PATH} #{HOST_BAK_PATH}
ln -s /vagrant #{HOST_CODE_PATH}
# Paths added after installation need linking into the codebase
#{symlinks}
chown -R deis:deis #{HOST_CODE_PATH}
fi
SCRIPT
end