forked from anishathalye/gavel
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Vagrantfile
39 lines (31 loc) · 1.2 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
Vagrant.configure(2) do |config|
config.vm.box = 'debian/buster64'
# synced folder
config.vm.synced_folder '.', '/gavel', type: 'rsync',
rsync__exclude: ['.git/', 'env/'],
rsync__args: ['--verbose', '--archive', '-z', '--copy-links']
# disable default synced folder
config.vm.synced_folder '.', '/vagrant', disabled: true
# port forward
config.vm.network 'forwarded_port', guest: 5000, host: 5000
# install packages
config.vm.provision 'shell', inline: <<-EOS
apt-get -y update
apt-get install -y \
postgresql-11 postgresql-server-dev-11 \
redis-server \
python3-dev python3-pip
pip3 install virtualenv
EOS
# database setup
config.vm.provision 'shell', inline: <<-EOS
pg_auth_file="/etc/postgresql/11/main/pg_hba.conf"
echo "local all postgres peer" > "$pg_auth_file"
echo "local all all peer" >> "$pg_auth_file"
echo "host gavel vagrant ::1/128 trust" >> "$pg_auth_file"
echo "host gavel vagrant 127.0.0.1/32 trust" >> "$pg_auth_file"
service postgresql restart
su postgres -c "createdb gavel 2>/dev/null || true"
su postgres -c "createuser vagrant 2>/dev/null || true"
EOS
end