- Implementation details explains how the doc-index-updater works
- Development how-to explains how to work on improving, fixing or extending the doc-index-updater
For SPCs and PILs, a server called Sentinel sends either a Delete or a Create message. The latter includes details of how to retrieve the file to be created from Sentinel via SFTP.
For PARs, the PARs web portal allows users to either create or update (triggers a delete followed by a create) PAR files.
- a medical writer accesses the PARs portal and enters metadata and supplies a PDF file
- the upload form submits the metadata and the file to the doc-index-updater
- the doc-index-updater responds to the upload form with a job id for tracking the job status
- the doc-index-updater uploads the PDF file to a blob storage container in Azure for temporary storage with a prefix of
temp/
- the doc-index-updater pushes the blob information, along with the submitted metadata, to the Azure Service Bus "create" queue to be picked up by the doc-index-updater's create_manager service worker
- the create_manager service worker retrieves the message from the Azure Service Bus queue, and uses the metadata and temporary blob storage details to add the new PAR PDF to the search service index and permanent blob storage
The new PAR PDF will then be available from the products.mhra.gov.uk website.
The temp/
blob will be removed from the blob storage according the the storage lifecycle management policy
The following guides explain how to get started developing the doc-index-updater.
make docker-build
az acr login --name mhraproductsnonprodregistry
docker push mhraproductsnonprodregistry.azurecr.io/products/doc-index-updater
Run locally by tunneling redis connection to Azure over TLS using stunnel.
- install
stunnel
with homebrew:
brew install stunnel
- start stunnel in a new terminal window:
stunnel stunnel.conf
-
setup environment variables, via the steps below
-
run the service
make
To get SFTP working locally, enable SFTP login on your machine (instructions for a mac).
Then run make set-sftp-keys
to pull the public/private keys for development and install them in your home directory .ssh
dir. This will also add entries to your .env.overrides
file for the necessary environment variables.
Navigate to the ~/.ssh
dir and install the public key on your localhost server by running:
ssh-copy-id -f -i ./doc_index_updater <YOUR_USERNAME>@localhost
This will add the public key to your localhost ~/.ssh/authorized_keys
file.
The environment variables needed are listed in .env.example
.
Use this to create an .env
file reflecting your environment which the make
command will read.
Environment variables are shared via Azure key vault.
To get them, run make get-env
.
Note that you'll have to have followed the instructions on connecting to an existing kubernetes cluster before this will work,
as it has the instructions on installing the Azure CLI and authenticating to Azure.
In the event that environment variables change, find environment variables via the Azure portal or from terraform output.
Don't forget to run make set-env
to share with the team.
Run all tests:
make test
Run specific tests by passing <arguments>
through to cargo test
:
make test TEST=<arguments>
There's a dashboard set up in Azure to monitor latency, traffic, errors and saturation.
To find it, go to Shared Dashboards in the Azure Portal. More details about monitoring can be found in the infrastructure dir.
To create a new release and deployment to production, create and push a new tag of the form diu.vX.X.X
(e.g. diu.v1.3.0
), incrementing as required from the most recent version. The doc-index-updater-release
workflow will then automate the creation of a new deployment in Github, add the image for the tagged commit to the production container registry and update the image for production in the deployments
repo. This will trigger ArgoCD to update the image in production. You can then update the release notes with any useful detail in Github.