Skip to content

Commit 13182de

Browse files
committed
feat(library): Introduce Mosquitto 2.0.21 as library
Signed-off-by: Prasoon Kumar <prasoonkumar054@gmail.com>
1 parent d771ac6 commit 13182de

File tree

6 files changed

+1208
-0
lines changed

6 files changed

+1208
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: library/mosquitto:2.0.21
2+
3+
on:
4+
repository_dispatch:
5+
types: [core_merge, musl_merge, mosquitto_merge]
6+
7+
workflow_dispatch:
8+
9+
schedule:
10+
- cron: '0 0 * * *' # Everyday at 12AM
11+
12+
push:
13+
branches: [main]
14+
paths:
15+
- 'library/mosquitto/2.0.21/**'
16+
- '.github/workflows/library-mosquitto2.0.21.yaml'
17+
18+
pull_request:
19+
types: [opened, synchronize, reopened]
20+
branches: [main]
21+
paths:
22+
- 'library/mosquitto/2.0.21/**'
23+
- '.github/workflows/library-mosquitto2.0.21.yaml'
24+
25+
# Automatically cancel in-progress actions on the same branch
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
28+
cancel-in-progress: true
29+
30+
jobs:
31+
build:
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- plat: qemu
37+
arch: x86_64
38+
- plat: qemu
39+
arch: arm64
40+
- plat: fc
41+
arch: x86_64
42+
- plat: fc
43+
arch: arm64
44+
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Build mosquitto2.0.21
51+
uses: unikraft/kraftkit@staging
52+
with:
53+
loglevel: debug
54+
workdir: library/mosquitto/2.0.21
55+
runtimedir: /github/workspace/.kraftkit
56+
plat: ${{ matrix.plat }}
57+
arch: ${{ matrix.arch }}
58+
push: false
59+
output: oci://index.unikraft.io/unikraft.org/mosquitto:2.0.21
60+
61+
- name: Archive OCI digests
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: oci-digests-${{ matrix.arch }}-${{ matrix.plat }}
65+
path: ${{ github.workspace }}/.kraftkit/oci/digests
66+
if-no-files-found: error
67+
68+
push:
69+
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
70+
needs: [ build ]
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Login to OCI registry
77+
uses: docker/login-action@v3
78+
with:
79+
registry: index.unikraft.io
80+
username: ${{ secrets.REG_USERNAME }}
81+
password: ${{ secrets.REG_TOKEN }}
82+
83+
- name: Retrieve, merge and push OCI digests
84+
uses: ./.github/actions/merge-oci-digests
85+
with:
86+
name: index.unikraft.io/unikraft.org/mosquitto:2.0.21
87+
push: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ kraft pkg ls --apps --update
5757
| [![](https://github.com/unikraft/catalog/actions/workflows/library-mariadb11.2.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-mariadb11.2.yaml) | [`unikraft.org/mariadb:11.2`](library/mariadb/11.2) |
5858
| [![](https://github.com/unikraft/catalog/actions/workflows/library-memcached1.6.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-memcached1.6.yaml) | [`unikraft.org/memcached:1.6`](library/memcached/1.6) |
5959
| [![](https://github.com/unikraft/catalog/actions/workflows/library-mongo6.0.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-mongo6.0.yaml) | [`unikraft.org/mongo:6.0`](library/mongo/6.0) |
60+
| [![](https://github.com/unikraft/catalog/actions/workflows/library-mosquitto2.0.21.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-mosquitto2.0.21.yaml) | [`unikraft.org/mosquitto:2.0.21`](library/mosquitto/2.0.21) |
6061
| [![](https://github.com/unikraft/catalog/actions/workflows/library-nats2.10.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-nats2.10.yaml) | [`unikraft.org/nats:2.10`](library/nats/2.10) |
6162
| [![](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.15.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.15.yaml) | [`unikraft.org/nginx:1.15`](library/nginx/1.15) |
6263
| [![](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.25.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.25.yaml) | [`unikraft.org/nginx:1.25`](library/nginx/1.25) |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM eclipse-mosquitto:2.0.21 AS build
2+
FROM scratch
3+
4+
COPY --from=build /usr/sbin/mosquitto /usr/sbin/mosquitto
5+
6+
COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
7+
COPY --from=build /usr/lib/libssl.so.3 /usr/lib/libssl.so.3
8+
COPY --from=build /usr/lib/libcrypto.so.3 /usr/lib/libcrypto.so.3
9+
10+
COPY ./mosquitto.conf mosquitto.conf

library/mosquitto/2.0.21/Kraftfile

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
spec: v0.6
2+
3+
name: mosquitto
4+
5+
rootfs: ./Dockerfile
6+
7+
cmd: ["/usr/sbin/mosquitto", "-c", "mosquitto.conf"]
8+
9+
template:
10+
source: https://github.com/unikraft/app-elfloader.git
11+
version: staging
12+
13+
unikraft:
14+
source: https://github.com/unikraft/unikraft.git
15+
version: staging
16+
kconfig:
17+
# Configurations options for app-elfloader
18+
# (they can't be part of the template atm)
19+
CONFIG_APPELFLOADER_ARCH_PRCTL: 'y'
20+
CONFIG_APPELFLOADER_BRK: 'y'
21+
CONFIG_APPELFLOADER_CUSTOMAPPNAME: 'y'
22+
CONFIG_APPELFLOADER_STACK_NBPAGES: 128
23+
CONFIG_APPELFLOADER_VFSEXEC_EXECBIT: 'n'
24+
CONFIG_APPELFLOADER_VFSEXEC: 'y'
25+
CONFIG_APPELFLOADER_HFS: 'y'
26+
CONFIG_APPELFLOADER_HFS_ETCRESOLVCONF: 'y'
27+
CONFIG_APPELFLOADER_HFS_ETCHOSTS: 'y'
28+
CONFIG_APPELFLOADER_HFS_ETCHOSTNAME: 'y'
29+
CONFIG_APPELFLOADER_HFS_REPLACEEXIST: 'y'
30+
# Unikraft options
31+
CONFIG_HAVE_PAGING_DIRECTMAP: 'y'
32+
CONFIG_HAVE_PAGING: 'y'
33+
CONFIG_I8042: 'y'
34+
CONFIG_LIBDEVFS_AUTOMOUNT: 'y'
35+
CONFIG_LIBDEVFS_DEV_NULL: 'y'
36+
CONFIG_LIBDEVFS_DEV_STDOUT: 'y'
37+
CONFIG_LIBDEVFS_DEV_ZERO: 'y'
38+
CONFIG_LIBDEVFS: 'y'
39+
CONFIG_LIBPOSIX_ENVIRON_ENVP0: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
40+
CONFIG_LIBPOSIX_ENVIRON_ENVP1: "LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib"
41+
CONFIG_LIBPOSIX_ENVIRON_ENVP2: "HOME=/"
42+
CONFIG_LIBPOSIX_ENVIRON: 'y'
43+
CONFIG_LIBPOSIX_ENVIRON_LIBPARAM: 'y'
44+
CONFIG_LIBPOSIX_ENVIRON_LIBPARAM_MAXCOUNT: '64'
45+
CONFIG_LIBPOSIX_EVENTFD: 'y'
46+
CONFIG_LIBPOSIX_FDIO: 'y'
47+
CONFIG_LIBPOSIX_FDTAB: 'y'
48+
CONFIG_LIBPOSIX_FUTEX: 'y'
49+
CONFIG_LIBPOSIX_MMAP: 'y'
50+
CONFIG_LIBPOSIX_NETLINK: 'y'
51+
CONFIG_LIBPOSIX_PIPE: 'y'
52+
CONFIG_LIBPOSIX_POLL: 'y'
53+
CONFIG_LIBPOSIX_PROCESS_CLONE: 'y'
54+
CONFIG_LIBPOSIX_PROCESS_SIGNAL: 'y'
55+
CONFIG_LIBPOSIX_USER_UID: 0
56+
CONFIG_LIBPOSIX_USER_USERNAME: "root"
57+
CONFIG_LIBPOSIX_USER: 'y'
58+
CONFIG_LIBPOSIX_SOCKET: 'y'
59+
CONFIG_LIBPOSIX_SYSINFO: 'y'
60+
CONFIG_LIBPOSIX_TIME: 'y'
61+
CONFIG_LIBPOSIX_TIMERFD: 'y'
62+
CONFIG_LIBPOSIX_UNIXSOCKET: 'y'
63+
CONFIG_LIBPOSIX_USER_GID: 0
64+
CONFIG_LIBPOSIX_USER_GROUPNAME: "root"
65+
CONFIG_LIBRAMFS: 'y'
66+
CONFIG_LIBSYSCALL_SHIM_HANDLER_ULTLS: 'y'
67+
CONFIG_LIBSYSCALL_SHIM_HANDLER: 'y'
68+
CONFIG_LIBSYSCALL_SHIM_LEGACY_VERBOSE: 'y'
69+
CONFIG_LIBSYSCALL_SHIM: 'y'
70+
CONFIG_LIBUKALLOCPOOL: 'y'
71+
CONFIG_LIBUKBLKDEV_MAXNBQUEUES: '1'
72+
CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS: 'y'
73+
CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING: 'y'
74+
CONFIG_LIBUKBLKDEV: 'y'
75+
CONFIG_LIBUKBOOT_BANNER_MINIMAL: 'y'
76+
CONFIG_LIBUKBOOT_HEAP_BASE: '0x400000000'
77+
CONFIG_LIBUKBOOT_MAINTHREAD: 'y'
78+
CONFIG_LIBUKBOOT_SHUTDOWNREQ_HANDLER: 'y'
79+
CONFIG_LIBUKCPIO: 'y'
80+
CONFIG_LIBUKDEBUG_CRASH_SCREEN: 'y'
81+
CONFIG_LIBUKDEBUG_ENABLE_ASSERT: 'y'
82+
CONFIG_LIBUKDEBUG_PRINT_SRCNAME: 'n'
83+
CONFIG_LIBUKDEBUG_PRINT_TIME: 'y'
84+
CONFIG_LIBUKDEBUG_PRINTK_ERR: 'y'
85+
CONFIG_LIBUKDEBUG_PRINTK: 'y'
86+
CONFIG_LIBUKDEBUG: 'y'
87+
CONFIG_LIBUKFALLOC: 'y'
88+
CONFIG_LIBUKMPI: 'n'
89+
CONFIG_LIBUKSIGNAL: 'y'
90+
CONFIG_LIBUKRANDOM_DEVFS: 'y'
91+
CONFIG_LIBUKRANDOM: 'y'
92+
CONFIG_LIBUKRANDOM_GETRANDOM: 'y'
93+
CONFIG_LIBUKVMEM_DEFAULT_BASE: '0x0000001000000000'
94+
CONFIG_LIBUKVMEM_DEMAND_PAGE_IN_SIZE: 12
95+
CONFIG_LIBUKVMEM_PAGEFAULT_HANDLER_PRIO: 4
96+
CONFIG_LIBUKVMEM: 'y'
97+
CONFIG_LIBVFSCORE_AUTOMOUNT_CI: 'y'
98+
CONFIG_LIBVFSCORE_AUTOMOUNT_CI_EINITRD: 'y'
99+
CONFIG_LIBVFSCORE_AUTOMOUNT_UP: 'y'
100+
CONFIG_LIBVFSCORE_AUTOMOUNT: 'y'
101+
CONFIG_LIBVFSCORE_NONLARGEFILE: 'y'
102+
CONFIG_LIBVFSCORE: 'y'
103+
CONFIG_LIBUK9P: 'y'
104+
CONFIG_OPTIMIZE_DEADELIM: 'y'
105+
CONFIG_OPTIMIZE_LTO: 'y'
106+
CONFIG_PAGING: 'y'
107+
CONFIG_STACK_SIZE_PAGE_ORDER: 4 # 128 * 4K = 512K
108+
CONFIG_UKPLAT_MEMREGION_MAX_COUNT: 64
109+
CONFIG_LIBUKNETDEV_EINFO_LIBPARAM: 'y'
110+
# Debug options
111+
# CONFIG_LIBUKDEBUG_PRINTD: 'y'
112+
# CONFIG_LIBUKDEBUG_PRINTK_INFO: 'y'
113+
# CONFIG_LIBSYSCALL_SHIM_STRACE: 'y'
114+
# CONFIG_LIBSYSCALL_SHIM_DEBUG: 'y'
115+
116+
libraries:
117+
lwip:
118+
source: https://github.com/unikraft/lib-lwip.git
119+
version: staging
120+
kconfig:
121+
CONFIG_LWIP_LOOPIF: 'y'
122+
CONFIG_LWIP_UKNETDEV: 'y'
123+
CONFIG_LWIP_LOOPBACK: 'y'
124+
CONFIG_LWIP_TCP: 'y'
125+
CONFIG_LWIP_UDP: 'y'
126+
CONFIG_LWIP_RAW: 'y'
127+
CONFIG_LWIP_WND_SCALE: 'y'
128+
CONFIG_LWIP_TCP_KEEPALIVE: 'y'
129+
CONFIG_LWIP_THREADS: 'y'
130+
CONFIG_LWIP_HEAP: 'y'
131+
CONFIG_LWIP_SOCKET: 'y'
132+
CONFIG_LWIP_AUTOIFACE: 'y'
133+
CONFIG_LWIP_IPV4: 'y'
134+
CONFIG_LWIP_DHCP: 'y'
135+
CONFIG_LWIP_DNS: 'y'
136+
CONFIG_LWIP_NUM_TCPCON: 64
137+
CONFIG_LWIP_NUM_TCPLISTENERS: 64
138+
CONFIG_LWIP_ICMP: 'y'
139+
libelf:
140+
source: https://github.com/unikraft/lib-libelf.git
141+
version: staging
142+
143+
targets:
144+
- fc/x86_64
145+
- qemu/x86_64

library/mosquitto/2.0.21/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Mosquitto 2.0.21 Image
2+
3+
This directory contains the definition for the `unikraft.org/mosquitto:2.0.21` running the Eclipse Mosquitto MQTT broker.
4+
5+
## Prerequisites
6+
7+
- Install Unikraft’s CLI toolchain:
8+
```console
9+
curl -sSL https://unikraft.org/install | console
10+
```
11+
- On the host, install Mosquitto clients (`mosquitto-clients` package) to run `mosquitto_sub` / `mosquitto_pub`.
12+
13+
## Build and Run
14+
15+
1. **Build the unikernel** (from this directory):
16+
```console
17+
kraft build --no-cache --plat qemu --arch x86_64 .
18+
```
19+
2. **Run the unikernel** (as root):
20+
```console
21+
kraft run \
22+
-M 1024M \
23+
-p 1883:1883 .
24+
```
25+
26+
By default this will listen for MQTT on port `1883`.
27+
28+
## Connecting from the Host
29+
30+
With the unikernel running, open a second terminal on your host and:
31+
32+
- **Subscribe** to topic `test/topic`:
33+
34+
```console
35+
mosquitto_sub -h localhost -t 'test/topic' -v
36+
```
37+
- **Publish** a message:
38+
39+
```console
40+
mosquitto_pub -h localhost -t 'test/topic' -m 'Hello from Unikraft!'
41+
```
42+
43+
You should see your “Hello…” payload appear in the subscriber terminal.
44+
45+
## mosquitto.conf Active Settings
46+
47+
Below are the lines **uncommented** in [`mosquitto.conf`](mosquitto.conf) (all other options remain at their defaults):
48+
49+
| Setting | Value | Description |
50+
| ----------------- | -------------- | ------------------------------------------------------------ |
51+
| `user` | `root` | Run the broker as the `root` user (default if unset). |
52+
| `listener` | `1883 0.0.0.0` | Listen on TCP port **1883** on **all** interfaces (0.0.0.0). |
53+
| `allow_anonymous` | `true` | Allow clients to connect without a username/password. |
54+
55+
Any additional configuration parameters can be enabled by uncommenting and adjusting their values in [`mosquitto.conf`](mosquitto.conf).
56+
57+
## See also
58+
59+
- [Unikraft CLI: Running Unikernels Locally](https://unikraft.org/docs/cli/running)
60+
- [Mosquitto Configuration Reference (`mosquitto.conf(5)`)](https://mosquitto.org/man/mosquitto-conf-5.html)

0 commit comments

Comments
 (0)