test: create mosquitto passwordfile with -c to ensure proper creation

This commit is contained in:
2025-12-28 15:53:53 +01:00
parent ba1aa6a058
commit b0e34a2555

View File

@@ -34,7 +34,7 @@ services:
- MOSQ_USER=testuser
- MOSQ_PASS=testpass
# ensure a password file exists (in the writable data volume) and start mosquitto with our config
command: sh -c "mkdir -p /mosquitto/data; mosquitto_passwd -b /mosquitto/data/passwordfile ${MOSQ_USER} ${MOSQ_PASS} >/dev/null 2>&1 || true; chown -R mosquitto:mosquitto /mosquitto/data || true; /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf"
command: sh -c "mkdir -p /mosquitto/data; mosquitto_passwd -c -b /mosquitto/data/passwordfile ${MOSQ_USER} ${MOSQ_PASS} >/dev/null 2>&1 || true; chown -R mosquitto:mosquitto /mosquitto/data || true; /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf"
healthcheck:
test: ["CMD", "sh", "-c", "nc -z localhost 1883 || exit 1"]
interval: 2s