# ows-abacus-adjustment

## Getting Started

Create your python env and install dependencies:

```bash
make dev_env
```

### Setting Up Your Environment

Create a `.env` file from the existing `.env.shadow` file: `cp .env.shadow .env`.
This is where you can set your environment variables:

- `MYSQL_DB_HOST`: 127.0.0.1
- `MYSQL_DB_USER`: copied from [here](https://github.com/theorchard/ows-abacus-adjustment/blob/master/docker-compose.yml#L10)
- `MYSQL_DB_PASS`: copied from [here](https://github.com/theorchard/ows-abacus-adjustment/blob/master/docker-compose.yml#L11)
- `MYSQL_DB_NAME`: copied from [here](https://github.com/theorchard/ows-abacus-adjustment/blob/master/docker-compose.yml#L9)
- `MYSQL_DB_PORT`: 6450
- `MYSQL_TEST_DB_NAME`: add `_test` to the end of the DB Name

### Local Database

To develop using a local database:

```bash
make start_db
```

> Using docker-compose:
>
> Start the database
>
> ```bash
> docker-compose up -d abacus-adjustment-mysql
> ```
>
> Run the MySQL migrations
>
> ```bash
> docker-compose up abacus-adjustment-liquidbase-runner
> ```

### Testing

To run the tests, all you have to do is to run:

```bash
make test
```

To run integration tests:

```bash
make test_integration
```

To lint:

```bash
make lint
```

## Dependency Management

### Some of the libraries we're using

- [`flask-sqlalchemy`](https://flask-sqlalchemy.palletsprojects.com/en/2.x/) for integrating with our ORM framework, [SQLAlchemy](https://www.sqlalchemy.org/).
- [`flask-marshmallow`](https://flask-marshmallow.readthedocs.io/en/latest/) for integrating with [Marshmallow](https://marshmallow.readthedocs.io/en/3.0/),
our object serialization/deserialization tool.

### Adding new packages

- For dev packages, add them normally to `requirements-dev.txt`
- Add the new top level package name and optional version to `requirements-to-freeze.txt`
- Run `make pip_lock_versions`

### Upgrading packages

Regularly running `make pip_lock_versions` will update and freeze all non-dev dependencies in `requirements.txt`

### Notes

Windows users will not be able to use the `make` commands as Make is a Unix util.
Windows users can attempt to install [GNUWin](http://gnuwin32.sourceforge.net/packages/make.htm) to get this functionality.

## Features of the Boilerplate

### Linting

This boilerplate comes with customization on flake8 plugins. Please make sure you keep any derivative flask microservices in-sync with these standards, as they are added.

### Third-Party Integrations for Reporting

This boilerplate comes with support for Loggly, Sentry, and Datadog.
