Skip to content

Commit d108af5

Browse files
TASK SB Improve fake API readme.
1 parent 162cf48 commit d108af5

File tree

1 file changed

+20
-20
lines changed
  • infrastructure/environments/test/fake-api

1 file changed

+20
-20
lines changed

infrastructure/environments/test/fake-api/readme.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,38 @@ Tag, promote, and deploy to the test environment, as per the [usual process](htt
1010

1111
### Build & test image
1212

13-
#### Test locally
13+
#### buildx
1414

15-
```sh
16-
docker stop local-fake-api ## Will fail if the contain doesn't exist, which is fine
17-
18-
./create_tokens.sh "../../../../../../../vita_private_key.pem" "http://localhost:9123" 86400
19-
```
15+
Before you start, set up [buildx](https://docs.docker.com/reference/cli/docker/buildx/) for Docker if you haven't already:
2016

21-
Before you continue, set up buildx for Docker if you haven't done it yet:
2217
```sh
2318
brew install docker-buildx
24-
````
25-
Run the above command and follow the instructions in the output to update ~/.docker/config.json.
26-
27-
```sh
28-
colima stop && colima start
29-
docker buildx version
3019
```
3120

32-
After this, you can build the image and spin up the docker image, and test that it works:
21+
Run the above command and follow the instructions in the output to update `~/.docker/config.json`.
22+
23+
#### Build image & test locally
24+
25+
The first argument to the `create_tokens` script below is the [VitA application private key](https://github.com/NHSDigital/vaccinations-app#simulating-nhs-login-sso-flow), i.e. the file you are using to populate your `NHS_LOGIN_PRIVATE_KEY` variable.
26+
3327
```sh
28+
./create_tokens.sh "../../../../../vita-app-sandpit.pid" "http://localhost:9123" 86400
29+
30+
docker stop local-fake-api ## Will fail if the contain doesn't exist, which is fine
31+
3432
docker build --no-cache -t fake-api . && docker run -d --rm -p 9123:9123 -e ELID_DELAY_SECONDS=1 -e APIM_DELAY_SECONDS=1 --name local-fake-api fake-api
3533

3634
docker logs local-fake-api --follow | less +F # If you need to see what's going on in nginx
3735

36+
# Check it's running
3837
curl -v http://localhost:9123/health
3938

40-
curl http://localhost:9123/eligibility-signposting-api/patient-check/9658218989 | jq
41-
curl http://localhost:9123/eligibility-signposting-api/patient-check/9658218881 | jq
39+
curl http://localhost:9123/eligibility-signposting-api/patient-check/9658218989 | jq .
40+
curl http://localhost:9123/eligibility-signposting-api/patient-check/9658218881 | jq .
4241

4342
curl -v -X POST http://localhost:9123/oauth2/token
4443

45-
curl http://localhost:9123/.well-known/openid-configuration | jq
44+
curl http://localhost:9123/.well-known/openid-configuration | jq .
4645
curl -v http://localhost:9123/authorize?state=sausages
4746
curl -X POST http://localhost:9123/token
4847

@@ -103,12 +102,12 @@ fake_api_url="http://"$(aws elbv2 describe-load-balancers --profile vita-test |
103102

104103
curl -v $fake_api_url/health
105104

106-
curl $fake_api_url/eligibility-signposting-api/patient-check/9658218989 | jq
107-
curl $fake_api_url/eligibility-signposting-api/patient-check/9658218881 | jq
105+
curl $fake_api_url/eligibility-signposting-api/patient-check/9658218989 | jq .
106+
curl $fake_api_url/eligibility-signposting-api/patient-check/9658218881 | jq .
108107

109108
curl -v -X POST $fake_api_url/oauth2/token
110109

111-
curl $fake_api_url/.well-known/openid-configuration | jq
110+
curl $fake_api_url/.well-known/openid-configuration | jq .
112111
curl -v "$fake_api_url/authorize?state=sausages"
113112
curl -X POST $fake_api_url/token
114113

@@ -142,6 +141,7 @@ docker push $(terraform output -raw fake_api_ecr_repository_url):latest
142141

143142
aws ecs update-service --cluster fake-api-ecs-cluster --service fake-api-ecs-service --force-new-deployment --profile vita-dev --region eu-west-2
144143

144+
# Check it's working
145145
curl -v $(terraform output -raw application_url)/health
146146
curl -v $(terraform output -raw application_url)/eligibility-signposting-api/patient-check/9658218989
147147
curl -v -X POST $(terraform output -raw application_url)/oauth2/token

0 commit comments

Comments
 (0)