Skip to content

Commit b02e73a

Browse files
Merge pull request #953 from NHSDigital/feature/made14-NRL-1386-update-readme
NRL-1386 Update README with instructions for reporting infra
2 parents bdc0a14 + 1ef119d commit b02e73a

File tree

2 files changed

+65
-223
lines changed

2 files changed

+65
-223
lines changed

README.md

Lines changed: 28 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -8,255 +8,67 @@ This project uses the `Makefile` to build, test and deploy. This will ensure tha
88

99
## Table of Contents
1010

11-
- [Setup](#setup)
11+
- [Before You Begin](#before-you-begin)
1212
- [Getting Started](#getting-started)
1313
- [Deploying](#deploying)
1414
- [Feature Tests](#feature-tests)
1515
- [OAuth Tokens for API request](#oauth-tokens-for-api-requests)
1616
- [Route53 & Hosted Zones](#route53--hosted-zones)
1717
- [Sandbox](#sandbox)
1818
- [Releases](#releases)
19+
- [Reports](#reports)
1920

20-
## Setup
21+
## Before You Begin
2122

22-
Before you tackle this guide, there are some more instructions here on the [Developer onboarding guide](https://nhsd-confluence.digital.nhs.uk/pages/viewpage.action?spaceKey=CLP&title=NRLF+-+Developer+Onboarding) in confluence
23+
Before you start using this repository, you will need to:
2324

24-
### 1. Prerequisites
25+
- Follow the instructions on the [Developer Onboarding Guide](https://nhsd-confluence.digital.nhs.uk/pages/viewpage.action?spaceKey=CLP&title=NRLF+-+Developer+Onboarding) in confluence
26+
- Install `asdf` using https://asdf-vm.com/guide/getting-started.html
2527

26-
#### 1. ASDF Tool Manager
28+
Confirm `asdf` is installed and is working with:
2729

28-
For an easy way to make sure your local system matches the requirements needed you can use `asdf tool manager`. This tool fetches the required versions of the libraries needed and sets the directory to use that version instead of your system's default version. To get it up and running,
29-
30-
- Install `asdf` using the instructions given here. https://asdf-vm.com/guide/getting-started.html. You can check it installed properly by using the command `asdf --version`
31-
- Install the dependencies using: `$ make asdf-install`
32-
- You should be good to go.
33-
34-
#### 2. If you prefer to get your local machine running manually the requirements are...
35-
36-
- [poetry](https://python-poetry.org/docs/) (this repository uses poetry ^1.5.1)
37-
- [pyenv](https://github.com/pyenv/pyenv) (this repository uses python ^3.9.15)
38-
- jq
39-
- terraform
40-
- [tfenv](https://github.com/tfutils/tfenv)
41-
- coreutils
42-
43-
Swagger generation requirements.
44-
45-
- curl
46-
- java runtime environment (jre) - https://www.oracle.com/java/technologies/downloads/#jdk19-mac
47-
- yq v4
48-
49-
### 2. WSL and PowerShell installation
50-
51-
If you are using Linux machine, please skip this section and go to [Linux set up](#3-linux-set-up)
52-
53-
This section will provide guidance on how to install the latest version of PowerShell and set up the Windows Subsystem for Linux (WSL) on your Windows machine.
54-
55-
PowerShell is a powerful command-line shell and scripting language, while WSL allows you to run a Linux distribution alongside your Windows installation.
56-
57-
If you wish to use the official guidance, links are below:
58-
59-
- PowerShell - https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.3
60-
- WSL - https://learn.microsoft.com/en-us/windows/wsl/install
61-
62-
#### Step 1: Install PowerShell
63-
64-
1. Open a web browser and go to the official PowerShell GitHub releases page: https://github.com/PowerShell/PowerShell/releases.
65-
66-
2. Scroll down to the "Assets" section and find the latest stable release for your system architecture (usually x64 for 64-bit systems). Download the installer package with the "msi" extension.
67-
68-
3. Run the downloaded MSI installer file.
69-
70-
4. Follow the on-screen instructions to install PowerShell. Make sure to select the "Add to PATH" option during installation so that you can easily access PowerShell from the command line.
71-
72-
5. Once the installation is complete, open a new Command Prompt or PowerShell window to verify that PowerShell is installed. You can do this by typing `powershell` and pressing Enter.
73-
74-
#### Step 2: Install Windows Subsystem for Linux (WSL)
75-
76-
1. Open PowerShell as an administrator. To do this, search for "PowerShell" in the Windows Start menu, right-click on "Windows PowerShell," and select "Run as administrator."
77-
78-
2. Run the following command to enable the WSL feature:
79-
```shell
80-
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
81-
```
82-
3. After the feature is enabled, restart your computer by running:
83-
```shell
84-
Restart-Computer
85-
```
86-
4. After your computer restarts, open PowerShell as an administrator again and run the following command to download and install a Linux distribution of your choice (e.g., Ubuntu):
87-
```shell
88-
wsl --install
89-
```
90-
5. During the installation process, you will be prompted to create a user and set a password for your Linux distribution.
91-
92-
6. Once the installation is complete, you can launch your installed Linux distribution by running:
93-
94-
```shell
95-
wsl
96-
```
97-
98-
To run a specific wsl distribution from within PowerShell or Windows Command Prompt without changing your default distribution:
99-
100-
use the command: `wsl -d <DistributionName>` , replacing `<DistributionName>` with the name of the distribution you want to use.
101-
102-
#### Step 3: Verify Your Installation
103-
104-
1. To verify that PowerShell and WSL are correctly installed, open a new PowerShell window (WSL not running) and run the following commands:
105-
106-
Check PowerShell version
107-
108-
```shell
109-
$PSVersionTable.PSVersion
110-
```
111-
112-
Check WSL distribution list
113-
114-
```shell
115-
wsl --list
116-
```
117-
118-
These commands should display the PowerShell version and list the installed WSL distributions.
119-
120-
### 3. Manually setting up Linux
121-
122-
If you're on Linux/WSL and using ASDF, you can skip these steps.
123-
124-
For those on a linux/WSL setup these are some helpful instructions:
125-
126-
- We recommend that you use the NRLF with VSCode and WSL rather than the Spine VM
127-
- There is also a plugin for VSCode called `WSL` which will help you avoid some terminal issues when opening projects in WSL
128-
129-
#### 1. Java:
130-
131-
```shell
132-
sudo apt install default-jre
13330
```
134-
135-
#### 2. Poetry:
136-
137-
```shell
138-
curl -sSL https://install.python-poetry.org | python3
139-
```
140-
141-
```shell
142-
nano ~/.bashrc
143-
```
144-
145-
add to bashrc - spineVM home dir is "/home/spineii-user/"
146-
147-
```shell
148-
export PATH="/$HOME/.local/bin:$PATH"
31+
asdf --version
14932
```
15033

151-
```shell
152-
source ~/.bashrc
153-
```
34+
Then install all the dependency packages with:
15435

155-
```shell
156-
poetry --version
15736
```
158-
159-
#### 3. pyenv:
160-
161-
```shell
162-
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
163-
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
164-
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
165-
```
166-
167-
```shell
168-
curl https://pyenv.run | bash
169-
```
170-
171-
```shell
172-
nano ~/.bashrc
173-
```
174-
175-
add to bashrc
176-
177-
```shell
178-
export PATH="$HOME/.pyenv/bin:$PATH"
179-
eval "$(pyenv init --path)"
180-
eval "$(pyenv virtualenv-init -)"
181-
```
182-
183-
```shell
184-
source ~/.bashrc
185-
```
186-
187-
```shell
188-
pyenv --version
189-
```
190-
191-
#### 4. terraform
192-
193-
```shell
194-
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
195-
```
196-
197-
```shell
198-
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
199-
```
200-
201-
```shell
202-
sudo apt update && sudo apt install terraform
203-
```
204-
205-
#### 5. yq:
206-
207-
```shell
208-
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +rx /usr/bin/yq
209-
```
210-
211-
### 4. Install python dependencies
212-
213-
At the root of the repo, run:
214-
215-
```shell
216-
poetry install
217-
poetry shell
21837
make configure
21938
```
22039

221-
NOTE
222-
223-
- You will know if you are correctly in the shell when you see the following before your command line prompt `(nrlf-api-py3.11)` (the version may change based on the version of python)
224-
- If it says (.venv) then you are not using the correct virtual environment
225-
- As mentioned above you at least need Python 3.9 installed globally to run the project, Poetry will handle the rest
226-
- The terraform version can be found in the .terraform-version file at the root
227-
22840
## Getting Started
22941

23042
To build packages:
23143

23244
```
233-
$ make
45+
make
23446
```
23547

23648
To run the linters over your changes:
23749

23850
```
239-
$ make lint
51+
make lint
24052
```
24153

24254
To run the unit tests:
24355

24456
```
245-
$ make test
57+
make test
24658
```
24759

24860
To run the local feature tests:
24961

25062
```
251-
$ make test-features
63+
make test-features
25264
```
25365

25466
### Troubleshooting
25567

25668
To check your environment:
25769

25870
```
259-
$ make check
71+
make check
26072
```
26173

26274
this will provide a report of the dependencies in your environment and should highlight the things that are not configured correctly or things that are missing.
@@ -268,34 +80,34 @@ For the integration tests, you need to have deployed your infrastructure (using
26880
To run integration tests:
26981

27082
```
271-
$ make test-integration
83+
make test-integration
27284
```
27385

27486
To run the Firehose integration tests:
27587

27688
```
277-
$ make test-firehose-integration
89+
make test-firehose-integration
27890
```
27991

28092
To run all the feature integration tests:
28193

28294
```
283-
$ make test-features-integration
95+
make test-features-integration
28496
```
28597

28698
To run indivudal feature test scenario(s) using the custom tag :
28799

288-
1. Add "@custom_tag" before each 'Scenario' that needs to be run (in each .feature file)
100+
1. Add `@custom_tag` before each 'Scenario' that needs to be run (in each .feature file)
289101
2. Run the command below:
290102

291103
```
292-
$ make integration-test-with-custom_tag
104+
make integration-test-with-custom_tag
293105
```
294106

295107
To run all the feature integration tests and generate an interactive Allure report therafter :
296108

297109
```
298-
$ make test-features-integration-report
110+
make test-features-integration-report
299111
```
300112

301113
### Smoke testing
@@ -305,19 +117,19 @@ For smoke tests, you need to have deployed your infrastructure (using Terraform)
305117
Before the first run of the smoke tests, you need to set the required permissions in your deployment. You can do this by running:
306118

307119
```
308-
$ make set-smoketest-perms
120+
make set-smoketest-perms
309121
```
310122

311123
To run the internal smoke tests against your stack, do this:
312124

313125
```
314-
$ make test-smoke-internal
126+
make test-smoke-internal
315127
```
316128

317129
To run the smoke tests against the public access endpoints (via APIGEE proxies), do this:
318130

319131
```
320-
$ make test-smoke-public
132+
make test-smoke-public
321133
```
322134

323135
## API Documentation
@@ -391,7 +203,7 @@ Clients must provide OAuth access tokens when making requests to the NRLF APIs.
391203
To create an access token for the dev environment, you can do the following:
392204

393205
```
394-
$ make get-access-token
206+
make get-access-token
395207
```
396208

397209
To create an access token for another environment:
@@ -494,14 +306,14 @@ The process to create a new release is as follows:
494306
4. Press "Generate release notes" button. This will populate the description with everything that's changed since the last release.
495307
5. Enter the version of the release into the Release Title field, say `v3.0.1`
496308
6. Arrange and update the description to accuruately represent the highlights of the release.
497-
7. Make sure the "Set as the latest release" checkbox it set
309+
7. Make sure the "Set as a pre-release" checkbox it set
498310
8. Press the "Publish release" button to complete the release process
499311

500-
Once your new release has been created, you can then deploy this release through the NRLF environments using the "Persistent Environment Deploy" Github Action.
312+
Once your new release has been created, you can then deploy this release through the NRLF environments using the "Persistent Environment Deploy" Github Action. Once your release has been deployed to prod, edit the release and set the "Set as the latest release" checkbox.
501313

502-
If the Consumer API has changed, or the documentation for that API has changed, you will also need to release (NRL Consumer API)[https://github.com/NHSDigital/nrl-consumer-api].
314+
If the Consumer API has changed, or the documentation for that API has changed, you will also need to release [NRL Consumer API](https://github.com/NHSDigital/nrl-consumer-api).
503315

504-
If the Producer API has changed, or the documentation for that API has changed, you will also need to release (NRL Producer API)[https://github.com/NHSDigital/nrl-producer-api].
316+
If the Producer API has changed, or the documentation for that API has changed, you will also need to release [NRL Producer API](https://github.com/NHSDigital/nrl-producer-api).
505317

506318
### Deploying releases
507319

0 commit comments

Comments
 (0)