Cookbook · 1 of 3
Develop and test
In this tutorial we run your LuCI package on throwaway OpenWrt routers in Docker, so you see it working before anyone else does. You need Docker and nothing else.
- Edit loop:
owlab sync --watchcopies your sources on every save. No rebuild. - Both release lines open side by side: 25.12 (apk) and 24.10 (opkg).
- One-command check:
owlab testexits 0 or 1. CI runs the same command.
| You want to | Go to |
|---|---|
| Get a router running | Start a router |
| See edits live | See your changes without rebuilding |
| Test on 25.12 and 24.10 | Cover both release lines |
| Fill the router with data | Make the router look inhabited |
| Run the check CI runs | The whole check in one command |
| Test a kernel module | When a kernel module is involved |
Start a router
go install owfeed.org/owlab/cmd/owlab@latest cd my-luci-app owlab up # start it owlab open owrt2512 # LuCI in your browser
Log in as root with an empty password.
The router is disposable. If you break it, run owlab up --rebuild.
See your changes without rebuilding
owlab sync --watch
owlab copies your sources into the running router on every save and reloads LuCI. You spend the day in this loop. Building a package comes later.
owlab copies the same directories luci.mk installs: htdocs,
ucode, luasrc, root. If your package lives in a
subdirectory, say so:
project:
install:
my-package/htdocs: /www
my-package/ucode: /usr/share/ucode/luci
my-package/root: /
Cover both release lines
version: 1
routers:
- id: owrt2512
release: "25.12.5"
- id: owrt2410
release: "24.10.8"
25.12 uses apk and 24.10 uses opkg. They agree on almost nothing, so a package that works on one can fail on the other. Keep both open.
snapshot images and
snapshot feeds are rebuilt daily and independently. Installs start failing within
a day. owlab releases tells you when a pin has fallen behind.Make the router look inhabited
An empty router renders almost nothing: no zone badges, no VLANs, no DHCP leases, no tables with rows in them. That is a poor place to develop a page against. Turn on the fixtures:
defaults: fixtures: [all]
Individual profiles: networks, clients, wireguard,
portforwards, system, wifi.
The whole check in one command
owlab test --release 25.12.5 --release 24.10.8 \ --install 'dist/*/luci-app-mine-*' \ --assert 'http 200 /cgi-bin/luci/admin/services/mine' \ --assert 'service mined'
The command starts the routers, installs, asserts, tears down, and exits 0 or 1.
CI runs this same command. Run it locally first, and you find out before the pull request does.
Full list of assertion kinds: Commands and config.
What it does that a hand-written curl does not
- It logs into LuCI first. Without a login, every admin page answers with a redirect. That is why the obvious check reports 403 on a perfectly healthy page.
- It fails a 200 whose body is an error page. When LuCI's dispatcher catches an exception, it returns 200 with the traceback in it.
When a kernel module is involved
routers:
- id: real
fidelity: vm
release: "25.12.5"
packages: ["+kmod-nft-nat"]
A container shares the host kernel, so kmod-* packages install and do nothing.
fidelity: vm is QEMU with OpenWrt's own kernel.
- First start: about a minute and a half. After that: twenty seconds.
- Simulated radios come with it, so the wireless pages show a router instead of a config file.