From 1912c492906252911c5e175527077d93d4ee1fdf Mon Sep 17 00:00:00 2001 From: Matt Speer Date: Sat, 20 Dec 2025 12:48:24 -0600 Subject: [PATCH] initial commit --- README.MD | 9 +++++++++ config/mosquitto.conf | 8 ++++++++ docker-compose.yaml | 26 ++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 README.MD create mode 100644 config/mosquitto.conf create mode 100644 docker-compose.yaml diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..15a60d4 --- /dev/null +++ b/README.MD @@ -0,0 +1,9 @@ +Refer to https://github.com/sukesh-ak/setup-mosquitto-with-docker for more details + +Must create mosquitto.conf file manually + +Create password file +touch config/pwfile + +From mqtt container terminal issue the following command and you will be prompted for a password +mosquitto_passwd -c /mosquitto/config/pwfile mqtt-user \ No newline at end of file diff --git a/config/mosquitto.conf b/config/mosquitto.conf new file mode 100644 index 0000000..5641be0 --- /dev/null +++ b/config/mosquitto.conf @@ -0,0 +1,8 @@ +allow_anonymous false +listener 1883 +listener 9001 +protocol websockets +persistence true +password_file /mosquitto/config/pwfile +persistence_file mosquitto.db +persistence_location /mosquitto/data/ \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..efbb174 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,26 @@ +version: "3.7" + +name: mqtt + +services: + mqtt5: + image: eclipse-mosquitto + container_name: mqtt5 + ports: + - "1883:1883" #default mqtt port + - "9001:9001" #default mqtt port for websockets + volumes: + - /home/mattspeer/docker/mqtt/config:/mosquitto/config:rw + - /home/mattspeer/docker/mqtt/data:/mosquitto/data:rw + - /home/mattspeer/docker/mqtt/log:/mosquitto/log:rw + restart: unless-stopped + +# volumes for mapping data,config and log +#volumes: +# config: +# data: +# log: + +#networks: +# default: +# name: mqtt5-network \ No newline at end of file