-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vagrantfile
76 lines (68 loc) · 2.21 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 :
VAGRANTFILE_API_VERSION = "2"
REQUIRED_PLUGINS = %w(vagrant-vbguest vagrant-librarian-chef-nochef)
plugins_to_install = REQUIRED_PLUGINS.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
puts "Installing required plugins: #{plugins_to_install.join(' ')}"
if system "vagrant plugin install #{plugins_to_install.join(' ')}"
exec "vagrant #{ARGV.join(' ')}"
else
abort "Installation of one or more plugins has failed. Aborting. Please read the Bike Index README."
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/xenial64"
# Configure the virtual machine to use 1.5GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1536"]
end
# Forward the Rails server default port to the host
config.vm.network :forwarded_port, guest: 3000, host: 3000
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "system::install_packages"
chef.add_recipe "ruby_build"
chef.add_recipe "ruby_rbenv::user"
chef.add_recipe "ruby_rbenv::user_install"
chef.add_recipe "vim"
chef.add_recipe "postgresql::server"
chef.add_recipe "postgresql::client"
chef.json = {
rbenv: {
user_installs: [{
user: 'ubuntu',
rubies: ["2.3.1"],
global: "2.3.1",
gems: {
"2.3.1" => [{ name: "bundler" }]
}
}]
},
system: {
packages: {
install: ["redis-server", "nodejs", "libpq-dev"]
}
},
postgresql: {
:pg_hba => [{
:comment => "# Add vagrant role",
:type => 'local', :db => 'all', :user => 'ubuntu', :addr => nil, :method => 'trust'
}],
:users => [{
"username": "ubuntu",
"password": "welc0me",
"superuser": true,
"replication": false,
"createdb": true,
"createrole": false,
"inherit": false,
"login": true
}]
}
}
end
end