Docker Compose And Local Development
Цели
- Run each service independently with
api,migrator, andbackground. - Run shared infrastructure once.
- Support Windows
.batscripts with explicit compose project names. - Validate required environment and container health.
Infrastructure Compose
deploy/infrastructure/docker-compose.yml should include:
- PostgreSQL
- Kafka / Redpanda-compatible local broker
- Redis
- Elasticsearch
- Elasticsearch Dashboards optional
- ClickHouse
- MinIO
- OTEL Collector
- Prometheus
- Grafana
- Sentry-compatible local stack optional
- Mail/SMS mock providers
Service Compose
Each service has:
src/services/<service-name>/
docker-compose.yml
run-<service-name>-stack.bat
.env.example
Services in compose:
<service>-api<service>-migrator<service>-background
The migrator starts first and exits after migrations. API/background depend on successful migration and infrastructure health.
Windows BAT Launcher Requirements
Every launcher should:
- Set explicit project name:
Pin-<service>. - Check Docker is available.
- Check
.envexists or print copy instruction from.env.example. - Validate required environment keys.
- Run
docker compose -p Pin-<service> build --parallel. - Run
docker compose -p Pin-<service> up. - After startup, assert health endpoints where possible.
Example intent:
docker compose -p Pin-accounting build --parallel
docker compose -p Pin-accounting up
Environment
Secrets must not be committed. .env.example contains names only:
POSTGRES_CONNECTION_STRINGKAFKA_BOOTSTRAP_SERVERSREDIS_CONNECTION_STRINGELASTICSEARCH_URLCLICKHOUSE_CONNECTION_STRINGS3_ENDPOINTJWT_ISSUERJWT_AUDIENCE- provider-specific secret references.
Migrations
- PostgreSQL migrations through EF Core migrator projects.
- ClickHouse migrations through SQL scripts executed by analytics migrator.
- Elasticsearch index migrations through versioned index creation and aliases.
- Migrators must be idempotent and safe to rerun.
Local URLs
Reserve port ranges:
- Gateway: 7000-7099
- Backend services: 7100-7399
- Frontends: 3000-3099
- Infrastructure UIs: 9000-9099
Exact ports should be documented in each service README when scaffolded.