Skip to content

Commit

Permalink
fix(mosquitto): Fix healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienPoupa committed Jan 5, 2025
1 parent bf01df1 commit ef220ac
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,3 @@ HOMEPAGE_VAR_WEATHER_UNIT=metric
IMMICH_DB_PASSWORD=postgres
CALIBRE_USERNAME=admin
CALIBRE_PASSWORD=admin123
MOSQUITTO_USERNAME=
MOSQUITTO_PASSWORD=
2 changes: 0 additions & 2 deletions homeassistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Set the `HOMEASSISTANT_ACCESS_TOKEN` for homepage support.

If you need to use MQTT, you can enable it by setting `COMPOSE_PROFILES=homeassistant,mqtt`.

In the root `.env`, fill `MOSQUITTO_USERNAME` and `MOSQUITTO_PASSWORD` with the credentials you want to use.

Start the container, create a user in mosquitto with the following command and the credentials defined previously:

`docker compose exec mosquitto mosquitto_passwd -b /mosquitto/config/pwfile <username> <password>`
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
ports:
- "1883:1883"
healthcheck:
test: [ "CMD", "mosquitto_sub", "-u", "$${MOSQUITTO_USERNAME}", "-P", "$${MOSQUITTO_PASSWORD}", "-h", "localhost", "-t", "$$SYS/broker/uptime", "-i", "docker_health_check", "-C", "1" ]
test: [ "CMD", "mosquitto_sub", "-p", "1880", "-t", "$$SYS/#", "-C", "1", "-i", "healthcheck", "-W", "3" ]
interval: 1m
timeout: 10s
retries: 3
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/mosquitto/config/mosquitto.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ allow_anonymous false

log_dest file /mosquitto/log/mosquitto.log

listener 1883
listener 1883

listener 1880 127.0.0.1
allow_anonymous true

0 comments on commit ef220ac

Please sign in to comment.