"Eclipse Mosquitto is an open source implementation of a server for version 3.1 and 3.1.1 of the MQTT protocol. Main homepage: http://mosquitto.org/"
This image provides some enhancements to the official Mosquitto Docker image eclipse-mosquitto so that it runs perfectly on OpenShift:
- Correct permissions on data directories
- Configuration in ConfigMap
- Logfiles on stdout
Instantiate the template using:
oc process -f https://raw.githubusercontent.com/tobru/mosquitto-openshift/master/openshift-template.yaml MQTT_WEBSOCKET_URL=mymqttwebsocket.mydomain.com | oc create -f -
The configuration for Mosquitto is saved as a ConfigMap.
To update the Mosquitto configuration just edit the ConfigMap using
oc edit configmap mosquitto
and redeploy the application with
oc deploy mosquitto --latest
(the is no trigger when updating a ConfigMap).
The configuration delivered with this template doesn't contain any security configuration (no TLS connections, no authentication. It's strongly recommended to configure TLS and authentication.
To have persistent data, a volume can be mounted to /mosquitto/data
:
oc volume dc/mosquitto --add --mount-path=/mosquitto/data --claim-mode=ReadWriteOnce --claim-name=mosquitto --claim-size=5Gi --type=persistentVolumeClaim
To expose the MQTT TCP service to the world, the OpenShift router can't be used. Please find more information about the different ways available under Getting Traffic into the Cluster.
Mosquitto is also able to expose MQTT over Websockets. This should work with the OpenShift router (not yet tested, but the templates provides a route for MQTT over Websockets).
Pull requests to the template and the Dockerfile are welcome!