AllinOne
This commit is contained in:
parent
f7fa2c7510
commit
9e1733a96f
3 changed files with 41 additions and 3 deletions
4
.env
4
.env
|
|
@ -5,5 +5,5 @@ INFLUXDB_BUCKET=Temperaturen
|
|||
INFLUXDB_TOKEN=1wml0Wzrno-VPHxw0N4CSJh42aTAE-zCCAnAj8BLY_YxsmexXO6_8o7i1HDdAPzDUndCCsejWKq9GJXeYFDhpQ==
|
||||
|
||||
# MQTT
|
||||
MQTT_USER=dein_user
|
||||
MQTT_PASS=dein_passwort
|
||||
MQTT_USER=mqtt_user
|
||||
MQTT_PASS=mqtt_pw
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
# -------------------------------------------------
|
||||
# InfluxDB
|
||||
# -------------------------------------------------
|
||||
influxdb:
|
||||
image: influxdb:latest
|
||||
container_name: influxdb
|
||||
|
|
@ -16,6 +19,10 @@ services:
|
|||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Grafana
|
||||
# -------------------------------------------------
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
|
|
@ -35,10 +42,16 @@ services:
|
|||
influxdb:
|
||||
condition: service_healthy
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Mosquitto (MQTT) – User wird beim Start angelegt
|
||||
# -------------------------------------------------
|
||||
mqtt5:
|
||||
image: eclipse-mosquitto:latest
|
||||
container_name: mqtt5
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "1883:1883"
|
||||
- "9001:9001"
|
||||
|
|
@ -46,12 +59,31 @@ services:
|
|||
- ./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 -t healthcheck/ping -n >/dev/null 2>&1 || exit 1"]
|
||||
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
|
||||
|
|
@ -71,6 +103,7 @@ services:
|
|||
timeout: 3s
|
||||
retries: 12
|
||||
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: mqtt5-network
|
||||
|
|
|
|||
5
mosquitto/config/mosquitto.conf
Normal file
5
mosquitto/config/mosquitto.conf
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
listener 1883
|
||||
protocol mqtt
|
||||
|
||||
allow_anonymous false
|
||||
password_file /mosquitto/config/passwd
|
||||
Loading…
Add table
Add a link
Reference in a new issue