Deploying PyWPS on Linux

 

Created on: 4/18/19
Last update: 4/18/19

Clone the latest PyWPS repository:

git clone https://github.com/geopython/pywps/

Install required packages:

sudo apt-get install git python-gdal
sudo pip install -e git+https://github.com/geopython/pywps.git@master#egg=pywps-dev

Apache WSGI:

sudo apt-get install libapache2-mod-wsgi
sudo a2enmod wsgi

Create WPS Directory /usr/local/pywps and create pywps.wsgi:

#!/usr/bin/env python3

from pywps.app.Service import Service

# processes need to be installed in PYTHON_PATH
from processes.sleep import Sleep
from processes.ultimate_question import UltimateQuestion
from processes.centroids import Centroids
from processes.sayhello import SayHello
from processes.feature_count import FeatureCount
from processes.buffer import Buffer
from processes.area import Area

processes = [
    FeatureCount(),
    SayHello(),
    Centroids(),
    UltimateQuestion(),
    Sleep(),
    Buffer(),
    Area()
]

# Service accepts two parameters:
# 1 - list of process instances
# 2 - list of configuration files
application = Service(
    processes,
    ['/usr/local/pywps/pywps.cfg']
)

Create pypws.cfg.

Reference
Configuration https://pywps.readthedocs.io/en/master/configuration.html

Create processes directory and logs direcoty:

mkdir processes
mkdir logs
chmod 777 logs
touch logs/pywps.log
chmod 777 logs/pywps.log

Create a configuration file /etc/apache2/sites-enabled/pywps.conf:

# PyWPS
WSGIDaemonProcess pywps home=/usr/local/pywps user=www-data group=www-data processes=2 threads=5
WSGIScriptAlias /pywps /usr/local/pywps/pywps.wsgi process-group=pywps

<Directory /usr/local/pywps/>
    WSGIScriptReloading On
    WSGIProcessGroup pywps
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
</Directory>

Test: http://localhost/wps?request=GetCapabilities&service=WPS

Reference
https://github.com/geopython/pywps/ https://pywps.readthedocs.io/en/master/deployment.html