Server Web Build

Module setup

Before setting up the generic web application, checkout the snapshot and release module artifacts. If the code changes that you need have not been uploaded to maven, create a Pull Request in the relevant repository. Once the PR has been reviewed and approved, merge it to the master branch and upload the new artifact to maven.  We have listed the modules that we currently have on the server side here.

Update pom.xml and set the correct versions for core, connector and register dependencies.

Update the following files with password credentials (MySQL, PostgreSQL and CouchDB)

  1. config/assets/config/couchdb.properties
  2. config/assets/config/opensrp.properties
  3. src/main/resources/quartz.properties
  4. src/main/webapp/META-INF/context.xml
  5. config/assets/migrations/environments/development.properties

NB: The config folder is a git submodule that holds server-wide properties. Checkout the following documentation for more info.

If you are using PostgreSQL as the main data store, checkout this documentation on how to run MyBatis migrations.

Generic Web profiles

The generic web app https://github.com/OpenSRP/opensrp-server-web has four major profiles defined in the pom file.

These are: couchdb, postgres, jedis, lettuce, Basic Auth and Oauth2. Couchdb and Postgres profile are used to define the main data store while Jedis and Lettuce, the redis client to use. Basic Auth and Oauth2 profile are used to determine which authentication methods are enabled. Basic Auth supports only Basic Auth while Oauth2 supports Basic auth and Oauth2

Postgres, Jedis and Basic Auth are activated by default and they will be active profiles when you run the following command

mvn clean package

But when you specify a maven  the active ones are overriden. Couchdb will be the only active profile when you run the following command

mvn clean package -P couchdb

This means that the redis client won't be defined.

To fix this, provide data store and redis client property types

mvn clean package -P couchdb,jedis,basic_auth

You can also use activation commands to enable a profile, with this method you can override a maven profile without specifying the other defaults
e.g


mvn clean package -Dopensrp.database.profile=couchdb


Deployment

Once tomcat is running, you can install the opensrp.war file from target folder into the webapps directory in order to run the application.

sudo cp target/opensrp.war /var/lib/tomcat7/webapps/

Related pages