initial commit
This commit is contained in:
111
docker-compose.yml
Normal file
111
docker-compose.yml
Normal file
@@ -0,0 +1,111 @@
|
||||
networks:
|
||||
infoscreen-net:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
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:
|
||||
Reference in New Issue
Block a user