Skip to content

Tomcat Deployment

Hylke van der Schaaf edited this page Jan 26, 2018 · 4 revisions

Install tomcat

You can either download Tomcat from the tomcat website, or use the version of you distribution.

Add the PostgreSQL and PostGIS jars to Tomcat

Copy the Postgres JDBC jar and the postgis jar to $CATALINA_HOME/lib.

Deploy the SensorThingsServer in Tomcat

Copy the SensorThingsServer-x.x.war to the tomcat webapps folder. It's best to rename the war to just SensorThingsServer.war to make upgrading easier when a new version is release. If you deploy the SensorThingsServer for the first time, a configuration file is copied to conf/Catalina/localhost/SensorThingsServer.xml. You need to edit this file, and set up the database connection details.

<Resource
    name="jdbc/sensorThings" auth="Container"
    type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://localhost:5432/sensorthings"
    username="sensorthings" password="ChangeMe"
    maxTotal="20" maxIdle="10" maxWaitMillis="-1"
    defaultAutoCommit="false"
/>

You need to change some things:

  • the url from jdbc:postgresql://database:5432/sensorthings to jdbc:postgresql://localhost:5432/sensorthings
  • the username to what you set up in step 3.2 above
  • the password to what you set up in step 3.3 above
  • If you want to use String or UUID ids, change the persistence.persistenceManagerImplementationClass

After saving the file, Tomcat will automatically reload the service.

To initialise the database, go to http://localhost:8080/SensorThingsService/DatabaseStatus. This should list a large number of SQL commands that the server wishes to execute in order to initialise the database. Click the Do Update button to update the database.

Done

You should now have a SensorThings API service running at: http://localhost:8080/SensorThingsService/v1.0. Have a look at the other options in conf/Catalina/localhost/SensorThingsServer.xml to see what can be configured.