Mosquitto with health checking
3.1K
HEALTHCHECK_PORT
By default, a localhost listener on port 1880 is created to serve the healthcheck client. This can be overwritten by setting the HEALTHCHECK_PORT variable, for example:
shell
docker run --rm -it --env=HEALTHCHECK_PORT=1881 -d mosquitto-hc:latest
compose.yaml
...
services:
mosquitto:
image: mosquitto-hc:latest
environment:
HEALTHCHECK_PORT: 1881
...
HEALTHCHECK_USERNAME and HEALTHCHECK_PASSWORD
By default, a new listener with anonumous login is created to serve the healthcheck client. This can be overwritten by setting the HEALTHCHECK_USERNAME and HEALTHCHECK_PASSWORD variables, in which case, an existing listener will be used instead of creating a new one. For example:
shell
docker run --rm -it --env=HEALTHCHECK_USERNAME=testUser --env=HEALTHCHECK_PASSWORD=testPaswd -d mosquitto-hc:latest
compose.yaml
...
services:
mosquitto:
image: mosquitto-hc:latest
environment:
HEALTHCHECK_USERNAME: testUser
HEALTHCHECK_PASSWORD: testPaswd
...
HEALTHCHECK_TOPIC
By default, the healthcheck client subscribes to the $SYS/broker/uptime topic. This can be overwritten by setting the HEALTHCHECK_TOPIC variable. This is useful if an existing listener is used that disables the $SYS hierarchy completely. Note, that subscribing to the selected topic should imidiately return a value, otherwise the healthcheck will time out. For example:
shell
docker run --rm -it --env=HEALTHCHECK_TOPIC=test/topic -d mosquitto-hc:latest
compose.yaml
...
services:
mosquitto:
image: mosquitto-hc:latest
environment:
HEALTHCHECK_TOPIC: test/topic
...
Content type
Image
Digest
sha256:d9b4099b4…
Size
9.6 MB
Last updated
5 months ago
docker pull guiorgy/mosquitto-hc:2