Introduction

This tutorial shows you how to install a Sensor Things API (STA). To be able to install the 52°North STA the following software has to be downloaded and installed:

  • Java Runtime Environment (JRE) 8.0 or higher
  • Application server compatible to Java Servlet-API 2.5 or higher
  • Running database management system

For Windows systems we provide a tutorial, how to setup the system for the installation of the STA. In the tutorial we use Apache Tomcat as the application server and PostgreSQL/ PostGIS as the database management system: Tutorial

Installing the Webapp

Download and deploy

When your system matches the requirements above, download the package including the war-file: 52°North STA latest version

Unzip the package and browse to the folder UNZIPPED_PACKAGE/bin/target where the file 52n-sensorthings-webapp.war is located. Copy the file 52n-sensorthings-webapp.war into the folder /opt/tomcat/webapps. Make sure your Tomcat and PostgreSQL are running. After a moment the war-file gets converted and in the folder should be a new folder 52n-sensorthings-webapp.

When your system matches the requirements above, download the war-file: 52°North SensorThings-API workshop version

# Activity 1
  1. Save the file to /home/demo/
  2. Open a terminal see
  3. Copy the file 52n-sensorthings-webapp into the folder /opt/tomcat/webapps

    sudo cp /home/demo/52n-sensorthings-webapp.war /opt/tomcat/webapps/
  4. Press enter

After a moment the war-file gets converted and in the folder should be a new folder 52n-sos-webapp. If this is the case than you can reach the webapp with this URL: http://localhost:8080/52n-sos-webapp/

If the download does not work, you find an already downloaded version in /home/demo/webapps/:

  • Alternative sudo cp /home/demo/webapps/52n-sensorthings-webapp.war /opt/tomcat/webapps/

Configuration

Next navigate in this new folder to the application.yml and open it with an editor (/opt/tomcat/webapps/52n-sensorthings-webapp/WEB-INF/classes). You need to adjust the following settings manually:

  • server -> rootUrl: Used for response serialization + url parsing, external URL Must be set correctly! ->Tutorial: "http://localhost:8080/52n-sensorthings-webapp/"
  • server -> servlet -> context-path: The path of the running STA (name of the applet in the Apache Tomcat). -> Tutorial: "/52n-sensorthings-webapp"
  • server -> feature -> httpReadOnly: To allow transactional operations this has to be set to false
  • spring -> datasource: Connection information to the database
    • username: Database user name -> Tutorial: postgres
    • password: Database user password -> Tutorial: postgres
    • url: URL to the database (last value is the database name) -> Tutorial: jdbc:postgresql://localhost:5432/sensorweb
    • jpa -> properties -> hibernate -> hbm2ddl -> auto: If you use the STA together with the SOS, set the setting to none! -> Tutorial: none
# Activity 1a

Modify application.yml via terminal and vim

  1. Open a terminal see
  2. Open the application.yml in an editor

    sudo vim /opt/tomcat/webapps/52n-sensorthings-webapp/WEB-INF/classes/application.yml
  3. Press enter

  4. Change the above mentioned parameter
  5. Save the changes
# Activity 1b
  1. Open the Files application (Activities -> file cabinet symbol)
  2. Go to /opt/tomcat/webapps/52n-sensorthings-webapp/WEB-INF/classes
  3. Right click onapplication.ymland select Open with Text Editor
  4. Change the above mentioned parameter
  5. Save the changes
# Activity 1b
  1. Open the Tomcat manager: http://localhost:8080/manager/html/
  2. Type credentials admin:tomcat
  3. Press Start or Reload in the Commands column behind /52n-sensorthings-webapp

If this service is started you can reach the webapp with this URL: http://localhost:8080/52n-sensorthings-webapp/

When you successfully reach the service the response should be a json document looking like this:

{
    "value": [
        {
            "name": "Datastreams",
            "url": "http://localhost:8080/52n-sensorthings-webapp/Datastreams"
        },
        {
            "name": "Observations",
            "url": "http://localhost:8080/52n-sensorthings-webapp/Observations"
        },
        {
            "name": "Things",
            "url": "http://localhost:8080/52n-sensorthings-webapp/Things"
        },
        {
            "name": "Locations",
            "url": "http://localhost:8080/52n-sensorthings-webapp/Locations"
        },
        {
            "name": "HistoricalLocations",
            "url": "http://localhost:8080/52n-sensorthings-webapp/HistoricalLocations"
        },
        {
            "name": "Sensors",
            "url": "http://localhost:8080/52n-sensorthings-webapp/Sensors"
        },
        {
            "name": "ObservedProperties",
            "url": "http://localhost:8080/52n-sensorthings-webapp/ObservedProperties"
        },
        {
            "name": "FeaturesOfInterest",
            "url": "http://localhost:8080/52n-sensorthings-webapp/FeaturesOfInterest"
        }
    ],
    "serverSettings": {
        "conformance": [
            "http://www.opengis.net/spec/iot_sensing/1.1/req/datamodel",
            "http://www.opengis.net/spec/iot_sensing/1.1/req/resource-path/resource-path-to-entities",
            "http://www.opengis.net/spec/iot_sensing/1.1/req/request-data",
            "http://www.opengis.net/spec/iot_sensing/1.1/req/create-update-delete",
            "https://github.com/52North/sensorweb-server-sta/extension/server-properties.md",
            "https://github.com/52North/sensorweb-server-sta/extension/server-version.md"
        ],
        "https://github.com/52North/sensorweb-server-sta/extension/server-properties.md": {
            "escapeId": true,
            "implicitExpand": false,
            "updateFOI": false,
            "variableEncodingType": false,
            "isMobile": false,
            "mqttReadOnly": false,
            "httpReadOnly": false,
            "mqttPublishTopics": "Observations",
            "observation": {
                "samplingGeometry": "http://www.opengis.net/def/param-name/OGC-OM/2.0/samplingGeometry",
                "verticalFrom": "verticalFrom",
                "verticalTo": "verticalTo",
                "verticalFromTo": "vertical"
            }
        },
        "https://github.com/52North/sensorweb-server-sta/extension/server-version.md": {
            "git.repository": "https://github.com/52North/sensorweb-server-sta",
            "git.lastCommitDate": "2020-12-16 12:55:46+0100",
            "git.path": "d23185a8b80110405841d7a230345d2ebf26a53a",
            "git.lastCommitMessage": "[maven-release-plugin] prepare release v3.0.0",
            "git.revision": "d23185a8b80110405841d7a230345d2ebf26a53a",
            "project.name": "52North SensorThingsAPI",
            "project.version": "3.0.0",
            "project.time": "2020-12-16T12:04:42.179Z",
            "git.builddate": "2020-12-16 13:04:46+0100"
        }
    }
}

Now you successfully installed your STA.