-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
47 lines (40 loc) · 1.64 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
db.vm.network "forwarded_port", guest: 5432, host: 5432
db.vm.network :private_network, ip: "192.168.1.11"
db.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 512]
v.customize ["modifyvm", :id, "--name", "dj-database"]
end
db.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y postgresql
sudo su - postgres -c "psql -f /vagrant/db-config.sql"
sudo su - postgres -c 'echo "host all all 192.168.1.10/24 trust" >> /etc/postgresql/9.3/main/pg_hba.conf'
sudo su - postgres -c "echo listen_addresses=\\'*\\' >> /etc/postgresql/9.3/main/postgresql.conf"
sudo service postgresql restart
SHELL
end
config.vm.define "web" do |web|
web.vm.box = "ubuntu/trusty64"
web.vm.network "forwarded_port", guest: 8000, host: 8000
web.vm.network :private_network, ip: "192.168.1.10"
web.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 512]
v.customize ["modifyvm", :id, "--name", "dj"]
end
web.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo python manage.py migrate
sudo python manage.py loaddata db.fixture.json
SHELL
end
end