# Abacus Fullstack Environment

This is a Makefile/Docker project that provides a single command to clone, setup, and run the frontend and backend services that comprise the Abacus Fullstack. The dockerized environment facilitates the dev/debug/testing of fullstack features in Abacus such as adding new inputs, fields, GQL queries, and features that require frontend and backend changes, database/graphql PRs that might affect the frontend, etc.

The following subset of Abacus services are currently supported:

| Project | Description |
| ------- | ----------- |
| frontend-royalties | Abacus App - [Prod](https://abacus.theorchard.com) \| [QA](https://abacus.qaorch.com/) |
| graphql-router | Provides identity resources on top of routing and federation to specialized subgraphs. [Apollo Studio](https://qa-graphql-router.theorchard.io/graphql) |
| graphql-abacus | A specialized subgraph for Abacus. Abstracts over several OWS microservices. [Apollo Studio](https://qa-graphql-abacus.theorchard.io/graphql) |
| ows-abacus-account | Microservice for data model abstraction over Account related tables |
| ows-abacus-contract | Microservice for data model abstraction over Contract related tables |
| mysql + liquibase | The royalty_accounting database running from image directly |

## Requirements
1. [Abacus Onboarding](https://www.notion.so/ABACUS-Onboarding-System-Inventory-dd8b5d0996d840609c7c4af6f84c55d2)
1. `awsume` AWS MFA setup - [Notion doc](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f?#390fbb7939a646749331fe5218d68379)
1. `GITHUB_NPM_TOKEN` env var setup - [Notion doc](https://www.notion.so/JavaScript-Package-Setup-9553d5d491c94835aa787fdf0fc4838d)
1. [Docker](https://www.docker.com/products/docker-desktop)
1. Connected to VPN

Note: the install also assumes you have your Github ssh key setup. Otherwise change all the repo URLs in the [Makefile](Makefile#L32-L51) to use https.

## Setup
Copy this project to the same directory as any existing Abacus repos you may already have.

```shell
make build
```
That will authenticate to our AWS account (assuming you have `awsume prod` setup) and build a Docker container with the frontend available at `http://localhost:8080`. The liquibase runner migrates the database on start up and a seeder service runs the sql files in `./seeds` against the running mysql service to give it some data.

If you stop the containers you can bring them back up with:

```shell
make
```

## Power On Self Test
```shell
zsh test-connectivity.sh
```
Should see all "good". If not, try restarting the failed services.

The database is also running on `https://localhost:6051` and can be queried via your preferred SQL tools.

## Migrate DB Manually
If you had to restart the database service, you'll have to re-run migrations and seed the data:
```shell
make seed_db
```
