The Companies house Document Generator for generating documents
In order to build document-generator locally you will need the following:
- Run make
- Run ./start.sh
The supported environmental variables have been categorised by use case and are as follows.
| Name | Description | Mandatory | Default | Example |
|---|---|---|---|---|
| DOCUMENT_RENDER_SERVICE_HOST | Render service host | ✓ | localhost:valid_port_number | |
| DOCUMENT_BUCKET_NAME | Bucket name to store the document | ✓ | dev-pdf-bucket/name_of_file | |
| API_URL | Api url to go through eric |
✓ | api.orctel.internal:$ERIC_PORT |
|
| CHS_API_KEY | CHS api key encoded and used to make APi calls | ✓ | valid Api key |
Note that the calling services generally have a long route that involve messaging (in which document-generator-consumer interfaces with document-generator) before there message gets to the document-generator:
- ch.gov.uk,
- search.web.ch.gov.uk
- abridged accounts: web and api
- small full accounts and cic : web and api
See Confluence design documents
The following are the modules that exist within document generator.
The document-generator-api module is a sub module within document-generator, it holds the api controller which is called passing resourceUri and mimeType to uri /private/documents/generate. The api deals with requesting the data to be rendered through the document-generator-interface, as well as making the call to the render service to generate a document. The details of the api request and response can be seen within document-generator-api/swagger-2.0/models
The document-generator-interface module is a sub module within document-generator, it holds the interface DocumentInfoService that contains the methods to getDocumentInfo in order to return the DocumentInfo model. Which will contain String data, String templateName, String assetId, String path, String descriptionIdentifier and a Map<String, String> description Values.
The document-generator-accounts module is a sub module within document-generator, it holds the accounts specific implementation of the DocumentInfoService that contains the method getDocumentInfo. Which returns the DocumentInfo model which will contain String data, String templateName, String assetId, String path, String descriptionIdentifier and a Map<String, String> description Values.
The document-generator-prosecution module is a sub module within document-generator, which is the prosecution implementation of the DocumentInfoService that contains the method getDocumentInfo. Which returns the DocumentInfo model which will contain String data, String templateName, String assetId, String path, String descriptionIdentifier and a Map<String, String> description Values for Ultimatum and SJP letters.
This project does not currently support the docker-chs-development development mode since there is no builder for multi-module maven projects.
However, you can run the project within docker-chs-development by using the below instructions:
make clean && make submodules && mvn package -DskipTests=true jib:dockerBuild -Dimage=document-generator-localIn file services/modules/docgen/document-generator.docker-compose.yaml, comment out the AWS ECR image and add a new line for the local docker image.
document-generator:
# image: 416670754337.dkr.ecr.eu-west-2.amazonaws.com/document-generator:latest
image: document-generator-localSee [Confluence project developer testing](https://companieshouse.atlassian. net/wiki/spaces/DEV/pages/5399314596/Testing+Document+Generator+using+docker-chs-development) page
The code present in this repository is used to define and deploy a dockerised container in AWS ECS. This is done by calling a module from terraform-modules. Application specific attributes are injected and the service is then deployed using Terraform via the CICD platform 'Concourse'.
| Application specific attributes | Value | Description |
|---|---|---|
| ECS Cluster | document-generation | ECS cluster (stack) the service belongs to |
| Load balancer | {env}-chs-apichgovuk {env}-chs-apichgovuk-private |
The load balancer that sits in front of the service |
| Concourse pipeline | Pipeline link Pipeline code |
Concourse pipeline link in shared services |
- Please refer to the ECS Development and Infrastructure Documentation for detailed information on the infrastructure being deployed.
- Ensure the terraform runner local plan executes without issues. For information on terraform runners please see the Terraform Runner Quickstart guide.
- If you encounter any issues or have questions, reach out to the team on the #platform slack channel.
- Any secrets required for this service will be stored in Vault. For any updates to the Vault configuration, please consult with the #platform team and submit a workflow request.