OpenSRP Server Refactor and Clean up

This page is for documenting our Server Refactor and Cleanup work.

Child Pages


OpenSRP Server (master branch)  has been refactored to several modules and web applications.

A module is a maven application that contains code for a particular feature or set of features that will be used by different applications. The module should emit/generate a Java archive (.jar) file that will  be pushed to maven. A web application with then download the maven file and add it as a dependency. For more info, checkout How to upload Server libraries to Maven/Sonatype

Modules

Common

https://github.com/OpenSRP/opensrp-server-common

Common Utility functions and audit feature

Api

https://github.com/OpenSRP/opensrp-server-api (depends on common)

EC (Event Client) Data model domain objects, Utility functions for location, google gson, tree and treenode, Contracts (interfaces) for security, location and authorization

Interface

https://github.com/OpenSRP/opensrp-server-interface

Data Transfer Objects (DTO) for the domain objects

Form

https://github.com/OpenSRP/opensrp-server-form (depends on common and interface)

Domain, service and repository for the old Form Submission Data Model (Replaced by EC Data model)

This model is still supported for those who haven't migrated to EC model.

Core

https://github.com/OpenSRP/opensrp-server-core (depends on common, api, interface and form)

Postgres, couchdb, lucene and scheduler domain objects, repositories and services

Register

https://github.com/OpenSRP/opensrp-server-register (depends on core)

Schedule handlers and services

Connector

https://github.com/OpenSRP/opensrp-server-connector (depends on api and core)

Integration with external systems - OpenMRS (REST and Atomfeed), DHIS2, RapidPro

OpenLMIS

https://github.com/OpenSRP/opensrp-server-openlmis

Domain objects, repositories, services and rest endpoints for OpenLMIS Data model

Reporting

https://github.com/OpenSRP/opensrp-server-reporting (depends on interface)

Domain objects, repositories, services and rest endpoints for Reporting

Applications

Generic Web

https://github.com/OpenSRP/opensrp-server-web (depends on core, register and connector)

Web Interface (Dash Board)

https://github.com/OpenSRP/opensrp-web-interface (depends on core and connector)

Adding a module as a dependency

Checkout Include artifact in a project

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 and lettuce. Couchdb and Postgres profile are used to define the main data store while Jedis and Lettuce, the redis client to use.

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

mvn clean package

But when you specify a property, 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

Code CleanUp

Codacy tool has been linked with github and will review code changes after a pull request has been created or updated.

Only the file changed will be reviewed. Codacy reviews the code changes in these files.

Developers are encouraged to open DNM pull requests to trigger reviews rather than wait until the actual PRs are created.

DNM stands for Do Not Merge, for example, “DNM: Fix some issue”

Protected Branch

The master branch in the modules and application has been set up as a protected branch.

This means that pull requests to the master branch should be reviewed.

Status check (travis, codacy and coverage) should pass.