laa-crown-court-contribution

This is a Java based Spring Boot application hosted on MOJ Cloud Platform.

CircleCI MIT license

Contents

Getting started

Developer setup

  1. Go through with this Java Developer On-boarding Check List and complete all tasks.
  2. Request a team member to be added to the repository.
  3. Create a GPG (more detail further down on the page) key and create a PR. Someone from the team will approve the PR.
  4. This is a document to outline the general guideline Developer Guidelines.
  5. This project have its own dedicated Jira Scrum board, and you can access from here and project backlog

Obtaining environment variables for running locally

To run the app locally, you will need to download the appropriate environment variables from the team vault in 1Password. These environment variables are stored as a .env file, which docker-compose uses when starting up the service. If you don't see the team vault, speak to your tech lead to get access.

To begin with, make sure that you have the 1Password CLI installed:

op version

If the command is not found, follow the steps on the 1Password developer docs to get the CLI set-up.

Once you're ready to run the application:

./startup-local.sh

Decrypting values files

The values YAML files are encrypted using git-crypt.

To be able to view and/or edit these files, you will need to decrypt them first.

You will first need to create a GPG key. See Create a GPG Key for details on how to do this with GPGTools (GUI) or gpg (command line). You can install either from a terminal or just download the UI version.

brew update
brew install gpg
brew install git-crypt

Once you have done this, a team member who already has access can add your key by running git-crypt add-gpg-user USER_ID* and creating a pull request to this repo.

Once this has been merged you can decrypt your local copy of the repository by running git-crypt unlock.

*USER_ID can be your key ID, a full fingerprint, an email address, or anything else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY A USER ID" in the gpg man page).

Running locally

Clone Repository

git clone git@github.com:ministryofjustice/laa-crown-court-contribution.git

cd crown-court-contribution

The project is build using Gradle. This also includes plugins for generating IntelliJ configuration.

Make sure tests all testes are passed by running following ‘gradle’ Command

./gradlew clean test

You will need to build the artifacts for the source code, using gradle.

./gradlew clean build

The apps should then startup cleanly if you run

./startup-local.sh

laa-crown-court-contribution application will be running on http://localhost:8080

Database

This application is run with PostgresSQL using docker compose. PostgresSQL is used solely for static data. For database changes, we are using liquibase and all the sql scripts stored in the directory (resources/db/changelog/).

All CRUD operations in the MAATDB are run via the MAAT-API

CI/CD

We have configured a CircleCI code pipelines. You can log in from here to access the pipeline.

To make any changes,create a branch and submit the PR. Once the PR is submitted the branch deployment is kicked off under the new branch name. On successful build, the image is pushed to AWS ECR and requires approval to deploy to dev.

Once the PR is merged with main, the build is automatically deployed to DEV. Deployment to higher environments requires approval.