Install 52°North WPS from Source on Debian


Prerequisites

Installation

1) Check out latest stable code version

sudo mkdir /var/code/
sudo chmod 777 /var/code/
cd /var/code/
git clone https://github.com/52North/WPS.git

You can also check out your own fork of the WPS or a specific branch.

2) Build WPS locally

cd WPS
mvn clean install

If you see the "Build Success" message you can proceed, otherwise please resolve the building errors first.

3) Create deployment script

nano /var/code/wps-build-deploy.sh

Copy and paste the following script file and...
  • replace the Tomcat user name and password,
  • set the tomcat manager endpoint, and
  • optionally:
    • adjust the location of the Tomcat control script, and
    • adjust the WPS version.

DIR="/var/code/WPS"

UPDATE=false
DEPLOY=false
RESTART=false
BUILD=true

TOMCAT="/etc/init.d/tomcat7"
TOMCAT_USER="user"
TOMCAT_PASS="pass"
MANAGER="http://myTomcat.server:8080/manager/text"

# used for renaming of war file
VERSION="3.3.0-SNAPSHOT"

WEBAPP_NAME="wps"

help() {
        echo >&2 "Usage $0 [-dnur] [-p directory] [-w name]"
        echo >&2 "    -p directory  path to the build directory [default: /var/code/WPS]"
        echo >&2 "    -d            deploy the webapp to the local tomcat [default: false]"
        echo >&2 "    -n            do NOT build the webapp (successful build required for deploy) [default: false]"
        echo >&2 "    -u            update the working copy [default: false]"
        echo >&2 "    -r            restart tomcat after deploying (implies -d) [default: false]"
        echo >&2 "    -w name       use \"name\" as the webapp name [default: wps]"
        exit 1
}

while getopts b:w:uhrd o 2>/dev/null; do
        case ${o} in
                p)
                        DIR=${OPTARG}
                        ;;
                d)
                        DEPLOY=true
                        ;;
                n)
                        BUILD=false
                        ;;
                u)
                        UPDATE=true
                        ;;
                w)
                        WEBAPP_NAME=${OPTARG}
                        ;;
                r)
                        RESTART=true
                        DEPLOY=true
                        ;;
                *)
                        help
                        ;;
        esac
done


cd $DIR

# update
if $UPDATE; then
   echo "[SCRIPT] UPDATING REPO ..."
   git pull
fi

# undeploy
if $DEPLOY; then
   echo "[SCRIPT] UNDEPLOYING ..."
   curl -vu "$TOMCAT_USER:$TOMCAT_PASS" "$MANAGER/undeploy?path=/$WEBAPP_NAME"
fi

# build
if $BUILD; then
   # build w/o geotools
   echo "[SCRIPT] BUILDING PROJECT ..."
   mvn clean install -DskipTests=true

   # build with geotools
   #mvn clean install -DskipTests=true -Pwith-geotools

   # rename war file
   mv -v "52n-wps-webapp/target/52n-wps-webapp-$VERSION.war" "52n-wps-webapp/target/$WEBAPP_NAME.war"
fi

#deploy
if $DEPLOY; then
 echo "[SCRIPT] DEPLOYING ..."
        curl -vu "$TOMCAT_USER:$TOMCAT_PASS" "$MANAGER/deploy?path=/$WEBAPP_NAME&war=`pwd`/52n-wps-webapp/target/$WEBAPP_NAME.war"
        # restart tomcat
        if $RESTART; then
                $TOMCAT restart
        fi
fi

cd -
exit 0

ALERT! If you want to use some processing backends such as R or conversion functionality then you might have to include the GeoTools modules. Comment out the line after the comment # build with geotools and add a # (commenting the line out) the line after # build w/o geotools.

4) Copy the config file to home directory

We copy the config file to the home directory of the Tomcat user to preserve it through installation updates and easily switch configurations.

ALERT! Other ways of configuration are documented at WpsConfiguration.

sudo cp 52n-wps-webapp/src/main/webapp/config/wps_config.xml /home/tomcat7/wps_config.xml

If you require GeoTools functionalities, use the complete config file:

sudo cp /var/code/WPS/52n-wps-webapp/src/main/webapp/config/wps_config_geotools.xml /home/tomcat7/wps_config.xml

5) Run deployment script

sh wps-build-deploy.sh -u -d

This automatically updates and deploys the WPS (including undeploying an existing webapp with the same name). You can also configure the update and deploy as default behaviour in the script file and also restart the Tomcat server if necessary.

6) Change administrator password

Open the user configuration file:

sudo nano <your Tomcat installation directory>/webapps/<your webapp name>/WEB-INF/classes/users.xml

Then change the password for the user wps and remove the user with name guest.

Restart the Tomcat server for the changes to take effect.

7) Configure server URL, port, and webapp name

You must manually define the server host name and port that is used for generating responses by the service.

sudo nano /home/tomcat7/wps_config.xml

Scroll to the <Server ... element and adjust the attributes hostname and port to match your configuration. If you changed the webapp name in the deployment script, then also adjust it here.

Alternatively, you can also chance the Property element with the name responseURLFilterEnabled so that the response URL is based dynamically on the request URL.

Reload the webapp in the Tomcat Manager for the changes to take effect.

8) Further configuration

Topic revision: r3 - 24 Jun 2014, DanielNuest
Legal Notice | Privacy Statement


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback