You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-76Lines changed: 38 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,97 +2,52 @@
2
2
3
3
A Flask-based web application for the commissioner reporting component of Mavis.
4
4
5
-
## Prerequisites
6
-
7
-
- Mise
8
-
- Make
9
-
10
5
## Installation
11
6
12
-
1.**Install Mise**
13
-
14
-
Please see the main Mavis repository for [how to install mise](https://github.com/nhsuk/manage-vaccinations-in-schools?tab=readme-ov-file#mise).
15
-
16
-
Once mise is installed, run the following command to install the project dependencies:
17
-
18
-
```bash
19
-
mise install
20
-
```
21
-
22
-
2.**Install project dependencies**
23
-
24
-
This will install the project dependencies using uv and NPM.
25
-
26
-
Note that the uv virtual environment will be created in the `.venv` directory to allow IDEs to use the correct Python interpreter.
27
-
28
-
```bash
29
-
make install
30
-
```
31
-
32
-
3.**Create an environment file**
33
-
34
-
Create a `.env` file in the root of the project following the example provided in `.env.example`.
35
-
36
-
4.**Run the application in development mode**
37
-
38
-
```bash
39
-
make dev
40
-
```
41
-
42
-
The application will be available at <http://localhost:5001>.
43
-
You will need a version of Mavis running which supports the OAuth 2.0 token authentication method - please see [Runtime Dependencies](#runtime-dependencies) below for details.
44
-
45
-
## Linting
7
+
Please see the main Mavis repository for [how to install
We use Ruff to lint the code. To run the linter, run the following command:
48
-
49
-
```bash
50
-
make lint
10
+
```sh
11
+
mise install # Install dev tools
12
+
cp mise.local.toml.example mise.local.toml # Fill in shared secrets
13
+
mise dev # Run dev server
14
+
mise ci # Run CI tests
51
15
```
52
16
53
-
To run the linter with autofix, run the following command:
54
-
55
-
```bash
56
-
make lint-fix
57
-
```
58
-
59
-
To configure VSCode or variants thereof to use Ruff in your IDE, install the Ruff extension and it should be used automatically.
60
-
61
-
## Building & Running a Docker container
17
+
The application will be available at <http://localhost:4001>.
62
18
63
-
The application can be built and run via Docker, to support deployment to AWS.
64
-
By default, the docker container listens on port 5000, but as Mac OS typically has an existing system application (Control Center) listening on port 5000, we use Docker's port mapping to map port 5001 on the host (your laptop) to 5000 on the container.
19
+
You will need a version of Mavis running which supports the OAuth 2.0 token
20
+
authentication method - please see [Runtime Dependencies](#runtime-dependencies)
21
+
below for details.
65
22
66
-
### Build
23
+
##Other tasks
67
24
68
-
`make build-docker`
69
-
70
-
This will build a container image tagged with `mavis/reporting:latest`, which will listen on port 5000. To use a different tag, supply the `DOCKER_IMAGE` environment variable (e.g. `DOCKER_IMAGE=reporting-component:spike-11 make build-docker`)
71
-
72
-
Note that it will not push the image to any repository - you must do that manually if you want to.
73
-
74
-
### Run
75
-
76
-
`make run-docker`
25
+
```sh
26
+
mise tasks # See all available tasks
27
+
mise env # See all available environment variables
28
+
```
77
29
78
-
This will run the container image tagged with `mavis/reporting:latest` and listen on the host port 5000.
79
-
To use a different tag, supply the `DOCKER_IMAGE` environment variable .
80
-
To map a different host port (for instance if you have something else running on port 5000) supply the `HOST_PORT` environment variable
30
+
### Docker
81
31
82
-
Example:
32
+
To build and run the app in a Docker container, mimicking the production
33
+
environment:
83
34
84
-
`DOCKER_IMAGE=reporting-component:spike-11 HOST_PORT=5001 make run-docker` will run the container image tagged with `reporting-component:spike-11` and map port 5001 on the host to port 5000 on the container.
35
+
```sh
36
+
mise docker
37
+
```
85
38
86
-
You could then access the running app with <http://localhost:5001> on your browser.
39
+
Different environment variables can be overwritten in `mise.local.toml`.
87
40
88
41
### Gunicorn arguments
89
42
90
-
Additional parameters to the `gunicorn` executable (for instance, the number of workers) can be passed through with the `GUNICORN_CMD_ARGS` environment variable.
43
+
Additional parameters to the `gunicorn` executable (for instance, the number of
44
+
workers) can be passed through with the `GUNICORN_CMD_ARGS` environment
This application authenticates with the main Mavis application using the [OAuth 2.0 Authorization Code flow](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1).
64
+
This application authenticates with the main Mavis application using the [OAuth
1. A copy of the main Mavis app must be running and available at the URL given in the `MAVIS_ROOT_URL` env var
70
+
1. A copy of the main Mavis app must be running and available at the URL given
71
+
in the `MAVIS_ROOT_URL` env var
114
72
2. That copy of Mavis must:
115
73
- have the `reporting_api` feature flag enabled
116
-
- have a value for `Settings.reporting_api.client_app.client_id` (..which can also be set via the `MAVIS__REPORTING_API__CLIENT_APP__CLIENT_ID` environment variable) which matches this application's `CLIENT_ID` value
117
-
- have a value for `Settings.reporting_api.client_app.secret` (..which can also be set via the `MAVIS__REPORTING_API__CLIENT_APP__SECRET` environment variable) which matches this application's `CLIENT_SECRET` value
74
+
- have a value for `Settings.reporting_api.client_app.client_id` (..which can
75
+
also be set via the `MAVIS__REPORTING_API__CLIENT_APP__CLIENT_ID`
76
+
environment variable) which matches this application's `CLIENT_ID` value
77
+
- have a value for `Settings.reporting_api.client_app.secret` (..which can
78
+
also be set via the `MAVIS__REPORTING_API__CLIENT_APP__SECRET` environment
79
+
variable) which matches this application's `CLIENT_SECRET` value
0 commit comments