2025-10-30 07:37:44 +00:00
|
|
|
version: '3.8'
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
calejo-control-adapter:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
container_name: calejo-control-adapter
|
|
|
|
|
ports:
|
|
|
|
|
- "8080:8080" # REST API
|
|
|
|
|
- "4840:4840" # OPC UA
|
|
|
|
|
- "502:502" # Modbus TCP
|
|
|
|
|
- "9090:9090" # Prometheus metrics
|
|
|
|
|
environment:
|
|
|
|
|
- DATABASE_URL=postgresql://calejo:password@postgres:5432/calejo
|
|
|
|
|
- JWT_SECRET_KEY=your-secret-key-change-in-production
|
|
|
|
|
- API_KEY=your-api-key-here
|
|
|
|
|
depends_on:
|
|
|
|
|
- postgres
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
start_period: 30s
|
|
|
|
|
volumes:
|
|
|
|
|
- ./logs:/app/logs
|
|
|
|
|
- ./config:/app/config
|
|
|
|
|
networks:
|
|
|
|
|
- calejo-network
|
|
|
|
|
|
|
|
|
|
postgres:
|
|
|
|
|
image: postgres:15
|
|
|
|
|
container_name: calejo-postgres
|
|
|
|
|
environment:
|
|
|
|
|
- POSTGRES_DB=calejo
|
|
|
|
|
- POSTGRES_USER=calejo
|
|
|
|
|
- POSTGRES_PASSWORD=password
|
|
|
|
|
ports:
|
|
|
|
|
- "5432:5432"
|
|
|
|
|
volumes:
|
|
|
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
|
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
networks:
|
|
|
|
|
- calejo-network
|
|
|
|
|
|
|
|
|
|
prometheus:
|
|
|
|
|
image: prom/prometheus:latest
|
|
|
|
|
container_name: calejo-prometheus
|
|
|
|
|
ports:
|
|
|
|
|
- "9091:9090"
|
|
|
|
|
volumes:
|
|
|
|
|
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
2025-11-01 11:22:06 +00:00
|
|
|
- ./monitoring/web.yml:/etc/prometheus/web.yml
|
2025-10-30 07:37:44 +00:00
|
|
|
- ./monitoring/alert_rules.yml:/etc/prometheus/alert_rules.yml
|
|
|
|
|
- prometheus_data:/prometheus
|
|
|
|
|
command:
|
|
|
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
2025-11-01 11:12:12 +00:00
|
|
|
- '--web.config.file=/etc/prometheus/web.yml'
|
2025-10-30 07:37:44 +00:00
|
|
|
- '--storage.tsdb.path=/prometheus'
|
|
|
|
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
|
|
|
- '--web.console.templates=/etc/prometheus/consoles'
|
|
|
|
|
- '--storage.tsdb.retention.time=200h'
|
|
|
|
|
- '--web.enable-lifecycle'
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
networks:
|
|
|
|
|
- calejo-network
|
|
|
|
|
|
|
|
|
|
grafana:
|
|
|
|
|
image: grafana/grafana:latest
|
|
|
|
|
container_name: calejo-grafana
|
|
|
|
|
ports:
|
|
|
|
|
- "3000:3000"
|
|
|
|
|
environment:
|
2025-11-01 11:43:18 +00:00
|
|
|
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
|
2025-10-30 07:37:44 +00:00
|
|
|
- GF_USERS_ALLOW_SIGN_UP=false
|
2025-11-01 11:22:06 +00:00
|
|
|
# Prometheus datasource configuration
|
|
|
|
|
- PROMETHEUS_AUTH_ENABLED=true
|
2025-11-01 11:43:18 +00:00
|
|
|
- PROMETHEUS_USERNAME=${PROMETHEUS_USERNAME:-prometheus_user}
|
|
|
|
|
- PROMETHEUS_PASSWORD=${PROMETHEUS_PASSWORD:-prometheus_password}
|
2025-10-30 07:37:44 +00:00
|
|
|
volumes:
|
|
|
|
|
- grafana_data:/var/lib/grafana
|
|
|
|
|
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards
|
|
|
|
|
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources
|
|
|
|
|
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
depends_on:
|
|
|
|
|
- prometheus
|
|
|
|
|
networks:
|
|
|
|
|
- calejo-network
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
postgres_data:
|
|
|
|
|
prometheus_data:
|
|
|
|
|
grafana_data:
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
calejo-network:
|
|
|
|
|
driver: bridge
|