-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.bash
executable file
·71 lines (58 loc) · 1.87 KB
/
setup.bash
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
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
set -eu
if ! [ -x "$(command -v python3)" ]; then
echo "Attempting to install Python 3 via apt..."
sudo apt-get install -y python3 python3-dev
fi
if ! [ -x "$(command -v pip3)" ]; then
echo "Attempting to install pip3 via apt..."
sudo apt-get install -y python3-pip
fi
if ! [ -x "$(command -v virtualenv)" ]; then
echo "Attempting to install virtualenv via pip..."
sudo -H pip3 install virtualenv
fi
read -p "Server software to install (apache2 or [nginx]): " server
if [ "$server" == "apache2" ] || [ "$server" == "apache" ]; then
if ! [ -x "$(command -v apache2)" ]; then
echo "Attempting to install Apache via apt..."
sudo apt-get install -y apache2 libapache2-mod-wsgi-py3
echo "Enabling required Apache modules..."
sudo a2enmod wsgi
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo systemctl restart apache2
fi
else
if ! [ -x "$(command -v nginx)" ]; then
echo "Attempting to install NGINX via apt..."
sudo apt-get install -y nginx
fi
fi
if ! [ -x "$(command -v psql)" ]; then
echo "Attempting to install Postgres via apt..."
sudo apt-get install -y postgresql postgresql-contrib
fi
if ! [ -x "$(command -v npm)" ]; then
echo "Attempting to install NPM from nodesource via apt..."
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
echo "Updating NPM to the latest version..."
sudo npm install -g npm
echo "Setting up Python 3 virtual environment in project root..."
virtualenv -p python3 ./env
PS1="" source env/bin/activate
pip install -r requirements.txt
echo "Installing web dependencies via NPM..."
cd web
npm install
echo "Building JavaScript bundle..."
npm run build-dev
cd ..
echo "Setup complete."
echo
echo "Please activate the virtual environment by running the following:"
echo " source env/bin/activate"
echo