Last active
December 11, 2018 05:56
-
-
Save edmondchuc/e867f559da261cbb6eac91d3eed8e268 to your computer and use it in GitHub Desktop.
deploy pyldapi sss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This is a deployment script for the Sites, Samples and Surveys Linked Data API at Geoscience Australia. | |
# | |
# update apt packages | |
sudo apt update | |
sudo apt upgrade -y | |
# set timezone | |
sudo timedatectl set-timezone Australia/Canberra | |
# install some packages | |
sudo apt-get install git -y | |
sudo apt-get install apache2 -y | |
sudo apt-get install libapache2-mod-wsgi-py3 -y | |
sudo apt-get install curl -y | |
sudo apt-get install virtualenv -y | |
# create a directory, set permissions to the apache2 user and git clone the repository | |
sudo mkdir -p /var/www/sss | |
sudo chown -R $USER:$USER /var/www/sss | |
git clone https://github.com/CSIRO-enviro-informatics/sss-api.git /var/www/sss | |
# create virtual environment for python application | |
virtualenv -p /usr/bin/python3 /var/www/sss/venv | |
source /var/www/sss/venv/bin/activate | |
pip install -r /var/www/sss/requirements.txt | |
deactivate | |
# copy config. file for python app. | |
cp /var/www/sss/_config/template.py /var/www/sss/_config/__init__.py | |
# Apache2 configuration below can go straight into /etc/apache2/sites-available/000-default.conf | |
#<VirtualHost *:80> | |
# ServerAdmin webmaster@localhost | |
# DocumentRoot /var/www/html | |
# | |
# ErrorLog ${APACHE_LOG_DIR}/error.log | |
# CustomLog ${APACHE_LOG_DIR}/access.log combined | |
# Alias "/sss/static/" "/var/www/sss/view/static/" | |
# WSGIDaemonProcess sss user=www-data python-home=/var/www/sss/venv threads=5 | |
# WSGIScriptAlias /sss /var/www/sss/app.wsgi | |
# <Directory /var/www/sss/> | |
# WSGIProcessGroup sss | |
# WSGIApplicationGroup %{GLOBAL} | |
# Require all granted | |
# </Directory> | |
#</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment