-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
39 lines (32 loc) · 961 Bytes
/
bootstrap.sh
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
#!/bin/bash
set -euo pipefail
# set up VM
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install tmux postgresql python3-dev libpq-dev python3-pip python-virtualenv haskell-platform libghc-postgresql-simple-dev libgpgme11-dev
cd /vagrant
# set up database
cat > /tmp/create_db.sql <<EOF
CREATE USER vote3 WITH PASSWORD 'vote3votingsystempassword';
CREATE DATABASE vote3;
GRANT ALL PRIVILEGES ON DATABASE vote3 TO vote3;
EOF
sudo -u postgres psql -f /tmp/create_db.sql
# set up frontend
cd frontend
# this is broken : https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1290847
# pyvenv-3.4 env
# so we use old virtualenv instead
virtualenv -p /usr/bin/python3.4 env
set +u
source env/bin/activate
set -u
pip install -r requirements.txt
cd vote3fe_project
python manage.py migrate
python manage.py createcachetable
# backend
HOME=/home/vagrant
cabal update
cabal install cabal cabal-install
echo "PATH=~/.cabal/bin:$PATH" >> ~/.bashrc