Sign inSign up

hmcts/ccd-data-store-api

By hmcts

•Updated over 7 years ago

Store/search cases and provide workbaskets

Image
0

8.6K

hmcts/ccd-data-store-api repository overview

⁠ccd-data-store-api

API v1 API v2 (beta) Build Status Docker Build Status codecov Codacy Badge Known Vulnerabilities HitCount License: MIT

Store/search cases and provide workbaskets

⁠Prerequisites
⁠Environment variables

The following environment variables are required:

NameDefaultDescription
DATA_STORE_DB_HOSTlocalhostHost for database
DATA_STORE_DB_PORT5432Port for database
DATA_STORE_DB_USERNAME-Username for database
DATA_STORE_DB_PASSWORD-Password for database
DATA_STORE_TOKEN_SECRET<random string>Secret for generating internal JWT tokens for events
DATA_STORE_IDAM_KEY-Definition store's IDAM S2S micro-service secret key. This must match the IDAM instance it's being run against.
DATA_STORE_S2S_AUTHORISED_SERVICESccd_gwAuthorised micro-service names for S2S calls
IDAM_USER_URL-Base URL for IdAM's User API service (idam-app). http://localhost:4501 for the dockerised local instance or tunneled dev instance.
IDAM_S2S_URL-Base URL for IdAM's S2S API service (service-auth-provider). http://localhost:4502 for the dockerised local instance or tunneled dev instance.
USER_PROFILE_HOST-Base URL for the User Profile service. http://localhost:4453 for the dockerised local instance.
DEFINITION_STORE_HOST-Base URL for the Definition Store service. http://localhost:4451 for the dockerised local instance.
CCD_DM_DOMAIN-Base URL for the Document Management domain.
AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY-For CNP environment this is provided by the terraform scripts. However any value would do for your local environment.
DATA_STORE_DEFAULT_LOG_LEVELINFODefault log level for classes under package uk.gov.hmcts.ccd
HTTP_CLIENT_MAX_TOTAL100Used for Pooling connection manager; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_SECONDS_IDLE_CONNECTION120Used for Pooling connection manager; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_MAX_CLIENT_PER_ROUTE20Used for Pooling connection manager; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_VALIDATE_AFTER_INACTIVITY0Used for Pooling connection manager; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_CONNECTION_TIMEOUT3000030 seconds, Used for Pooling connection manager; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_CONNECTION_DRAFTS_CREATE_TIMEOUT10001000 milliseconds, Used for Pooling connection manager for create operation for draft store; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
HTTP_CLIENT_CONNECTION_DRAFTS_TIMEOUT500500 milliseconds, Used for Pooling connection manager for draft store; for further information, see https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html⁠
DRAFT_STORE_URL-Base URL for Draft Store API service. http://localhost:8800 for the dockerised local instance.
DRAFT_ENCRYPTION_KEY-Draft encryption key. The encryption key used by draft store to encrypt documents with.
DRAFT_TTL_DAYS-Number of days after which the saved draft will be deleted if unmodified.
⁠Building

The project uses Gradle⁠.

To build project please execute the following:

./gradlew clean build
⁠Running

If you want your code to become available to other Docker projects (e.g. for local environment testing), you need to build the image:

docker-compose build

The above will build both the application and database images.
If you want to build only one of them just specify the name assigned in docker compose file, e.g.:

docker-compose build ccd-data-store-api

When the project has been packaged in target/ directory, you can run it by executing following command:

docker-compose up

As a result the following containers will get created and started:

  • Database exposing port 5452
  • API exposing ports 4452
⁠Handling database

Database will get initiated when you run docker-compose up for the first time by execute all scripts from database directory.

You don't need to migrate database manually since migrations are executed every time docker-compose up is executed.

You can connect to the database at http://localhost:5452 with the username and password set in the environment variables.

⁠Functional Tests

The functional tests are located in aat folder. These are the tests run against an environment. For example if you would like to test your local environment you'll need to export the following variables on your .bash_profile script. You'll

#Smoke/Functional Tests
export TEST_URL=http://localhost:4452
export S2S_URL=http://localhost:4502
export CCD_GW_SERVICE_NAME=ccd_gw
export CCD_GW_SERVICE_SECRET=AAAAAAAAAAAAAAAC
export [email protected]
export CCD_CASEWORKER_AUTOTEST_PASSWORD=XYZT

These tests also rely on the CCD_CNP_27.xlsx file to be already imported. The latest version of this file could be found in ccd-definition-store-api⁠ project under the aat/src/resource folder. You may want to import it to your local installation before trying to run the functional tests against your local environment.

⁠LICENSE

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

Size

168.2 MB

Last updated

over 7 years ago

docker pull hmcts/ccd-data-store-api