-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
75 lines (62 loc) · 2.12 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
plugin_dependencies = [
"vagrant-docker-compose",
"vagrant-host-shell",
"vagrant-vbguest"
]
needsRestart = false
# Install plugins if required
plugin_dependencies.each do |plugin_name|
unless Vagrant.has_plugin? plugin_name
system("vagrant plugin install #{plugin_name}")
needsRestart = true
puts "#{plugin_name} installed"
end
end
# Restart vagrant if new plugins were installed
if needsRestart === true
exec "vagrant #{ARGV.join(' ')}"
end
Vagrant.configure(2) do |config|
config.vm.define :jeopardyvm do |jeopardyvm|
jeopardyvm.vm.hostname = "jeopardy"
jeopardyvm.vm.box = "bento/ubuntu-16.04"
jeopardyvm.vm.provider :virtualbox do |vb|
vb.name = "jeopardyvm"
vb.gui = false
vb.memory = "512"
vb.cpus = 2
end
jeopardyvm.vm.network :forwarded_port,
guest: 8080,
host: 8080,
auto_correct: true
# Run as non-login shell, sourcing it to /etc/profile instead of /root/.profile
# Due to clashing configurations for vagrant and base box.
# See: https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
jeopardyvm.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
# Automatically run during vagrant-vbguest install
# jeopardyvm.vm.provision :shell, inline: "apt-get update"
jeopardyvm.vm.provision :docker
jeopardyvm.vm.provision :docker_compose,
compose_version: "1.15.0",
project_name: "jeopardy",
yml: ["/vagrant/docker-compose.yml"],
options: "--verbose",
command_options: { build: "--force-rm" },
rebuild: true,
run: "always"
jeopardyvm.vm.provision :shell,
path: "scripts/deploy-wait_message.sh",
run: "always",
privileged: false
# Automatically set current-dir to /vagrant on vagrant ssh
config.vm.provision :shell,
inline: "echo 'cd /vagrant' >> /home/vagrant/.bashrc"
# ================> Post-Success-Deployment Message <=================
jeopardyvm.vm.provision :host_shell,
inline: "scripts/post-deploy_message.sh",
run: "always"
end
end