Skip to content

Commit b303765

Browse files
Removed remaining dojo from ehr-out and updated README a bit
1 parent 4ee36de commit b303765

File tree

4 files changed

+2
-366
lines changed

4 files changed

+2
-366
lines changed

services/ehr-out-service/.talismanrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

services/ehr-out-service/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This component is part of the Repository, responsible for creating and handling of EHR transfers out from the Repository,
44
when the Orphaned/Stranded health record stored in the Repository's `ehr-repository` is requested by the next registering
55
practice.
6-
76
When the a GP2GP EHR request on its incoming queue, the `ehr-out-service` accepts this and creates a record to track this outward transfer.
87
After the successful validation of the request and retrieval of patient's health record from `ehr-repository`, it sends the
98
EHR out to the requesting practice via `gp2gp-messenger`.
@@ -16,28 +15,16 @@ Follow the links to download
1615
- [Node](https://nodejs.org/en/download/package-manager/#nvm) - version 14.x
1716
- [Docker](https://docs.docker.com/install/)
1817

19-
### AWS helpers
20-
21-
This repository imports shared AWS helpers from [prm-deductions-support-infra](https://github.com/nhsconnect/prm-deductions-support-infra/).
22-
They can be found `utils` directory after running any task from `tasks` file.
23-
2418
## Directories
2519

2620
| Directory | Description |
2721
| :---------------- |:--------------------------------------------------|
28-
| /test/docker | Contains smoke test for docker |
29-
| /test/functional | Contains tests against deployed service |
30-
| /gocd | Contains the GoCD pipeline files |
3122
| /src | The source code |
32-
| /terraform | Terraform to deploy app as a Fargate task in AWS |
23+
| /terraform | The relative terraform lives in the infra repo. |
3324
| /scripts | Useful scripts (e.g. for sending canary messages) |
34-
| /utils | Contains aws-helpers |
3525

3626
## Starting the app locally
3727

38-
*BEWARE be sure what you're doing here as `node_modules` can contain platform-specific files e.g. mac vs linux/amd64 not
39-
necessarily compatible*
40-
4128
1. Run `npm install` to install all node dependencies.
4229
2. Configure local environment variables:
4330
- run `./tasks setup_test_integration_local`

services/ehr-out-service/tasks

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,6 @@ GIT_REPO_NAME=prm-repo-ehr-out-service
1818
export OLD_SERVICE=repo-to-gp
1919
export NHS_SERVICE=ehr-out-service
2020

21-
AWS_HELPERS_VERSION=0.2.27
22-
echo "AWS helper scripts version: $AWS_HELPERS_VERSION"
23-
24-
###########################
25-
# Shared utils #
26-
###########################
27-
28-
function download_util() {
29-
local UTIL_VERSION=$1
30-
local UTIL_FILENAME=$2
31-
32-
local UTIL_FILEPATH="utils/$UTIL_VERSION/$UTIL_FILENAME"
33-
34-
mkdir -p "utils/$UTIL_VERSION"
35-
if [[ ! -f $UTIL_FILEPATH ]];then
36-
wget --quiet -O $UTIL_FILEPATH https://github.com/nhsconnect/prm-deductions-support-infra/releases/download/${UTIL_VERSION}/${UTIL_FILENAME}
37-
fi
38-
chmod +x $UTIL_FILEPATH
39-
40-
echo "$UTIL_FILEPATH"
41-
}
42-
43-
AWS_HELPERS_FILE=$(download_util $AWS_HELPERS_VERSION aws-helpers)
44-
source $AWS_HELPERS_FILE
4521

4622
####################################
4723
# Instance (Environment) Variables #
@@ -54,13 +30,6 @@ function check_env {
5430
fi
5531
}
5632

57-
function check_nhs_service {
58-
if [[ -z "${NHS_SERVICE}" ]]; then
59-
echo "Must set NHS_SERVICE"
60-
exit 1
61-
fi
62-
}
63-
6433
function configure_service_url {
6534
if [[ -z "${NHS_ENVIRONMENT}" ]]; then
6635
export SERVICE_URL=http://${NHS_SERVICE}:3000
@@ -124,33 +93,17 @@ function configure_local_envs_for_docker_test {
12493
set_image_tag
12594
}
12695

127-
function get_aws_account_id {
128-
AWS_ACCOUNT_ID=$(dojo -c Dojofile-infra "aws sts get-caller-identity | jq -r .Account")
129-
}
130-
13196
############################
13297
# Docker Related Functions #
13398
############################
13499

135-
function docker_login {
136-
echo Logging in to Amazon ECR...
137-
eval $(dojo -c Dojofile-infra "aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION")
138-
}
139100

140101
function configure_docker_repository_uri {
141102
docker_login
142103
get_aws_account_id
143104
export REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/$IMAGE_REPO_NAME
144105
}
145106

146-
function build_docker_image() {
147-
echo Build started on $(date)
148-
set_image_tag
149-
echo Building the Docker image...
150-
docker build --build-arg UTILS_VERSION=$AWS_HELPERS_VERSION -t $REPOSITORY_URI:latest -t $REPOSITORY_URI:$IMAGE_TAG .
151-
echo Build completed on `date`
152-
}
153-
154107
function kill_container {
155108
local filter=$1
156109
local moniker=$2
@@ -179,81 +132,6 @@ function run_localstack {
179132
function run_localstack_itest {
180133
docker-compose -f docker-compose-itest.yml up -d
181134
}
182-
#######################
183-
# Terraform Functions #
184-
#######################
185-
186-
export TF_BUCKET="prm-deductions-${NHS_ENVIRONMENT}-terraform-state"
187-
function tf_init_with_options {
188-
local state_key=$1
189-
local tf_options=$2
190-
191-
terraform init $tf_options \
192-
-backend-config key="${state_key}" \
193-
-backend-config bucket="${TF_BUCKET}" \
194-
-backend-config dynamodb_table="prm-deductions-${NHS_ENVIRONMENT}-terraform-table" \
195-
-backend-config region=${AWS_DEFAULT_REGION}
196-
}
197-
198-
function tf_init_or_rename {
199-
local state_key_suffix=$1
200-
201-
echo checking state file exists
202-
set +e
203-
aws s3 ls ${TF_BUCKET}/$NHS_SERVICE-${state_key_suffix}
204-
local state_file_exists=$?
205-
if [ $state_file_exists -ne 0 ]; then
206-
echo cannot find state file so assuming rename
207-
local RENAME_STATE=true
208-
else
209-
echo state file exists
210-
fi
211-
set -e
212-
213-
if [ -z "${RENAME_STATE}" ]; then
214-
tf_init_with_options $NHS_SERVICE-${state_key_suffix} -reconfigure
215-
else
216-
echo doing one-time renaming of state file
217-
if [ -z "${OLD_SERVICE}" ]; then
218-
echo OLD_SERVICE needs to be set if RENAME_STATE being used
219-
exit 88
220-
fi
221-
tf_init_with_options $OLD_SERVICE-${state_key_suffix} -reconfigure
222-
223-
tf_init_with_options $NHS_SERVICE-${state_key_suffix} '-migrate-state -force-copy'
224-
fi
225-
}
226-
227-
228-
function tf_init {
229-
check_env
230-
cd terraform
231-
232-
tf_init_or_rename ${NHS_ENVIRONMENT}/terraform.tfstate
233-
}
234-
235-
function tf_plan {
236-
operation=$1
237-
set_image_tag
238-
239-
tf_init
240-
terraform get # modules
241-
if [[ "${operation}" == "create" ]]; then
242-
terraform plan -var task_image_tag=$IMAGE_TAG -var-file=$NHS_ENVIRONMENT.tfvars -out="nhs_deployment.tfplan"
243-
elif [[ "${operation}" == "destroy" ]]; then
244-
terraform plan -var task_image_tag=$IMAGE_TAG -var-file=$NHS_ENVIRONMENT.tfvars -out="nhs_deployment.tfplan" -destroy
245-
else
246-
echo "Unknown operation (should be create or destroy), got: ${operation}"
247-
exit 1
248-
fi
249-
}
250-
251-
function tf_apply {
252-
tf_init
253-
terraform get # modules
254-
terraform apply nhs_deployment.tfplan
255-
terraform output -json > tf-out.json
256-
}
257135

258136
###########
259137
# Testing #
@@ -356,7 +234,7 @@ case "${command}" in
356234
;;
357235
run_docker_local)
358236
configure_local_envs
359-
dojo -c Dojofile-dtest
237+
run_docker_local
360238
;;
361239
tf_plan)
362240
check_env

0 commit comments

Comments
 (0)