Skip to content

Commit b61f0f6

Browse files
Merge branch 'develop' of github.com:NHSDigital/NRLF into NRL-1876-lloyd-george-perf-test-run
2 parents f566298 + b88c830 commit b61f0f6

File tree

9 files changed

+69
-42
lines changed

9 files changed

+69
-42
lines changed

.github/workflows/daily-build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,18 @@ jobs:
6767
with:
6868
key: ${{ github.run_id }}-nrlf-permissions
6969
path: dist/nrlf_permissions.zip
70+
71+
sbom:
72+
name: Generate SBOM - ${{ github.ref }}
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Git clone - ${{ github.ref }}
77+
uses: actions/checkout@v4
78+
with:
79+
ref: ${{ github.ref }}
80+
81+
- name: Generate SBOM
82+
uses: nhs-england-tools/trivy-action/[email protected]
83+
with:
84+
repo-path: "./"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ perftest-generate-pointer-table-extract:
356356
@echo "Generating pointer table extract with PERFTEST_TABLE_NAME=$(PERFTEST_TABLE_NAME) and ENV=$(ENV) and DIST_PATH=$(DIST_PATH)"
357357
rm -rf "${DIST_PATH}/nft"
358358
mkdir -p "${DIST_PATH}/nft"
359-
PYTHONPATH=. poetry run python tests/performance/perftest_environment.py generate_pointer_table_extract --output_dir="${DIST_PATH}/nft" --extract-size=1500000
359+
PYTHONPATH=. poetry run python tests/performance/perftest_environment.py generate_pointer_table_extract --output_dir="${DIST_PATH}/nft" --extract-size=2000000
360360
./scripts/get-current-info.sh > "${DIST_PATH}/nft/info.json"
361361
zip -r "${DIST_PATH}/pointer_extract-${PERFTEST_TABLE_NAME}.zip" "${DIST_PATH}/nft"
362362
aws s3 cp "${DIST_PATH}/pointer_extract-${PERFTEST_TABLE_NAME}.zip" "s3://nhsd-nrlf--${ENV}-metadata/performance/seed-pointers-extract-${PERFTEST_TABLE_NAME}.zip"

poetry.lock

Lines changed: 19 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/seed_nft_tables.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
class TestNhsNumbersIterator:
4242
def __iter__(self):
43-
self.first9 = 920000000
43+
self.first9 = 900000000
4444
return self
4545

4646
def __next__(self):
@@ -111,7 +111,6 @@ def pointer_is_processed(pointer):
111111
for unprocessed_item in unprocessed_items
112112
if unprocessed_item["PutRequest"]["Item"].get("id") == pointer_id
113113
]
114-
# print("unprocessed matches:", matches)
115114

116115
return len(matches) == 0
117116

@@ -154,7 +153,7 @@ def _populate_seed_table(
154153
print(
155154
f"Will upsert ~{doc_ref_target} test pointers for {patients_with_pointers} patients."
156155
)
157-
doc_ref_counter = 45000000
156+
doc_ref_counter = 0
158157
batch_counter = 0
159158
unprocessed_count = 0
160159

terraform/account-wide-infrastructure/test/dynamodb__pointers-table.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ module "ref-pointers-table" {
3232
}
3333

3434
module "perftest-pointers-table" {
35+
source = "../modules/pointers-table"
36+
name_prefix = "nhsd-nrlf--perftest"
37+
}
38+
39+
module "perftest-pointers-baseline-table" {
3540
source = "../modules/pointers-table"
3641
name_prefix = "nhsd-nrlf--perftest-baseline"
3742
}
43+
44+
module "perftest-pointers-15m-table" {
45+
source = "../modules/pointers-table"
46+
name_prefix = "nhsd-nrlf--perftest-15m"
47+
}
48+
49+
module "perftest-pointers-55m-table" {
50+
source = "../modules/pointers-table"
51+
name_prefix = "nhsd-nrlf--perftest-55m"
52+
}

terraform/bastion/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Before deploying a bastion, you will need:
88

99
- An AWS account that has already been bootstrapped, as described in [bootstrap/README.md](../bootstrap/README.md) and has the account-wide infrastructure deployed as described in [account-wide-infrastructure/README.md](../account-wide-infrastructure/README.md). This is a one-time account setup step.
1010
- Your CLI configured to allow authentication to your AWS account
11+
- Install the [Session Manager plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
1112

1213
## Deploying a bastion
1314

@@ -17,39 +18,40 @@ To deploy a bastion, you will first need to login to the AWS mgmt account on the
1718

1819
Then, initialise the Terraform workspace with:
1920

20-
```
21+
```sh
22+
assume nhsd-nrlf-mgmt
2123
terraform init
2224
```
2325

2426
If you want a read-only bastion (can only READ from the pointers table), plan the deployment like this:
2527

26-
```
28+
```sh
2729
make plan-ro
2830
```
2931

3032
If you want a read-write bastion (can READ and WRITE from the pointers table), plan the deployment like this:
3133

32-
```
34+
```sh
3335
make plan-rw
3436
```
3537

3638
Once you're happy with your planned changes, you can apply them with:
3739

38-
```
40+
```sh
3941
terraform apply ./bastion.tfplan
4042
```
4143

4244
## Using the bastion
4345

4446
Once the bastion is deployed, you can connect to it via SSH with:
4547

46-
```
47-
make ssh-connection ENV=perftest
48+
```sh
49+
make ssh-connection ENV={env}
4850
```
4951

5052
Once connected successfully, you will be at the SSM `$` prompt. To switch to the `nrlf_ops` user, run this command:
5153

52-
```
54+
```sh
5355
sudo su - nrlf_ops
5456
```
5557

@@ -68,7 +70,7 @@ see [user-data.sh](./scripts/user-data.sh) for exactly what's installed on there
6870

6971
If you're running the `make ssh-connection` and are seeing this error:
7072

71-
```
73+
```sh
7274
$ make ssh-connection
7375
....
7476
An error occurred (TargetNotConnected) when calling the StartSession operation: i-06ff25164f004bee4 is not connected.
@@ -78,21 +80,23 @@ $
7880

7981
If you've just created a new bastion, it may be that it hasn't started yet. Log in to the AWS console to see the state of the EC2 instance. Press the "Connect" button in the console and choose the SSM tab to see if things are working ok.
8082

83+
If there is a warning in the Session Manager tab "SSM Agent is not online" when you attempt to connect then it's likely the SSM agent has crashed. Reboot the EC2 instance and the SSM agent should start up with previous cli history preserved. To reboot via the CLI, find your EC2 instance > Instance state > Reboot instance. Beware: rebooting the EC2 instance will terminate any ongoing processes.
84+
8185
If the EC2 instance is running and the console looks ok, check you have defined the correct ENV param for the installed bastion.
8286

8387
#### The `nrlf_ops` using is missing
8488

8589
If you're getting this error:
8690

87-
```
91+
```sh
8892
$ sudo su - nrlf_ops
8993
su: user some_other does not exist or the user entry does not contain all the required fields
9094
$
9195
```
9296

9397
If you've just created a new bastion, you may need to wait a little until the cloud-init script has finished. You can check the status of this process with:
9498

95-
```
99+
```sh
96100
sudo tail -f /var/log/cloud-init-output.log
97101
```
98102

tests/performance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ make perftest-generate-pointer-table-extract \
135135
PERFTEST_TABLE_NAME=nhsd-nrlf--perftest-anjali-test-2-pointers-table ENV=perftest
136136
```
137137

138-
This will generate a csv extract of the given pointer table containing a row per pointer. To run the perf tests, you will need an extract larger than the number of test iterations. The default extract size is 1.5 million - this can be changed in the make file command by updating the value of`--extract-size`. Too big and the test runners will take a long time to load the file.
138+
This will generate a csv extract of the given pointer table containing a row per pointer. To run the perf tests, you will need an extract larger than the number of test iterations. The default extract size is 2 million - this can be changed in the make file command by updating the value of`--extract-size`. Too big and the test runners will take a long time to load the file.
139139

140140
## Assumptions / Caveats
141141

tests/performance/constants.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ export const POINTERS_TO_DELETE = ALL_POINTER_IDS.slice(0, 3500);
1515
export const POINTER_IDS = ALL_POINTER_IDS.slice(3500);
1616
export const NHS_NUMBERS = REFERENCE_DATA["nhs_numbers"];
1717

18-
// filter only 736253001, 736253002, 1363501000000100, 861421000000109, 749001000000101 for now
18+
// filter only 736253002, 1363501000000100, 861421000000109, 749001000000101 for now
1919
export const FILTERED_POINTER_TYPES = [
20-
// "736253001",
2120
"736253002",
2221
"1363501000000100",
2322
"861421000000109",

tests/performance/perftest_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __next__(self):
6666

6767

6868
def generate_pointer_table_extract(
69-
extract_size=1500000,
69+
extract_size=2000000, # must be a multiple of buffer_size (1 million)
7070
output_dir=".",
7171
):
7272
"""

0 commit comments

Comments
 (0)