first commit
This commit is contained in:
commit
4b98219bf7
144 changed files with 31561 additions and 0 deletions
107
docker-compose.yml
Normal file
107
docker-compose.yml
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
services:
|
||||
|
||||
# ── MQTT Broker ──────────────────────────────────────────────────
|
||||
mqtt:
|
||||
image: eclipse-mosquitto:2
|
||||
container_name: dcim_mqtt
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "1883:1883"
|
||||
volumes:
|
||||
- ./infra/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mosquitto_sub -t '$$SYS/#' -C 1 -i healthcheck -W 3"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# ── PostgreSQL + TimescaleDB ─────────────────────────────────────
|
||||
db:
|
||||
image: timescale/timescaledb:latest-pg16
|
||||
container_name: dcim_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: dcim
|
||||
POSTGRES_PASSWORD: dcim_pass
|
||||
POSTGRES_DB: dcim
|
||||
ports:
|
||||
- "5433:5432" # host 5433 → container 5432 (avoids conflict with existing Postgres)
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U dcim -d dcim"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# ── FastAPI backend ──────────────────────────────────────────────
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: dcim_backend
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
environment:
|
||||
DATABASE_URL: postgresql+asyncpg://dcim:dcim_pass@db:5432/dcim
|
||||
MQTT_HOST: mqtt
|
||||
MQTT_PORT: "1883"
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
mqtt:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:8000/api/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
|
||||
# ── Simulator bots (seed first, then run bots) ───────────────────
|
||||
simulators:
|
||||
build:
|
||||
context: ./simulators
|
||||
dockerfile: Dockerfile
|
||||
container_name: dcim_simulators
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MQTT_HOST: mqtt
|
||||
MQTT_PORT: "1883"
|
||||
DATABASE_URL: postgresql://dcim:dcim_pass@db:5432/dcim
|
||||
SEED_MINUTES: "30"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
mqtt:
|
||||
condition: service_healthy
|
||||
backend:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./simulators:/app
|
||||
|
||||
# ── Next.js frontend ─────────────────────────────────────────────
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
container_name: dcim_frontend
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./frontend/.env.local
|
||||
ports:
|
||||
- "5646:5646"
|
||||
depends_on:
|
||||
- backend
|
||||
environment:
|
||||
PORT: "5646"
|
||||
BACKEND_INTERNAL_URL: http://backend:8000
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
Loading…
Add table
Add a link
Reference in a new issue