Skip to content

ministryofjustice/bichard7-next-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Bichard 7 Core

The code to replace the processing logic of Bichard 7.

Contents

Structure of this Monorepo

Packages:

Quickstart

Pre-Requisites

Install the following required components:

Booting the infrastructure

This project has a number of external dependencies that need building in order to run the whole stack. Check the following out and run make build in each repository:

  • Docker Images
    • Make command is SKIP_GOSS=true make build-local for this repo
  • Bichard7 Next (Old Bichard)
    • Make command is make build for this repo, or
    • make build-debug if you need to run Bichard in debug mode
  • PNC Emulator
    • Make command is make build for this repo
  • BeanConnect
    • Make command is SKIP_GOSS=true make build for this repo
  • Audit Logging
    • Make command is make build-api-server build-event-handler-server for this repo
  • User Service
    • Navigate to packages/user-service and run make build
  • UI
    • Navigate to packages/ui and run make build

Bichard relies on a number of containers to run from end to end. These can all be booted up by running:

aws-vault exec bichard7-shared -- npm run all

This will pull down the images from ECR so you don't need to build them. On an M1 Mac, see below.

You can also run subsets of the infrastructure using:

  • npm run bichard-legacy will run old Bichard, ActiveMQ, Postgres, BeanConnect, PNC Emulator, User Service, Auth Proxy and the new UI
  • npm run conductor will run Conductor, Postgres, Localstack and the worker
  • npm run conductor-no-worker will run Conductor, Postgres, Localstack and will not run the worker (for development purposes)

You can also run the end-to-end tests against core in Conductor with:

npm run test:e2e

Finally, to bring all of that infrastructure down again, you can use:

npm run destroy

Running legacy Bichard in debug mode

  1. Use Intellij (VS Code doesn't work for debugging) to open the bichard7-next project
  2. Build a debug image using make clean build-debug
  3. Run the legacy infrastructure using npm run bichard-legacy-debug from the Core repo
  4. In IntelliJ select Run >> Edit Configurations from the menu
  5. Click the + button in the top left and select Remote JVM Debug
  6. Set the port to 7777 and give the configuration a name
  7. Select Run >> Debug and then choose the configuration you just created
  8. Click the green bug icon and you should see Connected to the target VM, address: 'localhost:7777', transport: 'socket' printed out
  9. Set breakpoints then use Bichard and IntelliJ will let you step through the code

Building on an M1 Mac

We can't pull the images down from ECR for an M1 Mac because they are not in ARM format. Therefore, it is necessary to build the relevant images yourself.

  1. In the bichard7-next-infrastructure-docker-images repository, run make build-local to just build the required images
  2. Follow the instructions in the bichard7-next repository to build the Bichard Open Liberty image
  3. In the user-service package, run make build or the top level of bichard7-next-core run this script ./scripts/build-user-service-docker.sh
  4. In the ui package, run make build or the top level of bichard7-next-core run this script ./scripts/build-ui-docker.sh

Running Packages locally

  1. From the root directory npm ci
  2. Run npm run build:core
  3. If you need to change packages/common you have to two options, build will just build the package once or watch all listen for changes and rebuild. You can either:
    1. cd packages/common
      1. And run npm run build
      2. Or npm run watch
    2. Or from the root of Core:
      1. npm run build -w packages/common
      2. Or, npm run watch -w packages/common
  4. Go to the package you want to change and follow that package's README

Publishing package updates

The code in this repository is packaged in the @moj-bichard7-developers/bichard7-next-core NPM package.

To deploy a new version of the package:

  1. Manually bump the version number in package.json in your PR. It's recommended to follow semantic versioning principles.
  2. Merge your PR into the main branch.
  3. Run the Release GitHub action against the main branch, by clicking the "Run workflow" button in the Actions interface.

Testing

To run unit tests against the new Bichard:

npm i # If packages not already installed
npm t

To run unit tests against old Bichard (requires the old Bichard stack to be running):

npm i # If packages not already installed
npm run test:bichard

Excluding Triggers

Triggers can be excluded for either a specific force or court by adding the trigger code (e.g, TRPR0001) to either data/excluded-trigger-configuration.json for production systems or data/excluded-trigger-configuration.test.json for test environments.

The choice of which excluded-trigger-configuration file to use is decided in src/lib/excludedTriggerConfig.ts using the NODE_ENV environment variable. The test configuration file (excluded-trigger-configuration.test.json) is run if NODE_ENV is set as testing.

Environment Variable Description
NODE_ENV The environment node is being run in

Conductor

See README in packages/conductor for more information.

About

The core processing logic for the Bichard application

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published