nanomq: add new package
authorAndrew Yong <[email protected]>
Fri, 7 Nov 2025 17:38:07 +0000 (01:38 +0800)
committerTianling Shen <[email protected]>
Sat, 22 Nov 2025 06:38:29 +0000 (14:38 +0800)
NanoMQ MQTT Broker (NanoMQ) is described by EMQX as "An ultra-lightweight
and blazing-fast Messaging Broker/Bus for IoT Edge & SDV".

Co-authored-by: George Sapkin <[email protected]>
Co-authored-by: Tianling Shen <[email protected]>
Signed-off-by: Andrew Yong <[email protected]>
net/nanomq/Makefile [new file with mode: 0644]
net/nanomq/files/nanomq.init [new file with mode: 0644]
net/nanomq/patches/100-conf.patch [new file with mode: 0644]

diff --git a/net/nanomq/Makefile b/net/nanomq/Makefile
new file mode 100644 (file)
index 0000000..f3f5a66
--- /dev/null
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2025 Andrew Yong <[email protected]>
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nanomq
+PKG_VERSION:=0.24.5
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/nanomq/nanomq.git
+PKG_SOURCE_VERSION:=$(PKG_VERSION)
+PKG_MIRROR_HASH:=bd98194ee03032ccd5e1b7c2faf1e8bfff55b76a916550072070ac93e46e6460
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE.txt
+PKG_MAINTAINER:=Andrew Yong <[email protected]>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_OPTIONS+= \
+       -DBUILD_CLIENT=OFF
+
+define Package/nanomq
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=NanoMQ Broker
+  URL:=https://github.com/nanomq/nanomq
+  DEPENDS:=+libatomic
+endef
+
+define Package/nanomq/description
+  An ultra-lightweight and blazing-fast Messaging Broker/Bus for IoT Edge & SDV
+endef
+
+define Package/nanomq/conffiles
+/etc/nanomq.conf
+endef
+
+define Package/nanomq/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nanomq $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nanomq.init $(1)/etc/init.d/nanomq
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/etc/nanomq.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,nanomq))
diff --git a/net/nanomq/files/nanomq.init b/net/nanomq/files/nanomq.init
new file mode 100644 (file)
index 0000000..091099b
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2025 Andrew Yong <[email protected]>
+
+START=95
+STOP=10
+
+USE_PROCD=1
+PROG=/usr/bin/nanomq
+CONFIGFILE=/etc/nanomq.conf
+
+start_service() {
+       procd_open_instance
+       procd_set_param command "$PROG" start --conf "$CONFIGFILE"
+       procd_close_instance
+}
diff --git a/net/nanomq/patches/100-conf.patch b/net/nanomq/patches/100-conf.patch
new file mode 100644 (file)
index 0000000..4847df4
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/etc/nanomq.conf
++++ b/etc/nanomq.conf
+@@ -21,39 +21,13 @@ 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/certs/jwt/jwtRS256.key.pub"
+-    }
+-}
+-
+ log {
+-    to = [file, console]
++    to = [console]
+     level = warn
+-    dir = "/tmp"
+-    file = "nanomq.log"
+-    rotation {
+-        size = 10MB
+-        count = 5
+-    }
+ }
+ auth {