forked from Prescrypto/RexChain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
59 lines (51 loc) · 2.04 KB
/
Vagrantfile
File metadata and controls
59 lines (51 loc) · 2.04 KB
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
# -*- mode: django -*-
# vi: set ft=python :
# Module to know the host platform
# Based on BernardoSilva's answer in http://stackoverflow.com/questions/26811089/vagrant-how-to-have-host-platform-specific-provisioning-steps
module OS
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.linux?
not OS.mac?
end
end
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
# TODO test this on apple intel chips
config.vm.box = "debian/bookworm64"
config.vm.box_check_update = true
config.vm.define "RexChain"
# Open ports:
# 5432 - Postgres
# 8000 - Django
[5432, 8000].each do |p|
config.vm.network :forwarded_port, guest: p, host: p
end
# NFS ---- NFS improves speed of VM if supported by your OS
config.vm.provision :shell, inline: 'apt-get update; apt-get -y install nfs-common portmap', run: "always"
# It does not work with encrypted volumes
# Linux Need a plugin for Virtualbox to shared files `vagrant plugin install vagrant-vbguest`
if OS.linux?
puts "Vagrant launched from linux."
config.vm.synced_folder '.', '/vagrant', type: 'virtualbox'
elsif OS.mac?
puts "Vagrant launched from mac."
config.vm.network 'private_network', ip: '192.168.56.10'
config.vm.synced_folder '.', '/vagrant',
type: "nfs",
nfs_version: 3,
nfs_udp: false
end
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--memory', '1024']
end
# Provision application
config.vm.provision "shell", privileged: false, run: "always", path: "config/vagrantvars"
config.vm.provision "shell", privileged: false, run: "always", path: "bin/install_redis.sh"
config.vm.provision "shell", privileged: false, run: "always", path: "bin/setup_box.sh"
end