Skip to content

VEuPathDB/service-osi-generator

Repository files navigation

Organism Specific ID Service

Development

Requirements

Docker

for building/running service image

Docker Compose

for building/running service image

NodeJS

for doc generation

NPM

for doc generation

Java14+

service is using Java14

Maven

used to build non-published dependencies:

Running the Service

Due to this service’s dependence on a running postgres instance, having Docker and Docker Compose available is more convenient, but it is not required.

For runtime requirements see the API documentation.

With Docker Compose

🔥

It’s strongly advised that the required environment variables be set in a file named .env in the project root. This will help avoid putting protected/credential information in your bash history.

Docker Compose will automatically read this file and use the environment variables set there when starting up the service containers.

For more information see the Docker Compose docs.

Spinning up the service containers with Docker Compose can be done with the following command:

$ docker-compose -f docker/docker-compose.dev.yml up

This will build and start both the service and database containers.

The services will be made available from your host machine at localhost:5432 for postgres and localhost:8080 for the HTTP server.

Docker

This project includes 2 Docker Compose configs as well as 2 Docker configs for the HTTP service. One of each for production and development. The postgres Docker config is used for both development and production.

Production Docker

docker/DB.Dockerfile

Postgres instance

docker/docker-compose.prod.yml

Docker Compose configuration.

docker/SVC.prod.Dockerfile

Docker configuration.

Testing the Service

Unit Tests

Unit tests are run automatically as part of the build, but can be run locally using the command ./gradlew test. All unit tests can be found under ./src/test/java/.

API Tests

Running the API tests requires both Docker and Docker Compose.

The API tests can be run using the command make api-test. This will spin up a temporary instance of both the HTTP service and the Postgres instance then run the battery of tests against the running instances.

The API tests are defined under the ./api-test sub project.