|
| 1 | +# Experimental: Local setup for both templates-ui and iam-auth applications |
| 2 | + |
| 3 | +This has only been tried on a mac. |
| 4 | + |
| 5 | +If this local setup proves useful for others it would be great to move this `/local` directory to it's own GitHub repository. |
| 6 | + |
| 7 | +## Description |
| 8 | + |
| 9 | +A docker-compose setup to run multiple web applications locally and served to the same domain: `localhost`. |
| 10 | + |
| 11 | +Two web applications have been configured `nhs-notify-web-templates-management` and `nhs-notify-iam-webauth` are both served through `ngix` which acts as a gateway. |
| 12 | + |
| 13 | +- `nhs-notify-web-templates-management` is served to `http://localhost/templates` |
| 14 | +- `nhs-notify-iam-webauth` is served to `http://localhost/auth` |
| 15 | + |
| 16 | +The `docker-compose` file is hooked up to local volume of the projects so any changes you make in your webapps will be ported across, you will need to refresh the web page to see the changes. |
| 17 | + |
| 18 | +### Additional information |
| 19 | + |
| 20 | +At first the application may take a few seconds to warm up. After the app has warmed up it's usually just as fast as running the application natively. |
| 21 | + |
| 22 | +If you install a new `npm` package in either web application then you'll need to rebuild the docker images. |
| 23 | + |
| 24 | +## Requirements |
| 25 | + |
| 26 | +- local version of `nhs-notify-iam-webauth` project |
| 27 | +- docker-compose |
| 28 | +- If you're on windows you'll need to configure docker to work through WSL2 [here is a guide that might help](https://docs.docker.com/desktop/features/wsl/) |
| 29 | + |
| 30 | +## Setup |
| 31 | + |
| 32 | +### Setup Amplify sandboxes |
| 33 | + |
| 34 | +Setup the Amplify sandboxes in a new terminal as explained in each web-apps [README.md](../README.md#running-the-project-locally) |
| 35 | + |
| 36 | +### Configure project paths |
| 37 | + |
| 38 | +You'll need to set the directory path location for each web application in the `.env` file or as environment variables. |
| 39 | + |
| 40 | +For example: |
| 41 | + |
| 42 | +```bash |
| 43 | +TEMPLATE_MANAGEMENT_DIR='~/projects/nhs-notify-web-template-management' |
| 44 | +IAM_WEBAUTH_DIR='~/projects/nhs-notify-iam-webauth' |
| 45 | +``` |
| 46 | + |
| 47 | +If you're using the `.env` file you might need to run `direnv allow`. |
| 48 | + |
| 49 | +### Run |
| 50 | + |
| 51 | +in the `/local/` directory run: |
| 52 | + |
| 53 | +```bash |
| 54 | +docker-compose up |
| 55 | +``` |
| 56 | + |
| 57 | +First time running this it might take some time as `docker` downloads the base images and configures itself. After subsequent uses it will be much faster to start and stop. |
0 commit comments