111 lines
2.7 KiB
YAML
111 lines
2.7 KiB
YAML
version: "3.9"
|
||
|
||
services:
|
||
# -------------------------------------------------
|
||
# InfluxDB
|
||
# -------------------------------------------------
|
||
influxdb:
|
||
image: influxdb:latest
|
||
container_name: influxdb
|
||
restart: unless-stopped
|
||
ports:
|
||
- "8086:8086"
|
||
volumes:
|
||
- ./influxdb/data:/var/lib/influxdb2
|
||
- ./influxdb/config:/etc/influxdb2
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-fsS", "http://localhost:8086/health"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 20
|
||
|
||
|
||
# -------------------------------------------------
|
||
# Grafana
|
||
# -------------------------------------------------
|
||
grafana:
|
||
image: grafana/grafana:latest
|
||
container_name: grafana
|
||
restart: unless-stopped
|
||
user: "0"
|
||
ports:
|
||
- "3000:3000"
|
||
volumes:
|
||
- ./grafana/data:/var/lib/grafana
|
||
- ./grafana/config:/etc/grafana
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 20
|
||
depends_on:
|
||
influxdb:
|
||
condition: service_healthy
|
||
|
||
|
||
# -------------------------------------------------
|
||
# Mosquitto (MQTT) – User wird beim Start angelegt
|
||
# -------------------------------------------------
|
||
mqtt5:
|
||
image: eclipse-mosquitto:latest
|
||
container_name: mqtt5
|
||
restart: unless-stopped
|
||
user: "0"
|
||
env_file:
|
||
- .env
|
||
ports:
|
||
- "1883:1883"
|
||
- "9001:9001"
|
||
volumes:
|
||
- ./mosquitto/config:/mosquitto/config
|
||
- ./mosquitto/data:/mosquitto/data
|
||
- ./mosquitto/log:/mosquitto/log
|
||
|
||
command: >
|
||
sh -c '
|
||
if [ ! -f /mosquitto/config/passwd ]; then
|
||
echo "Creating MQTT user";
|
||
mosquitto_passwd -b /mosquitto/config/passwd "$MQTT_USER" "$MQTT_PASS";
|
||
chmod 600 /mosquitto/config/passwd;
|
||
fi &&
|
||
exec mosquitto -c /mosquitto/config/mosquitto.conf
|
||
'
|
||
|
||
healthcheck:
|
||
test:
|
||
[
|
||
"CMD-SHELL",
|
||
"mosquitto_pub -h localhost -p 1883 -u \"$MQTT_USER\" -P \"$MQTT_PASS\" -q 0 -t healthcheck/ping -n >/dev/null 2>&1 || exit 1"
|
||
]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 12
|
||
|
||
|
||
# -------------------------------------------------
|
||
# Telegraf
|
||
# -------------------------------------------------
|
||
telegraf:
|
||
image: telegraf:latest
|
||
container_name: telegraf
|
||
restart: unless-stopped
|
||
env_file:
|
||
- .env
|
||
volumes:
|
||
- ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||
depends_on:
|
||
mqtt5:
|
||
condition: service_healthy
|
||
influxdb:
|
||
condition: service_healthy
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pidof telegraf >/dev/null 2>&1 || exit 1"]
|
||
interval: 10s
|
||
timeout: 3s
|
||
retries: 12
|
||
|
||
|
||
networks:
|
||
default:
|
||
name: mqtt5-network
|
||
external: true
|