This is a service which is able to store and query heart rate data for different categories of users (operating on randomly generated fixtures at this point).
Table of Contents
Please make sure that you are using Python 3.12+ for virtualenv and running the application (refer to the version used in Dockerfile
).
- Install dependencies:
# It is advised to create a virtualenv first
$ virtualenv -p python3.12 ./.venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
- Provide a .env configuration & modify values if needed:
# Use .env.local to use DB available on `localhost`
$ cp .env.localhost .env
$ . ./.env
- Provide Postgres (skip if already running on the host):
$ docker compose up db -d
- Run the application:
$ fastapi prod main.py --port $APP_PORT
- Provide a .env configuration & modify values if needed:
$ cp .env.compose .env
$ . ./.env
- Build the Docker image and start Compose services in detached mode:
$ docker compose up --build -d
- Observe logs with:
$ docker compose logs app -f
Explore the API in a browser (APP_PORT is set to 8000 by default):
https://localhost:8000/docs