Skip to content

Commit

Permalink
DTSCCI-812 add preview dev env (#4467)
Browse files Browse the repository at this point in the history
* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

* DTSCCI-812 adding scripts to run a preview dev environment

---------

Co-authored-by: mfallonhmcts <[email protected]>
  • Loading branch information
gmikerlemos and mfallonhmcts authored Sep 19, 2024
1 parent 1d25be4 commit 286681a
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,39 @@ additional information where necessary.
Still, you shouldn't be doing it so make sure you get in touch with a Technical Lead soon afterwards.

## Development / Debugging Environment - Preview with Mirrord

As an alternative for a development environment there is a procedure in place where after running the command
below the required services for Civil are created in Preview under the developer's name, so these will be exclusively
for the named developer use.
While connected to the VPN simply run one of the below commands from your project's (civil-citizer-ui) folder:

Note: be sure to have Docker running
```shell
npx @hmcts/dev-env@latest && ./bin/setup-devuser-preview-env.sh
```
You can optionally specify a branch for CCD definitions and Camunda definitions like below or leave it blank to use master.

```shell
npx @hmcts/dev-env@latest && ./bin/setup-devuser-preview-env.sh ccdBranchName camundaBranchName generalAppCCDBranch dmnBranch waStandaloneBranch
```

Once the pods are up and running you can connect to them using a plugin called Mirrord on Intellij or VSCode.
https://mirrord.dev

If you want to clean up the environment just run:

```shell
npx @hmcts/dev-env@latest --delete
```

To run the specialised charts, where you can get Work Allocation for instance, run:

```shell
npx @hmcts/dev-env@latest --template values.enableWA.preview.template.yaml && ./bin/setup-devuser-preview-env.sh
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
28 changes: 28 additions & 0 deletions bin/setup-devuser-preview-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ccdBranch=${1:-master}
camundaBranch=${2:-master}
dmnBranch=${3:-master}
waStandaloneBranch=${4:-master}
generalAppCCDBranch=${5:-master}

echo "Loading Environment Variables"
source ./bin/variables/load-dev-user-preview-environment-variables.sh

echo "Importing Roles to the CCD pod"
./bin/add-roles.sh

echo "Importing Camunda definitions"
./bin/pull-latest-camunda-files.sh ${camundaBranch}
./bin/pull-latest-dmn-files.sh ${dmnBranch}
./bin/pull-latest-camunda-wa-files.sh ${waStandaloneBranch}

echo "Importing CCD definitions"
./bin/import-ccd-definition.sh "-e *-prod.json,*-shuttered.json" ${ccdBranch}
./bin/import-ga-ccd-definition.sh "-e *-prod.json" ${generalAppCCDBranch}

rm -rf $(pwd)/ccd-definitions
rm -rf $(pwd)/build/ccd-development-config
rm -rf $(pwd)/civil-bpmn

echo "ENV variables set for devuser-preview environment."
echo "XUI_URL: $XUI_WEBAPP_URL"
echo "CUI_URL: $TEST_URL"
29 changes: 29 additions & 0 deletions bin/variables/load-dev-user-preview-environment-variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -eu
user=$(whoami)
echo "User directory: /Users/$user"

source .env.local

export ENVIRONMENT=preview
# urls
export URL=$XUI_WEBAPP_URL
export CIVIL_SERVICE_URL=$CIVIL_SERVICE_URL
export SERVICE_AUTH_PROVIDER_API_BASE_URL="http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
export IDAM_API_BASE_URL="https://idam-api.aat.platform.hmcts.net"
export IDAM_API_URL="https://idam-api.aat.platform.hmcts.net"
export CCD_IDAM_REDIRECT_URL="https://ccd-case-management-web-aat.service.core-compute-aat.internal/oauth2redirect"
export CCD_DEFINITION_STORE_API_BASE_URL=$CCD_DEFINITION_STORE_API_URL
export CAMUNDA_BASE_URL=$CAMUNDA_URL
export DEFINITION_IMPORTER_USERNAME=$(az keyvault secret show --vault-name civil-aat --name ccd-importer-username --query value -o tsv)
export DEFINITION_IMPORTER_PASSWORD=$(az keyvault secret show --vault-name civil-aat --name ccd-importer-password --query value -o tsv)
export CCD_CONFIGURER_IMPORTER_USERNAME=$DEFINITION_IMPORTER_USERNAME
export CCD_CONFIGURER_IMPORTER_PASSWORD=$DEFINITION_IMPORTER_PASSWORD
export CCD_API_GATEWAY_IDAM_CLIENT_SECRET=$(az keyvault secret show --vault-name ccd-aat --name ccd-api-gateway-oauth2-client-secret --query value -o tsv)
export CCD_API_GATEWAY_S2S_SECRET=$(az keyvault secret show --vault-name s2s-aat --name microservicekey-ccd-gw --query value -o tsv)
export S2S_SECRET=$(az keyvault secret show --vault-name civil-aat --name microservicekey-civil-service --query value -o tsv)
# definition placeholders
export CCD_DEF_CASE_SERVICE_BASE_URL=$CIVIL_SERVICE_URL
export CCD_DEF_GEN_APP_SERVICE_BASE_URL=$GENERAL_APPLICATIONS_URL
export HEALTH_WORK_ALLOCATION_TASK_API=TBD

0 comments on commit 286681a

Please sign in to comment.