-
Notifications
You must be signed in to change notification settings - Fork 4
/
VagrantProvisionUbuntu1604.sh
65 lines (47 loc) · 2.31 KB
/
VagrantProvisionUbuntu1604.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
# Set environment variables
BUILDS="/opt"
HOME="/home/vagrant"
PRJ="/home/vagrant/REPAiR-Web"
echo "Updating Ubuntu..."
apt-get update
apt-get upgrade -y
echo "Installing Python3.6..."
add-apt-repository ppa:fkrull/deadsnakes -y
apt-get update
apt-get install -y --allow-unauthenticated python3.6
echo "Installing SQLite 3.11.0..."
apt-get install -y sqlite3 libsqlite3-mod-spatialite spatialite-bin
apt-get update
apt-get upgrade -y
echo "Installing pip for Python3.6..."
curl https://bootstrap.pypa.io/get-pip.py | python3.6
echo "Installing compiler extensions for Python3.6..."
apt-get install -y --allow-unauthenticated python3.6-dev
echo "Installing GDAL 2.1.3..."
add-apt-repository ppa:ubuntugis/ppa -y
apt-get update
apt-get install -y --allow-unauthenticated binutils libproj-dev gdal-bin libgdal-dev libgeos-dev
echo "Downloading and installing Node.js 8.9.4 LTS, Yarn..."
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && apt-get install -y --allow-unauthenticated yarn
echo "Installing graph-tools..."
add-apt-repository 'deb http://downloads.skewed.de/apt/xenial xenial universe'
apt-get update && apt-get install -y --allow-unauthenticated python3-graph-tool
apt-get install libcairo2-dev libjpeg-dev libgif-dev
echo "Installing Python and JS requirements..."
cd $PRJ
pip install -r requirements-dev.txt
yarn install
echo "Setting up database..."
python3.6 manage.py migrate --run-syncdb --settings=repair.settings_staged_vagrant
python3.6 manage.py loaddata sandbox_data --settings=repair.settings_staged_vagrant
echo "Compiling JS files and starting the Node and Django server..."
# Run servers in the background: https://stackoverflow.com/a/11856575
# Stop server that runs in background: https://stackoverflow.com/a/27070134
nohup node server-dev.js > /dev/null 2>/tmp/node_server-dev.log &
nohup python3.6 manage.py runserver 0.0.0.0:80 --settings=repair.settings_dev_vagrant > /dev/null 2>/tmp/django_server-dev.log &
printf "\nSee VAGRANT.md for additional configuration instructions and then run 'vagrant ssh' to log into the virtual machine. Listening at http://localhost:8081 (on host)..."