test: write mosquitto password file to data volume (writable)
This commit is contained in:
@@ -29,8 +29,8 @@ services:
|
|||||||
- mosquitto_data:/mosquitto/data
|
- mosquitto_data:/mosquitto/data
|
||||||
- mosquitto_log:/mosquitto/log
|
- mosquitto_log:/mosquitto/log
|
||||||
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
||||||
# ensure a password file exists and start mosquitto with our config
|
# ensure a password file exists (in the writable data volume) and start mosquitto with our config
|
||||||
command: sh -c "mosquitto_passwd -b /mosquitto/config/passwordfile testuser testpass >/dev/null 2>&1 || true; /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf"
|
command: sh -c "mosquitto_passwd -b /mosquitto/data/passwordfile testuser testpass >/dev/null 2>&1 || true; /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "sh", "-c", "nc -z localhost 1883 || exit 1"]
|
test: ["CMD", "sh", "-c", "nc -z localhost 1883 || exit 1"]
|
||||||
interval: 2s
|
interval: 2s
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
listener 1883 0.0.0.0
|
listener 1883 0.0.0.0
|
||||||
# do not allow anonymous in this test stack; require password_file
|
# do not allow anonymous in this test stack; require password_file
|
||||||
allow_anonymous false
|
allow_anonymous false
|
||||||
password_file /mosquitto/config/passwordfile
|
# place password file in the data volume (writable)
|
||||||
|
password_file /mosquitto/data/passwordfile
|
||||||
# Increase persistence location so container can map volume if needed
|
# Increase persistence location so container can map volume if needed
|
||||||
persistence true
|
persistence true
|
||||||
persistence_location /mosquitto/data/
|
persistence_location /mosquitto/data/
|
||||||
|
|||||||
Reference in New Issue
Block a user