Welcome to the Avanti Fellows Reporting Engine!
Make sure Python 3.9+ is installed in your system
- Install pre-commit hooks in the repo
pip install pre-commit
pre-commit install
- Get everything running with:
docker-compose up --build
- [ONLY FIRST TIME] Create an external docker volume to enable DynamoDB data to persist between sessions
docker volume create --name=dynamodb_data
- [ONLY FIRST TIME] Go into the shell of the
app
container and run:
python generate_table
This will create the the student_quiz_reports
table.
DynamoDB Admin: localhost:8001
Reporting FastAPI Server: localhost:5050 (docs and API tryout at localhost:5050/docs)
DynamoDB server: localhost:8000 (we won't access this directly)
- Install pre-commit hooks in the repo
pip install pre-commit
pre-commit install
- Create a
.env.local
file using.env.example
.
cp .env.example .env.local
-
Obtain credentials to replace local keys in the newly created
.env.local
file from repository owners. -
Run the following to get app at
localhost:5050/docs
cd app; uvicorn main:app --port 5050 --reload
We deploy our FastAPI instance on AWS Lambda which is triggered via an API Gateway. In order to automate the process, we use AWS SAM, which creates the stack required for deployment and updates it as needed with just a couple of commands and without having to do anything manually on the AWS GUI. Refer to this blog post for more details.
The actual deployment happens through Github Actions. Look at .github/workflows/deploy_to_staging.yml
to understand the deployment to Staging and .github/workflows/deploy_to_prod.yml
for Production.
The details of the AWS Lambda instances are described in templates/prod.yaml
and templates/staging.yaml
.