-
Notifications
You must be signed in to change notification settings - Fork 1
/
provision-vm.sh
44 lines (37 loc) · 1.45 KB
/
provision-vm.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
40
41
42
43
44
#!/bin/bash
command_exists () {
command -v $1 2>/dev/null ;
}
# Add NodeJS and NPM repository
if ! command_exists node ; then
NODE_KEY="9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280"
gpg --keyserver pool.sks-keyservers.net --recv-keys $NODE_KEY
gpg -a --export $NODE_KEY | apt-key add -
echo 'deb http://deb.nodesource.com/node_6.x jessie main' > /etc/apt/sources.list.d/nodesource.list
fi
apt-get update
apt-get install -y python3 python3-pip python3-virtualenv virtualenv git \
gettext postgresql-9.4 postgresql-server-dev-9.4 libfontconfig \
nodejs xvfb chromium chromedriver libyaml-dev libssl-dev libffi-dev \
python3-dev libreadline-dev libbz2-dev
# Set up xvfb
if [ ! -e /etc/systemd/system/xvfb.service ]; then
cp /vagrant/xvfb.service /etc/systemd/system/xvfb.service
systemctl daemon-reload
systemctl enable xvfb.service
systemctl start xvfb.service
echo "export PATH=\$PATH:/usr/lib/chromium" >> .bashrc
echo "export DISPLAY=:99" >> .bashrc
fi
# Set up PostgreSQL
if [[ $(sudo su - postgres -c 'psql -lqt | cut -d \| -f 1 | grep -w accountant | wc -l') != "1" ]]; then
su - postgres -c "psql -c \"CREATE USER accountant WITH PASSWORD 'accountant' CREATEDB\""
su - postgres -c 'psql -c "CREATE DATABASE accountant"'
su - postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE accountant TO accountant"'
fi
# Install angular-cli
if ! command_exists ng ; then
npm install -g @angular/[email protected]
fi
# Install angular requirements
cd /vagrant/ngApp && npm install