Docker Compose is the recommended deployment method for cloud and production-like environments. The includedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sagar-grv/ayush-synapse/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile builds from a Python 3.9 slim base image, runs the application as a non-root app user for improved security, and exposes port 5000. A built-in health check polls /health every 30 seconds so container orchestrators can detect failures automatically.
Prerequisites — Make sure the following are installed on your host machine:
- Docker 20.10+
- Docker Compose — either the standalone
docker-composebinary or the integrateddocker composeplugin
Deployment Steps
(Optional) Create a .env File
To override any default environment variable, create a Docker Compose automatically reads
.env file in the project root before building:.env from the project directory and passes matching variables to the container. See the Configuration reference for every supported variable.Build and Start the Service
--build.Docker Compose Configuration
Thedocker-compose.yml at the repository root defines a single ayush-synapse service:
docker-compose.yml
| Field | Description |
|---|---|
ports | Maps host port 5000 to container port 5000. Change the left value (e.g. "8080:5000") to serve on a different host port. |
environment | Inline environment variables passed to the Flask process. These can be overridden by a .env file or CI/CD secrets. |
volumes | Mounts ./instance on the host into /app/instance in the container, persisting the SQLite database across restarts. |
restart | unless-stopped ensures the container restarts automatically after a crash or host reboot, unless manually stopped. |
healthcheck | Polls GET /health every 30 seconds; marks the container unhealthy after 3 consecutive failures. |
Dockerfile Overview
Dockerfile
Dockerfile:
python:3.9-slim— minimal Debian-based image; reduces attack surface and pull time.PYTHONDONTWRITEBYTECODE/PYTHONUNBUFFERED— prevents.pycclutter and ensures logs stream in real time.- Non-root
appuser — the application never runs asroot, limiting the blast radius of a container escape. --no-cache-diron pip — keeps the image layer lean.HEALTHCHECK— container platforms (Docker Swarm, ECS, etc.) use this to gate traffic until the service is ready.
Persistent Storage
Thevolumes entry in docker-compose.yml maps the host directory ./instance to /app/instance inside the container:
ayush_synapse.db) into the /app/instance directory. Without this mount, the database would be lost every time the container is recreated. With the mount:
- Data survives
docker compose downanddocker compose up. - You can back up the SQLite file directly from the host at
./instance/ayush_synapse.db. - Replacing the container image (
docker compose pull+up -d) does not wipe existing records.
Health Check Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Basic liveness check — returns 200 OK if the process is running. |
/health/detailed | GET | Detailed readiness check — includes database connectivity, dependency status, and uptime metrics. |
/health/detailed in load-balancer readiness probes to ensure the service is fully initialised before receiving traffic.