-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathubuntu.sh
executable file
·76 lines (62 loc) · 1.97 KB
/
ubuntu.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
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -o errexit
set -o pipefail
set -x
scripts_dir=$(dirname "$0")
#pathagar_version="0.8.0"
pathagar_version="master"
pathagar_home=$HOME/pathagar-$pathagar_version
# from dependencies.sh
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install \
apache2 \
python-pip \
python-virtualenv \
python-dev \
libapache2-mod-wsgi \
libmysqlclient-dev \
libxml2-dev \
libxslt1-dev \
mysql-server
# configure mysql
"$scripts_dir/set-db-pw.sh"
# pathagar install
if [[ ! -d "$pathagar_home" ]]; then
(
cd "$(dirname "$pathagar_home")"
# Curl url for version strings
#curl -s -f -L "https://github.com/PathagarBooks/pathagar/archive/v$pathagar_version.tar.gz" | tar xvz
# Download and unpack pathagar source
curl -s -f -L "https://github.com/PathagarBooks/pathagar/archive/$pathagar_version.tar.gz" | tar xvz
)
fi
# Copy settings
cp "$scripts_dir/local_settings.py" "$pathagar_home/"
# This is a work-around for older versions of django
ln -sf "$pathagar_home" "$pathagar_home/pathagar"
# Setup pathagar
(
cd "$pathagar_home"
virtualenv -p python2.7 penv
# shellcheck disable=SC1091
source penv/bin/activate
pip install -r requirements.pip
echo "Run manage.py syncdb --noinput"
python manage.py syncdb --noinput
echo "Run manage.py collectstatic --noinput"
python manage.py collectstatic --noinput
# Create the admin user in pathagar
echo -n -e "pathagar\\npathagar\\n" | python manage.py createsuperuser --username pathagar --email [email protected]
)
# Configure apache
sudo cp "$scripts_dir/ph-site.conf" /etc/apache2/sites-available/
echo "Enable the apache2 wsgi module.."
sudo a2enmod wsgi
echo "Disable the default apache2 static site."
sudo a2dissite 000-default
echo "Enable the pathagar site."
sudo a2ensite ph-site
sudo mkdir -p /var/www/pathagar_media
echo "Change /var/www/pathagar_media ownership to www-data"
sudo chown -R www-data:www-data /var/www/pathagar_media
echo "Restarting apache"
sudo service apache2 restart