-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
76 lines (62 loc) · 2.78 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
begin
require __dir__ + '/dotenv.rb'
rescue LoadError => e
puts e.message
puts "WARNING: dotenv could not be loaded as a vagrant plugin"
end
Vagrant.configure("2") do |a|
a.vagrant.plugins = ['dotenv']
a.vbguest.auto_update = false
a.vm.hostname = 'prometheus'
a.vm.provision "shell", run: "always", inline: 'modprobe vboxsf || true'
a.vm.synced_folder '.', '/vagrant', type: 'virtualbox'
a.vm.network :forwarded_port, host: 3000, guest: 3000, host_ip: '127.0.0.1' # pandora
a.vm.network :forwarded_port, host: 3003, guest: 3003, host_ip: '127.0.0.1' # rack-images
a.vm.network :forwarded_port, host: 3004, guest: 3004, host_ip: '127.0.0.1' # rack-images (test)
a.vm.network :forwarded_port, host: 3306, guest: 3306, host_ip: '127.0.0.1' # mariadb
a.vm.network :forwarded_port, host: 9200, guest: 9200, host_ip: '127.0.0.1' # elasticsearch
a.vm.network :forwarded_port, host: 9201, guest: 9201, host_ip: '127.0.0.1' # elasticsearch (test)
a.vm.network :forwarded_port, host: 9222, guest: 9222, host_ip: '127.0.0.1' # headless chrome
a.vm.provider :virtualbox do |vb|
vb.name = 'prometheus'
vb.memory = 6 * 1024
vb.cpus = 2
end
vm_name = (
ENV['PM_VAGRANT_SUFFIX'] && ENV['PM_VAGRANT_SUFFIX'] != '' ?
"debian.#{ENV['PM_VAGRANT_SUFFIX']}" :
'debian'
)
a.vm.define vm_name, primary: true do |c|
c.vm.box = 'debian/bookworm64'
c.vm.box_version = '12.20230615.1'
c.vm.provider :virtualbox do |vb|
vb.name = "prometheus.#{vm_name}"
end
c.vm.provision :shell, path: 'provision.sh', args: 'debian_basics'
c.vm.provision :shell, path: 'provision.sh', args: 'install_rbenv', privileged: false
c.vm.provision :shell, path: 'provision.sh', args: 'install_nvm', privileged: false
c.vm.provision :shell, path: 'provision.sh', args: 'prepare_for_pandora', privileged: false
c.vm.provision :shell, path: 'provision.sh', args: 'prepare_for_rack_images', privileged: false
# bind-mount node_modules directory in VM
# start elasticsearch ensuring /vagrant is mounted
c.trigger.after :up do |trigger|
cmds = "
mkdir -p /home/vagrant/node_modules
chown vagrant:vagrant /home/vagrant/node_modules
mkdir -p /vagrant/pandora/node_modules
chown vagrant:vagrant /vagrant/pandora/node_modules
sudo mount --bind /home/vagrant/node_modules /vagrant/pandora/node_modules
sudo systemctl start elasticsearch-development.service elasticsearch-test.service
"
trigger.run_remote = {inline: cmds}
end
# copy git user config from host
c.vm.provision :shell, privileged: false, inline: "
git config --global user.name #{`git config user.name`}
git config --global user.email #{`git config user.email`}
"
end
end