diff --git a/README.md b/README.md index 411a237..4ea0517 100644 --- a/README.md +++ b/README.md @@ -419,6 +419,8 @@ A collection of delicious docker recipes. - [x] minio/minio - [x] mongo :bucket: - [x] ccrisan/motioneye +- [x] n8nio/n8n +- [x] emqx/nanomq :cn: - [x] deluan/navidrome :musical_note: - [x] neo4j :bucket: - [x] netdata/netdata @@ -428,7 +430,6 @@ A collection of delicious docker recipes. - [x] tiangolo/nginx-rtmp :camera: - [x] jupyter/notebook - [x] luzifer/nginx-sso -- [x] n8nio/n8n - [x] illuspas/node-media-server :cn: - [x] jorijn/nostream - [x] scsibug/nostr-rs-relay diff --git a/nanomq/README.md b/nanomq/README.md new file mode 100644 index 0000000..8fc2fc5 --- /dev/null +++ b/nanomq/README.md @@ -0,0 +1,36 @@ +nanomq +====== + +[NanoMQ][1] MQTT Broker (NanoMQ) is an all-around Edge Messaging Platform that +includes a blazing-fast MQTT Broker for the IoT/IIoT and a lightweight +Messaging Bus for SDV. + +## up and running + +```bash +$ mkdir -p data/{etc,log,var} +$ wget -P data/etc https://github.com/nanomq/nanomq/raw/master/etc/nanomq.conf +$ vi data/etc/nanomq.conf +$ docker compose up -d +$ curl -u admin:public http://192.168.42.156:8081/api/v4/brokers +``` + +## quick start + +```bash +$ mosquitto_sub -h 127.0.0.1 -p 1883 -t test -v +$ mosquitto_pub -h 127.0.0.1 -p 1883 -t test -m hello +``` + +## rule engine + +By default, the rule engine function is disabled. To enable it, please compile +with the [-DENABLE_RULE_ENGINE=ON][2] option. + +```bash +$ echo 'create table test(topic text, payload text)' | sqlite3 -cmd '.mode csv' data/var/test.db +$ echo 'select * from test' | sqlite3 -cmd '.mode csv' data/var/test.db +``` + +[1]: https://github.com/nanomq/nanomq/tree/master +[2]: https://nanomq.io/docs/en/latest/installation/build-options.html diff --git a/nanomq/data/etc/nanomq.conf b/nanomq/data/etc/nanomq.conf new file mode 100644 index 0000000..8dac3b7 --- /dev/null +++ b/nanomq/data/etc/nanomq.conf @@ -0,0 +1,79 @@ +# #============================================================ +# # NanoMQ Broker +# #============================================================ + +mqtt { + property_size = 32 + max_packet_size = 10KB + max_mqueue_len = 2048 + retry_interval = 10s + keepalive_multiplier = 1.25 +} + +listeners.tcp { + bind = "0.0.0.0:1883" +} + +# listeners.ssl { +# bind = "0.0.0.0:8883" +# keyfile = "/etc/certs/key.pem" +# certfile = "/etc/certs/cert.pem" +# cacertfile = "/etc/certs/cacert.pem" +# verify_peer = false +# fail_if_no_peer_cert = false +# } + +listeners.ws { + bind = "0.0.0.0:8083/mqtt" +} + +http_server { + port = 8081 + limit_conn = 2 + username = admin + password = public + auth_type = basic + jwt { + public.keyfile = "/etc/nanomq/jwtRS256.key.pub" + } +} + +log { + to = [file, console] + level = warn + dir = "/var/log/nanomq" + file = "nanomq.log" + rotation { + size = 10MB + count = 5 + } +} + +auth { + allow_anonymous = true + no_match = allow + deny_action = ignore + cache = { + max_size = 32 + ttl = 1m + } + # password = {include "/etc/nanomq_pwd.conf"} + # acl = {include "/etc/nanomq_acl.conf"} +} + +sqlite { + disk_cache_size = 102400 # Max number of messages for caching + mounted_file_path = "/var/lib/nanomq" # Mounted file path + flush_mem_threshold = 100 # The threshold number of flushing messages to flash + resend_interval = 5000 # Resend interval (ms) +} + +# rules.sqlite = { +# path = "/var/lib/nanomq/test.db" +# rules = [ +# { +# sql = "SELECT topic, payload FROM \"test\"" +# table = "test" +# } +# ] +# } diff --git a/nanomq/docker-compose.yml b/nanomq/docker-compose.yml new file mode 100644 index 0000000..6a52a2e --- /dev/null +++ b/nanomq/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.8" +services: + nanomq: + image: emqx/nanomq:0.21 + command: --conf /etc/nanomq/nanomq.conf + ports: + - "1883:1883" # mqtt + - "8081:8081" # api + - "8083:8083" # ws + volumes: + - ./data/etc:/etc/nanomq + - ./data/log:/var/log/nanomq + - ./data/var:/var/lib/nanomq + restart: unless-stopped