Docker Compose is the recommended way to run LogiMath locally and in team environments. A singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/whitiue/logiMathApp/llms.txt
Use this file to discover all available pages before exploring further.
docker-compose.yml file at the project root orchestrates two services — the FastAPI backend and a PostgreSQL 16 database — on a shared internal network, with healthchecks ensuring the database is ready before the backend starts.
Compose file overview
The fulldocker-compose.yml defines both services, a named volume for persistent database storage, and a bridge network so containers can reach each other by service name:
docker-compose.yml
- Healthchecks: The
postgresservice usespg_isreadyto verify the database accepts connections. Thebackendservice uses a Python one-liner to hithttp://localhost:8000/. The backend’sdepends_oncondition waits forpostgresto pass its healthcheck before starting. - Resource limits: PostgreSQL is capped at 0.5 CPU / 512 MB RAM; the backend at 1 CPU / 1 GB RAM. These prevent runaway containers on developer machines.
- Database initialization: The file
./docker/init.sqlis mounted into the PostgreSQL initialization directory and runs automatically the first time the container starts. - Persistent storage: The
postgres_datanamed volume survives container restarts, so your data is not lost when you rundocker-compose down.
Build and start the services
Before running, copy.env.example to .env and fill in your credentials. See Environment variables for details.
Set up your environment file
Copy the example environment file and update the values for your local setup:Open
.env and replace the placeholder password with a real one before proceeding.Build the Docker images
Build the backend image from Docker downloads the
./src/BackEnd/Dockerfile:postgres:16-alpine base image and builds the Python 3.12 backend image. This step only needs to run again if you change requirements.txt or the Dockerfile.Start all services
Start both containers in the foreground so you can see logs from both services:Docker Compose waits for the
postgres healthcheck to pass before launching the backend. Once the backend is ready, the API is available at http://localhost:8000.Verify the services are running
In a separate terminal, check that both containers are up and healthy:Both
logmath_db and logmath_backend should show a running or healthy status.Database initialization
On first startup, PostgreSQL automatically executes./docker/init.sql because it is mounted at /docker-entrypoint-initdb.d/01-init.sql. This file runs once and is skipped on subsequent starts if the data volume already exists. Use this file to create schemas, seed reference data, or set up roles required by the application.
The initialization script only runs when the
postgres_data volume is empty. To re-run it, remove the volume with docker-compose down -v and start fresh.