Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCM-8032: Use terraform sandbox #140

Merged
merged 9 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .env.template

This file was deleted.

50 changes: 20 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,35 @@ Read more about the technical design at [REFCOM-2024-007: WebUI User Auth](https
npm install
```

### Setup .env
### Creating a backend sandbox

copy and rename `.env.template` to `.env`
To create a backend sandbox intended for use with local development, run the command

#### USER_POOL_ID (optional)
```shell
npm run create-backend-sandbox environment-name
```

1. Log into the `nhs-notify-iam-dev` AWS account
2. Load AWS Cognito
3. Open `nhs-notify-main-app` Cognito user pool
4. Grab `User pool ID` value
substituting your environment name in as appropriate.

#### USER_POOL_CLIENT_ID (optional)
This command will also generate an amplify_outputs file in the root of the repository that will be used when running the app locally.

1. Log into the `nhs-notify-iam-dev` AWS account
2. Load AWS Cognito
3. Open `nhs-notify-main-app` Cognito user pool
4. Load `App integration` tab
1. Found (at the bottom of the page)
5. Grab `Client ID` value

#### USE_LOCAL_AUTH
To destroy the sandbox when it is no longer needed, run the command

```bash
true/false
```shell
npm run destroy-backend-sandbox environment-name
```

When `true` a new Cognito instance will be created within the Amplify sandbox. You'll need to manually add users.
### Connecting to an existing Cognito instance

You can point the app at any existing Cognito instance, not necessarily one you have created, by updating the user_pool_id and user_pool_client_id values in the amplify_outputs file.

### Setup a user in Cognito

In order to use a new Cognito user pool, you will need to manually create a user in that user pool.
chris-elliott-nhsd marked this conversation as resolved.
Show resolved Hide resolved

1. Log into the `nhs-notify-iam-dev` AWS account
2. Load AWS Cognito
3. Open `nhs-notify-main-app` Cognito user pool
3. Open the relevant Cognito user pool
4. Select `Create user`
5. Enter details
1. Use your .nhs email address
Expand All @@ -82,17 +78,11 @@ When `true` a new Cognito instance will be created within the Amplify sandbox. Y

## Running project locally

1. To run an Amplify sandbox. To do this, authenticate with the AWS account `nhs-notify-iam-dev` then run:

```bash
npx ampx sandbox --profile <your AWS profile for nhs-notify-iam-dev account>
```
Having created your backend sandbox or otherwise set up your amplify_outputs file, you can start the app locally by running

2. Then in a separate terminal, run the app locally:

```bash
npm run dev
```
```bash
npm run dev
```

### Running WebAuth and Templates projects locally

Expand Down
20 changes: 20 additions & 0 deletions amplify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
backend:
phases:
build:
commands:
- npm ci --cache .npm --prefer-offline
- npm run generate-outputs env
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- .npm/**/*
- node_modules/**/*
20 changes: 0 additions & 20 deletions amplify/auth/resource.ts

This file was deleted.

9 changes: 0 additions & 9 deletions amplify/backend.ts

This file was deleted.

Loading
Loading