> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lokpanchang.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker

> Docker Compose services, ports, volumes, and dependencies for the Lok Panchang stack

The entire application runs via **Docker Compose**. All services are defined in **`docker-compose.yml`** at the repo root. This page summarizes each service, its role, ports, and dependencies.

## Services

| Service          | Image / build                        | Port(s)          | Description                                                                                                                              |
| ---------------- | ------------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **web**          | Build from repo root `Dockerfile`    | 5050             | Flask app: webhooks, API, test routes. Depends on db and redis. Mounts `.:/app` and `./backups:/backups`.                                |
| **db**           | `postgres:15`                        | 5432 (internal)  | PostgreSQL. Data in volume `postgres_data`. Env: POSTGRES\_USER, POSTGRES\_PASSWORD, POSTGRES\_DB.                                       |
| **redis**        | `redis:7`                            | 6379             | Redis: Celery broker and result backend. Healthcheck: `redis-cli ping`. Volume `redis_data`.                                             |
| **celery**       | Same build as web                    | —                | Celery worker: `celery -A tasks.celery worker`. Depends on redis; uses same DATABASE\_URL and CELERY\_\* as web. Mounts app and backups. |
| **beat**         | Same build as web                    | —                | Celery Beat: `celery -A tasks.celery beat` with schedule in `/tmp`. Depends on redis. Volume `beat_schedule` for schedule persistence.   |
| **admin-portal** | Build from `admin_portal/Dockerfile` | 5002             | Admin dashboard (Flask + Next.js). Depends on db; mounts `./backups` for log viewer.                                                     |
| **docs**         | Mintlify static build                | 5003             | Documentation site (Mintlify). Serves static build.                                                                                      |
| **caddy**        | `caddy:2`                            | 80, 443          | Reverse proxy. Mounts `./caddy/Caddyfile`. Depends on web and docs (admin-portal can be added). Proxies api/admin/docs subdomains.       |
| **ngrok**        | `ngrok/ngrok:3`                      | 4040 (dashboard) | Dev only (`profiles: [dev]`). Exposes web (5050) via public HTTPS. Mounts `./ngrok_config/ngrok.yml`.                                    |

## Environment

* **web, celery, beat:** `DATABASE_URL`, `CELERY_BROKER_URL`, `CELERY_RESULT_BACKEND` (and optional `S3_BUCKET_NAME` for beat/celery).
* **admin-portal:** `DATABASE_URL`, `OPENCAGE_API_KEY` (for geocoding when editing user location).
* **db:** `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`.

Other env (e.g. `WHATSAPP_PHONE_NUMBER_ID`, `WHATSAPP_ACCESS_TOKEN`, `OPENCAGE_API_KEY` for web) are typically set via `.env` or passed in the compose file.

## Volumes

* **postgres\_data** — PostgreSQL data.
* **redis\_data** — Redis persistence.
* **beat\_schedule** — Celery Beat schedule file (e.g. `/tmp` in beat container).
* **caddy\_data**, **caddy\_config** — Caddy TLS and config cache.
* **Bind mounts:** `.:/app` (web, celery, beat), `./backups:/backups` (web, celery, beat, admin-portal), `./caddy/Caddyfile`, `./ngrok_config/ngrok.yml`.

## Running

* **Standard:** `docker compose up -d` — starts all services except ngrok.
* **With ngrok:** `docker compose --profile dev up -d` — also starts ngrok for local webhook testing.

See [Quickstart](/quickstart) and [Caddy](/infrastructure/caddy), [Ngrok](/infrastructure/ngrok) for production vs development usage.
