Mosquitto : Adds Eclipse Mosquitto broker - #96
Conversation
|
Maybe i should add dfifferent config options in mosquitto.conf in readme ? |
There was a problem hiding this comment.
Pull request overview
Adds a new Mosquitto MQTT broker application to the Unikraft catalog-core, including build/run scaffolding and platform configs for QEMU, Firecracker, and Xen, plus rootfs configuration.
Changes:
- Adds a new
mosquitto/app directory with Kconfig (Config.uk), build wrapper (Makefile), setup script, and documentation. - Introduces platform run configurations (Firecracker JSON, Xen cfg) and defconfig presets (QEMU x86_64/arm64).
- Updates the top-level
setup.shto fetch the requiredlib-mosquittodependency.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.sh | Clones lib-mosquitto into the standard repos layout. |
| mosquitto/xen.x86_64.cfg | Adds Xen PV config to boot Mosquitto with initrd-based rootfs. |
| mosquitto/xen.arm64.cfg | Adds Xen arm64 config (currently uses type = "pvh"). |
| mosquitto/setup.sh | Creates workdir/ and symlinks required repos for the Mosquitto app. |
| mosquitto/scripts/defconfig/qemu.x86_64 | Adds x86_64 QEMU defconfig (currently missing explicit Mosquitto enablement). |
| mosquitto/scripts/defconfig/qemu.arm64 | Adds arm64 QEMU defconfig with virtio/net/9p and Mosquitto symbols enabled. |
| mosquitto/rootfs/etc/mosquitto/mosquitto.conf | Provides broker config (listener, anonymous access, persistence settings). |
| mosquitto/README.md | Documents setup/build/run/test steps for QEMU/Firecracker/Xen. |
| mosquitto/Makefile.uk | Added (empty, consistent with some other catalog apps). |
| mosquitto/Makefile | Build wrapper invoking Unikraft with required libs and build dir. |
| mosquitto/fc.x86_64.json | Firecracker x86_64 boot config. |
| mosquitto/fc.arm64.json | Firecracker arm64 boot config. |
| mosquitto/Config.uk | Kconfig selecting Mosquitto + networking + filesystem dependencies. |
| mosquitto/.gitignore | Ignores generated build artifacts and runtime files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
df8bfe0 to
5401357
Compare
This adds the Unikraft port of the Eclipse Mosquitto MQTT broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Signed-off-by: Tushar Verma <tusharVermaiota@proton.me>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated no new comments.
Suppressed comments (10)
mosquitto/test.sh:16
mosquitto_sub | grep -qxtreats the expected message as a regular expression; use fixed-string matching so the test can’t fail if the message ever contains regex metacharacters.
mosquitto_sub -h "$HOST" -p "$PORT" -t "$TOPIC" -C 1 -W 5 | grep -qx "$MSG"
mosquitto/rootfs/etc/mosquitto/mosquitto.conf:12
- There’s trailing whitespace and an extra leading space in the persistence comment, which makes the shipped config look sloppy and can trip whitespace-sensitive tooling.
# Set to "none" to silence the broker.
log_dest stdout
# /data/ lives in the in-memory root filesystem, so the database survives a
# restart
persistence true
mosquitto/.scripts/run/qemu.x86_64:15
- This script continues even if network setup or initrd packing fails; add
set -eso failures stop early. If you do that, the best-effort cleanup block should be explicitly ignored (|| true) so missing interfaces don’t abort the run.
#!/bin/sh
if test ! -f "workdir/build/mosquitto_qemu-x86_64"; then
echo "No kernel file workdir/build/mosquitto_qemu-x86_64." 1>&2
echo "Did you run ./.scripts/build/qemu.x86_64 ?" 1>&2
mosquitto/.scripts/run/qemu.arm64:15
- This script continues even if network setup or initrd packing fails; add
set -eso failures stop early. If you do that, the best-effort cleanup block should be explicitly ignored (|| true) so missing interfaces don’t abort the run.
#!/bin/sh
if test ! -f "workdir/build/mosquitto_qemu-arm64"; then
echo "No kernel file workdir/build/mosquitto_qemu-arm64." 1>&2
echo "Did you run ./.scripts/build/qemu.arm64 ?" 1>&2
mosquitto/.scripts/run/fc.x86_64:15
- This script continues even if network setup or initrd packing fails; add
set -eso failures stop early. If you do that, the best-effort cleanup block should be explicitly ignored (|| true) so missing interfaces don’t abort the run.
#!/bin/sh
if test ! -f "workdir/build/mosquitto_fc-x86_64"; then
echo "No kernel file workdir/build/mosquitto_fc-x86_64." 1>&2
echo "Did you run ./.scripts/build/fc.x86_64 ?" 1>&2
mosquitto/.scripts/run/fc.arm64:15
- This script continues even if network setup or initrd packing fails; add
set -eso failures stop early. If you do that, the best-effort cleanup block should be explicitly ignored (|| true) so missing interfaces don’t abort the run.
#!/bin/sh
if test ! -f "workdir/build/mosquitto_fc-arm64"; then
echo "No kernel file workdir/build/mosquitto_fc-arm64." 1>&2
echo "Did you run ./.scripts/build/fc.arm64 ?" 1>&2
mosquitto/.scripts/build/qemu.x86_64:4
- Defaulting to
-wsuppresses all compiler warnings, which can hide real build issues. Also considerset -eso a failingmakestep stops the script immediately.
#!/bin/sh
export UK_CFLAGS="${UK_CFLAGS:--std=gnu17 -w}"
make distclean
mosquitto/.scripts/build/qemu.arm64:4
- Defaulting to
-wsuppresses all compiler warnings, which can hide real build issues. Also considerset -eso a failingmakestep stops the script immediately.
#!/bin/sh
export UK_CFLAGS="${UK_CFLAGS:--std=gnu17 -w}"
make distclean
mosquitto/.scripts/build/fc.x86_64:4
- Defaulting to
-wsuppresses all compiler warnings, which can hide real build issues. Also considerset -eso a failingmakestep stops the script immediately.
#!/bin/sh
export UK_CFLAGS="${UK_CFLAGS:--std=gnu17 -w}"
make distclean
mosquitto/.scripts/build/fc.arm64:4
- Defaulting to
-wsuppresses all compiler warnings, which can hide real build issues. Also considerset -eso a failingmakestep stops the script immediately.
#!/bin/sh
export UK_CFLAGS="${UK_CFLAGS:--std=gnu17 -w}"
make distclean
AndreiRV1
left a comment
There was a problem hiding this comment.
Looks good overall, but the build script currently fails to complete because several required dependencies are missing.
Please ensure LIBVFSCORE and LIBSYSCALL_SHIM are explicitly selected in the configuration so the full dependency chain is satisfied and the project builds without errors.
Vfscore should be set to imply as per this |
|
Also @AndreiRV1 can you also review this at your covenience ? |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Suppressed comments (4)
mosquitto/README.md:14
- This quick-setup snippet assumes
/etc/qemualready exists, but the listed requirements do not guarantee that; on a clean hostteefails and the subsequent bridge-backed QEMU launch cannot work. Add the directory creation step used by the top-level README (README.md:74) before writingbridge.conf.
echo "allow all" | sudo tee /etc/qemu/bridge.conf
mosquitto/README.md:67
xl createis not sufficient with these configs: both Xen files require avirbr0bridge with the guest gateway at172.44.0.1, but this section never creates/configures that bridge, and it also omits themkcpiocommand needed to produceinitrd.cpio. On a clean Xen host the command therefore fails or boots an unreachable broker. Add the network and initrd setup steps before thexlcommand, as inredis/README.md:302-319.
Xen has no scripts. Build it by passing [.scripts/defconfig/](.scripts/defconfig/)
style options to `make menuconfig`, pack the initrd yourself, then boot it with
`sudo xl create -c xen.x86_64.cfg` on a system with Xen installed.
mosquitto/README.md:28
- These quick-start commands invoke the host
mosquitto_sub/mosquitto_pubclients, but the referenced shared requirements and CI base dependency list do not installmosquitto-clients. On a clean setup following this README, the commands fail withcommand not found; document or install that app-specific prerequisite.
mosquitto_sub -h 172.44.0.2 -t test/unikraft
mosquitto/test.sh:16
grep -qxinterpretsMSGas a basic regular expression, so the.inUnikraft!matches any character and a corrupted response such asUnikraftXwould still make this round-trip test pass. Use fixed-string matching (grep -Fqx) so the assertion checks the exact payload.
mosquitto_sub -h "$HOST" -p "$PORT" -t "$TOPIC" -C 1 -W 5 | grep -qx "$MSG"
| # Remove previously created files. | ||
| rm -f firecracker.socket | ||
|
|
||
| firecracker-arm64 \ |
| select LIBUKCPIO | ||
| select LIBLWIP | ||
| select LWIP_IPV4 | ||
| select LWIP_UDP | ||
| select LWIP_DHCP |
| test -d repos/libs/redis || git clone https://github.com/unikraft/lib-redis repos/libs/redis | ||
| test -d repos/libs/wamr || git clone https://github.com/unikraft/lib-wamr repos/libs/wamr | ||
| test -d repos/libs/sqlite || git clone https://github.com/unikraft/lib-sqlite repos/libs/sqlite | ||
| test -d repos/libs/mosquitto || git clone https://github.com/unikraft/lib-mosquitto repos/libs/mosquitto |
This pr adds the Eclipse Mosquitto (Version 2.1.2) MQTT broker to the Unikraft catalog-core. Mosquitto is a lightweight message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1.
features supported
/datain the initrd,(can also configure 9pfs)related pr
testing
Builds cleanly for
qemuandfcon x86_64 and arm64 via./.scripts/build/<plat>.<arch>. Verified booting underqemu-system-x86_64with bridged networking, and bidirectional messaging from the host with
mosquitto_pub/mosquitto_sub;./test.shautomates that round trip.