Files
home_automatization/docker-compose.yml
T
cactoandClaude Sonnet 5 938700cf86 Implement ingest-service: MQTT -> ClickHouse (batched) + RabbitMQ event
Subscribes to devices/+/telemetry, validates payloads, buffers writes into
ClickHouse (flush on size or interval), and emits a per-reading event on
RabbitMQ for rule-engine-service to consume later. Adds the initial Postgres
and ClickHouse schema migrations, a Dockerfile, and wires the service into
docker-compose. Verified end-to-end via docker compose + mosquitto_pub: row
lands in ClickHouse and the event reaches the telemetry.new_reading queue.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 16:52:45 +05:00

122 lines
3.1 KiB
YAML

networks:
home-automation:
driver: bridge
volumes:
postgres-data:
clickhouse-data:
redis-data:
rabbitmq-data:
mosquitto-data:
services:
mosquitto:
image: eclipse-mosquitto:2
ports:
- "1883:1883"
volumes:
- ./configs/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- mosquitto-data:/mosquitto/data
networks:
- home-automation
restart: unless-stopped
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "${POSTGRES_PORT}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./migrations/postgres:/docker-entrypoint-initdb.d:ro
networks:
- home-automation
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
clickhouse:
image: clickhouse/clickhouse-server:24-alpine
environment:
CLICKHOUSE_DB: ${CLICKHOUSE_DB}
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
ports:
- "${CLICKHOUSE_HTTP_PORT}:8123"
- "${CLICKHOUSE_NATIVE_PORT}:9000"
volumes:
- clickhouse-data:/var/lib/clickhouse
- ./migrations/clickhouse:/docker-entrypoint-initdb.d:ro
networks:
- home-automation
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
ports:
- "${REDIS_PORT}:6379"
volumes:
- redis-data:/data
networks:
- home-automation
restart: unless-stopped
rabbitmq:
image: rabbitmq:3-management-alpine
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
ports:
- "${RABBITMQ_PORT}:5672"
- "${RABBITMQ_MANAGEMENT_PORT}:15672"
volumes:
- rabbitmq-data:/var/lib/rabbitmq
networks:
- home-automation
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
ingest-service:
build: ./services/ingest-service
environment:
MQTT_HOST: mosquitto
MQTT_PORT: 1883
CLICKHOUSE_HOST: clickhouse
CLICKHOUSE_NATIVE_PORT: 9000
CLICKHOUSE_DB: ${CLICKHOUSE_DB}
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
depends_on:
mosquitto:
condition: service_started
clickhouse:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- home-automation
restart: unless-stopped
# Remaining app services (device-control-service, rule-engine-service,
# health-check-service, esp32-emulator, laravel-app) are added here as they
# get implemented — see services/*/README.md for the plan for each one.