Giter Site home page Giter Site logo

docker-vernemq's Introduction

Docker VerneMQ

An Alpine Linux image running VerneMQ MQTT broker (https://vernemq.com), supporting swarm mode.

Env var

name description default
SELF_IP The container IP. It will be discovered in swarm mode. 127.0.0.1
SERVICE_NAME The swarm service name, used to discover other nodes. Cluster mode is disabled if this variable is empty ""
DISCOVERY_NAME The DNS name to resolve to fetch a list of all nodes. Only used in cluster mode. "tasks.${SERVICE_NAME}"
MIN_NODES_SIZE The minimum number of node to wait before starting when running in cluster mode 3

Exploitation

The vmq-admin utility is located in /usr/share/vernemq/bin/vmq-admin, so you can run:

#!/bin/bash

id=$(docker ps | grep "jbonachera/vernemq:" | awk '{ print $1 }')
docker exec -it $id vmq-admin  $@

Testing with docker-compose

edit the docker-compose.yml to add the environment variable DISCOVERY_NAME="vernemq"

docker-compose up --scale vernemq=3

A cluster of 3 nodes should be started, and MQTT service should be exposed on a random port on localhost.

show the cluster nodes

docker-compose exec vernemq vmq-admin cluster show

subscribe to a topic running

mosquitto_sub -h localhost --host 127.0.0.1 --port $(docker-compose port vernemq 1883 | cut -d : -f 2) -d -t devices/+/temperature/degrees

Testing with Swarm mode

docker swarm init
docker stack deploy -c docker-compose.yml mqtt

docker-vernemq's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.