Files
infoscreen/docker-compose.yml
olaf 628a3b1fe9 introduce nginex-proxy
use host ip if working in wsl
2025-06-10 22:55:13 +02:00

124 lines
3.0 KiB
YAML

networks:
infoscreen-net:
driver: bridge
services:
proxy:
image: nginx:1.25
container_name: infoscreen-proxy
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- server
- dashboard
networks:
- infoscreen-net
db:
image: mariadb:11.4.7
container_name: infoscreen-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- db-data:/var/lib/mysql
ports:
- "3306:3306"
networks:
- infoscreen-net
# ✅ HINZUGEFÜGT: Healthcheck für MariaDB
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
mqtt:
image: eclipse-mosquitto:2.0.21
container_name: infoscreen-mqtt
restart: unless-stopped
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
# ✅ HINZUGEFÜGT: MQTT-Ports explizit exponiert
ports:
- "1883:1883" # Standard MQTT
- "9001:9001" # WebSocket (falls benötigt)
networks:
- infoscreen-net
# ✅ HINZUGEFÜGT: Healthcheck für MQTT
healthcheck:
test: ["CMD-SHELL", "mosquitto_pub -h localhost -t test -m 'health' || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
server:
build:
context: ./server
dockerfile: Dockerfile
image: infoscreen-api:latest
container_name: infoscreen-api
restart: unless-stopped
depends_on:
# ✅ GEÄNDERT: Erweiterte depends_on mit Healthcheck-Conditions
db:
condition: service_healthy
mqtt:
condition: service_healthy
environment:
DB_CONN: "mysql+pymysql://${DB_USER}:${DB_PASSWORD}@db/${DB_NAME}"
FLASK_ENV: ${FLASK_ENV}
ENV_FILE: ${ENV_FILE}
MQTT_BROKER_URL: ${MQTT_BROKER_URL}
MQTT_USER: ${MQTT_USER}
MQTT_PASSWORD: ${MQTT_PASSWORD}
ports:
- "8000:8000"
networks:
- infoscreen-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 40s
dashboard:
build:
context: ./dashboard
dockerfile: Dockerfile
image: infoscreen-dashboard:latest
container_name: infoscreen-dashboard
restart: unless-stopped
depends_on:
# ✅ GEÄNDERT: Healthcheck-Condition für Server
server:
condition: service_healthy
environment:
API_URL: ${API_URL}
ports:
- "8050:8050"
networks:
- infoscreen-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8050/_alive"]
interval: 30s
timeout: 5s
retries: 3
start_period: 45s
volumes:
db-data:
# mosquitto-conf:
# mosquitto-data:
# # ✅ HINZUGEFÜGT: Log-Volume für MQTT
# mosquitto-logs: