Skip to content

ministryofjustice/hmpps-interventions-ops

Repository files navigation

hmpps-interventions-ops

Tools used by the interventions dev team in day-to-day operations.

Statuses

What Status
ui-service contracts ui-service pact
check dependency health from environment configuration ./health.sh hmpps-interventions-ui hmpps-interventions-prod
deployed versions ./versions.sh
use SHOW_FILES=1 as well for what files changed
use GIT_ROOT=/path/where/your/github/repos/are/cloned if intervention repos are cloned somewhere else
check latest commit age on all remote branches ./check_branch_age.sh
use GIT_ROOT=/path/where/your/github/repos/are/cloned if intervention repos are cloned somewhere else
setup port forwarding to the pre-prod database to localhost:5433 ./setup_preprod_port_forward.sh
compile helm charts into full kubectl yaml files ./compile_helm.sh {repo} {env}
call community-api with client credentials ./get_namespace_community_api_call.sh {query path} (needs VPN)

get_namespace_community_api_call.sh

Automatically configure the access token and hostname for community-api and make the call.

🙋‍♂️ Usage checklist:

  • Your active namespace is hmpps-interventions-dev;
  • You are connected to the VPN.
$ ./get_namespace_community_api_call.sh /secure/offenders/crn/D002399/allOffenderManagers | jq
Calling API using default namespace (hmpps-interventions-dev)
Using (needs VPN) https://community-api-secure.test.delius.probation.hmpps.dsd.io/secure/offenders/crn/D002399/allOffenderManagers
Getting access token using default namespace (hmpps-interventions-dev)
[
  {
    "staffCode": "N02P054",
    "staffId": 2500001781,
    "isResponsibleOfficer": true,
{snip}

setup_preprod_port_forward.sh

This script semi-automates the article in Cloud Platform user guide.

The alternative approach of running queries would be to run a psql container, but that has significant drawbacks:

  • all input and output is automatically log collected
  • this means any accidental exposure of personal information would be retained in the logs

This port-forwarding method provides an alternative that still requires credentials to access the namespace, but does not expose sensitive information accidentally.

🚨 Please read data at rest on MoJ-issued laptops for guidance on storing sensitive data (query output).

Usage

$ ./setup_preprod_port_forward.sh
pod/port-forward-username created
pod/port-forward-username condition met

✨ Turning on port-forwarding to hmpps-interventions-preprod
✨ Use Ctrl-C to exit and cleanup
🧑‍💻 Connect to the database via localhost:5433 and hmpps-interventions-preprod postgres credentials

Forwarding from 127.0.0.1:5433 -> 5432
Forwarding from [::1]:5433 -> 5432

To exit, press Ctrl+C and wait for the pod to terminate.

Connecting to the forwarded database

View the credentials with kubectl get secret/postgres14 -n hmpps-interventions-preprod -ojson | jq '.data | map_values(@base64d)'

You can use any database tool. If you want to use psql locally, connect via psql -h localhost -p 5433 -U database_username database_name:

$ psql -h localhost -p 5433 -U cpS00... dba32...
<password prompt>

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published