# ows-carveouts-python

## Getting Started

### Configuration

Copy .env.shadow to .env and add the appropriate environment variables for your environment.

`cp .env.shadow .env`

Set the configurations. Note that the following are the minimum required environment variables to run this application locally.

```bash
Environment=[dev,test,qa]
```

### Running Locally

Run service inside a dev container. Before spinning up the container, you first need to:

1. Ensure you have [ECR access](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f#7a6624c58c6642abaecd804e5f25c820) set up.
2. Enable AWS access to the dev or prod account with [awsume](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f#beaec95488ad4473899a26a2b8cf603f).

Then, spin up the dev container:

```bash
$ docker compose up --build --remove-orphans dev
```

This will spin up a dev container, install/copy all required dependencies and app code inside the dev container, and start the application.

You can access the application at:

```
localhost:{{PORT}}
```

Sanity check that the container is up and running by hitting the healthcheck endpoint:

```
localhost:{{PORT}}/{{healthcheck-endpoint}}
```

Test away!

__⚠️ Note:__ Ensure you are on the VPN.

When you are done testing out your _amazing_ code, make sure to stop any running containers:

```bash
docker compose down --remove-orphans
```

### Testing

To run tests within a Docker container, you first must ensure steps 1 and 2 from `1️⃣ Option 1` in `Running Locally` are complete, and ensure you are on the VPN.

To run unit tests and linting, run:

```bash
docker compose run --build --rm unit-lint
```

Once you are finished unit testing, you can stop the test container with:

```bash
docker compose down --remove-orphans
```

### Integration Testing

To run integration tests inside a container, run:

```bash
docker compose run --build --rm integration
```

You can stop the integration test container by running:

```bash
docker compose down --remove-orphans
```

### Format Code

To format code to conform to styleguide, run:

```bash
docker compose run --build --rm format
```

### Update lockfile

To update the lockfile, run:

```bash
docker compose run --build -rm update-lockfile
```

### Clean up
You can clean up the containers by running:

```bash
docker compose down --remove-orphans
```

