Event handler for Digital Publishing CI
| Environment variable | Default | Description |
|---|---|---|
| CONSUMER_QUEUE | The name of the SQS queue to consume from | |
| CONSUMER_QUEUE_URL | The url of the SQS queue to consume from | |
| DEPLOYMENT_ROOT | The path to download deployment bundles | |
| NOMAD_CA_CERT | The path to the CA cert file | |
| NOMAD_ENDPOINT | http://localhost:4646 | The endpoint of the Nomad API |
| NOMAD_TLS_SKIP_VERIFY | false | When using TLS to nomad, skip checking certs (bool) |
| NOMAD_TOKEN | The ACL token used to authorise HTTP requests | |
| PRIVATE_KEY | Private key for decrypting secrets | |
| PRODUCER_QUEUE | The name of the SQS queue to produce to | |
| VERIFICATION_KEY | Public key for verifying SQS messages | |
| AWS_REGION | eu-west-1 | The AWS region used |
| VAULT_ADDR | https://127.0.0.1:8200 | Vault endpoint URL |
| HEALTHCHECK_INTERVAL | 10s | The time between calling healthcheck endpoints for check subsystems |
| HEALTHCHECK_CRITICAL_TIMEOUT | 60s | The time taken for the health changes from warning state to critical due to subsystem check failures |
| BIND_ADDR | :24300 | The listen address to bind to |
| DEPLOYMENT_TIMEOUT | 20m | The max time to wait for a deployment to complete |
| CONSUMER_QUEUE_NEW | The name of the new SQS queue to consume from | |
| CONSUMER_QUEUE_URL_NEW | The url of the new SQS queue to consume from |
The application also expects your AWS credentials to be configured.
The /health endpoint returns the current status of the service. Dependent services are health checked on an interval defined by the HEALTHCHECK_INTERVAL environment variable.
On a development machine a request to the health check endpoint can be made by:
curl localhost:24300/health
There are various ways to test the deployer code. The dp-operations guide gives you a brief introduction about the deployer and an overview about how to deploy it.
This section shows you how to test the deployer code changes in the environment and how to rollback to the previous version by just reverting the dp_deployer_version in dp-setup and running the ansible-playbook command for easy deployment.
-
Update the deployer code and update the tests as per requirement.
-
Run
make testandmake buildto check if your code is ready for testing -
Start colima by running the command
colima start. -
Prepare ECR authentication by running
make prep-ecr. -
Run
make deploymentand this should build an image for your new updated code, push the image toECRand bundle it to s3. Note: The tar bundle which includes a nomad plan can be seen in s3 which is always underproduction/no matter which environment ansible is targetting. The nomad plan points to the ECR image. -
Go to
dp-setupand check you are in the right environment to run ansible. It is recommended you stick withsandboxfor testing. Amend thedp_deployer_versionfrom the output of themake deploymentcommand.vim +/dp_deployer_version dp-setup/ansible/roles/bootstrap-deployer/defaults/main.yml
-
After updating the
dp_deployer_version, run the ansible-playbook command to bootstrap the deployer.export ONS_DP_ENV = sandbox ansible-playbook --vault-id=$(ONS_DP_ENV)@.$(ONS_DP_ENV).pass -i inventories/$(ONS_DP_ENV) bootstrap-deployer.yml
-
Check nomad-ui if the deployer has been deployed successfully.
-
Go to concourse-ui and deploy the
dp-import-reporterand then trigger<env>-ship-itto test the deployer code. -
If the previous step has been successful, trigger the
secretspipeline to confirm that it is working as expected. -
If it hasn't been successful, rollback to the previous version of the deployer, by reverting the
dp_deployer-versionindp-setupas mentioned in step 6 and then re-apply thebootstrap-deployerplaybook command as shown in step 7.
Copyright © 2025, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.