This component is part of the Repository, responsible for creating and handling of EHR transfers out from the Repository,
when the Orphaned/Stranded health record stored in the Repository's ehr-repository
is requested by the next registering
practice.
When the a GP2GP EHR request on its incoming queue, the ehr-out-service
accepts this and creates a record to track this outward transfer.
After the successful validation of the request and retrieval of patient's health record from ehr-repository
, it sends the
EHR out to the requesting practice via gp2gp-messenger
.
Follow the links to download
- Node - version 14.x
- Docker
- kudulab/dojo
This repository imports shared AWS helpers from prm-deductions-support-infra.
They can be found utils
directory after running any task from tasks
file.
Directory | Description |
---|---|
/test/docker | Contains smoke test for docker |
/test/functional | Contains tests against deployed service |
/gocd | Contains the GoCD pipeline files |
/src | The source code |
/terraform | Terraform to deploy app as a Fargate task in AWS |
/scripts | Useful scripts (e.g. for sending canary messages) |
/utils | Contains aws-helpers |
BEWARE be sure what you're doing here as node_modules
can contain platform-specific files e.g. mac vs linux/amd64 not
necessarily compatible
- Run
npm install
to install all node dependencies. - Configure local environment variables:
- enter
dojo
- run
./tasks _setup_test_integration_local
- enter
- Run
npm run start:local
- If successful, you will be able to reach the Swagger docs: http://localhost:3000/swagger/
Note: npm run start:nodemon
can be used to build the app before launching the Express server on port 3000
using nodemon - it will watch and reload the server upon any file changes.
A Docker image can be built locally with:
- Run
./tasks build
. This runs babel on source (needed?) but also usesnpm install
to ensurepackage-lock,json
is up-to-date. - Run
./tasks build_docker_local
. This builds the docker containersdeductions/<component-name>:<commit-no>
anddeductions/<component-name>:latest
with the app in - Run
./tasks test_docker_local
to ensure the image has been built correctly - If the above fails,
./tasks run_docker_local
to debug production build
The swagger documentation for the app can be found at http://localhost:3000/swagger. To update it, change the
src/swagger.json
file. You can use this editor which will validate your changes.
Run the unit tests with npm run test:unit
(or npm test
to run it with lint).
Alternatively, ./tasks test
can be used to run the tests with Dojo.
Enter dojo -c Dojofile-itest
Run ./tasks test_integration
to run with Dojo.
Runs the coverage tests (unit test and integration test) and collects coverage metrics.
Enter dojo -c Dojofile-itest
Run ./tasks test_coverage
to run within Dojo.
Run ./tasks test_docker_local
. Make sure you have followed the steps to start the app in production mode beforehand.
Run ./tasks test_functional
. This will run the end to end tests within ./test/functional. (Note you may need to be connected to VPN).
Before committing, ensure you run the following tests:
- Unit tests
- Integration tests
- Coverage tests
- Local docker test
Below are the environment variables that are automatically set:
NHS_ENVIRONMENT
- is set to the current environment in which the container is deployed. It is set in Terraform and populated by the pipeline.gocd.yml for tests.SERVICE_URL
- This is prepopulated bytasks
and will configure it to service URL according to environment.REPOSITORY_URI
- This is prepopulated bytasks
(based onIMAGE_REPO_NAME
)
In order to get sufficient access to work with terraform or AWS CLI, please follow the instructions on this confluence pages and this how to?
As a note, this set-up is based on the README of assume-role tool
brew install remind101/formulae/assume-role
Run the following command with the profile configured in your ~/.aws/config
:
assume-role dev [here choose one of the options from your config: ci/dev/test]
Run the following command with the profile configured in your ~/.aws/config
:
eval $(dojo "echo <mfa-code> | assume-role dev"
or
assume-role dev [here choose one of the options from your config: ci/dev/test]
Run the following command to confirm the role was assumed correctly:
aws sts get-caller-identity
Work with terraform as per usual:
terraform init
terraform apply
If your session expires, exit the container to drop the temporary credentials and run dojo again.