Standalone Deployment
This guide covers production deployment methods for MiBee Steward on a single host, including binary, Docker, Nginx reverse proxy, backup strategy, and security hardening.
Deployment Form Selection
MiBee Steward offers several deployment forms, pick the one that fits your scenario:
| Form | Best for | Notes |
|---|---|---|
| Standalone binary | Linux servers, VMs | Direct execution, systemd management, simplest setup |
| Docker | Containerised environments, rapid deployment | GHCR prebuilt image or local build; multi-arch |
| OpenWrt router | Running directly on a router | Unlocks Tier-1 router-only discovery signals (DHCP/conntrack/hostapd/dns_log); see OpenWrt Deployment |
| Distributed | Multi-LAN / multi-site | One center + multiple agents, cross-subnet management; see Distributed Deployment |
If you have a single LAN with a manageable number of devices, standalone deployment is sufficient.
Packaging roadmap & non-goals (decision record, 2026-10-24)
Shipped: deb/rpm via nfpm (amd64/arm64/armhf, #620) and the OpenWrt ipk/apk/tar.gz family; apt/yum repositories are parked until deb/rpm see real user feedback (#621), Home Assistant add-on and Helm charts likewise wait for demand signals (#622, #623).
On-demand pool (same nfpm path, cheap to produce when a signal arrives): pacman (Arch/Manjaro; artifacts without AUR maintenance), Alpine apk (same apk-tools family as the OpenWrt 24.10+ packages but a separate repo/ABI policy; the static binary makes the artifact near-zero cost), nix flake (a separate, non-nfpm path; small audience).
Explicit non-goals: snap (a scanner needs raw sockets for ICMP/ARP; confinement fights the product), flatpak / AppImage (GUI-first formats; this is a headless server), Homebrew (macOS is not a target platform), Synology SPK / QNAP QPKG (per-vendor SDK lock-in and signing burdens for a niche that Docker on the NAS already serves).
Binary Deployment
Download
Grab the prebuilt binary for your platform (amd64/arm64) from the v0.10.0 release, or build from source. Standalone deployments use the center binary (source entry cmd/server, ~24MB, embeds the SvelteKit web UI); the agent (the Rust agent-rs/ workspace, ~4.8MB, no embedded UI) is for the OpenWrt and Distributed scenarios. Each release also ships a -full variant per arch with the optional LLDP/CDP listeners and ARP sweep compiled in (needs CAP_NET_RAW; see the build variants matrix); checksums for all center binaries are in SHA256SUMS.center:
git clone https://github.com/Mi-Bee-Studio/MiBeeSteward.git
cd mibee-steward
make build
# or cross-compile
make build-linux-amd64
Package Installation (deb / rpm)
Debian/RHEL-family hosts can skip the manual steps below entirely: every release ships native packages - mibee-steward (center) and mibee-agent (agent), each as .deb and .rpm for amd64 / arm64 / armhf (= armv7hl on the rpm side; checksums in SHA256SUMS.deb-rpm):
# Debian / Ubuntu / Armbian (apt resolves a local file; arm64 / armhf likewise)
sudo apt install ./mibee-steward_0.10.0_amd64.deb
# Fedora / RHEL / openSUSE
sudo dnf install ./mibee-steward-0.10.0-1.x86_64.rpm
First install does everything the binary deployment below does by hand: it lays down the exact same layout (binary + configs under /opt/mibee-steward, the systemd unit in /usr/lib/systemd/system/, logrotate, backup.sh), generates /opt/mibee-steward/configs/config.yaml (random jwt_secret; empty admin password - the web UI's first-run screen asks you to create it; cookie_secure: false as the plain-HTTP LAN default - flip to true behind nginx+TLS), opens + persists net.ipv4.ping_group_range for unprivileged ICMP, then enables and starts the service. The web UI is at http://<host>:8080.
Notes:
- The service runs as numeric uid/gid 1000 (the unit ships that way deliberately - see its comment); the postinst chowns
/opt/mibee-stewardto match. If uid 1000 is not the intended account on your host, override with a unit drop-in. - Upgrade = install the new package: package scripts do not actively rewrite config or data (config generation is first-install only).
apt purge/dnf removedeletes the generated config but deliberately keepsdata/. Crossing a schema boundary still requires the fresh-database procedure below; installing the package is not data migration. - Migrating a manual binary install to packages just works (the existing config stays), but remove a manually copied
/etc/systemd/system/mibee-steward.servicefirst - an/etcunit shadows the package unit forever (the postinst prints this hint too). - The agent package
mibee-agentfollows the same lifecycle with/etc/mibee/agent.yaml+ a dedicatedmibee-agentsystem user; it derivesnetwork.name/cidrfrom the default route and stays stopped until you fill incenter.url/center.auth_token(distributed.md). - Packages carry the default build only; the
-fullcapability variant stays a manual build (build variants).
Minimal Setup
# Create user and directories
sudo useradd -r -s /usr/sbin/nologin -d /opt/mibee-steward mibee
sudo mkdir -p /opt/mibee-steward/{data,data/uploads,data/backups,configs}
# Copy files
sudo cp mibee-steward /opt/mibee-steward/
sudo cp -r configs/* /opt/mibee-steward/configs/
sudo chown -R mibee:mibee /opt/mibee-steward
sudo chmod +x /opt/mibee-steward/mibee-steward
Production Configuration
sudo cp /opt/mibee-steward/configs/config.production.yaml /opt/mibee-steward/configs/config.yaml
sudo nano /opt/mibee-steward/configs/config.yaml
Critical settings:
auth:
jwt_secret: "<random-32-char>" # openssl rand -base64 32
initial_admin_password: "<strong-password>"
cookie_secure: true
cookie_same_site: "strict"
Systemd Service
sudo cp deploy/mibee-steward.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable mibee-steward
sudo systemctl start mibee-steward
The service includes security hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths=/opt/mibee-steward/data.
Docker Deployment
Prebuilt Image (GHCR)
From v0.4.0 onwards, each release publishes a multi-arch container image (amd64 / arm64) to GitHub Container Registry. Image tags cover latest, :version (e.g. 0.4.0), :major.minor (e.g. 0.4), and :commit-sha:
# Pull latest
docker pull ghcr.io/mi-bee-studio/mibeesteward:latest
# Or pin a specific version
docker pull ghcr.io/mi-bee-studio/mibeesteward:0.10.0
The prebuilt image is the unprivileged variant (LLDP/eBPF compiled as stubs). For passive probes, build from source with make docker-build-priv.
docker-compose
The following is a simplified example (the host-network equivalent). The repo's own docker-compose.yml actually ships three profiles (bridge / host / macvlan) with shared build anchors, prefer using it directly:
services:
mibee-steward:
build: .
network_mode: host # host mode for production (see below)
volumes:
- mibee-data:/data
- ./configs/config.yaml:/app/configs/config.yaml:ro
restart: unless-stopped
volumes:
mibee-data:
Network Mode Selection (Important)
MiBee Steward's scanner operates at the network-namespace level, so the container's network mode directly determines probe effectiveness. docker-compose.yml ships three profiles:
| Profile | Start command | Probe effectiveness | Use case | Limitations |
|---|---|---|---|---|
bridge (default) |
docker compose --profile bridge up |
Only TCP/SNMP/HTTP/TLS/RTSP/ONVIF reliable; ICMP and ARP/MAC discovery severely degraded | UI demo, dev | Can't see the real LAN; device MACs mostly lost |
host (recommended) |
docker compose --profile host up |
≈ bare-metal, full probe fidelity (ICMP, /proc/net/arp, multicast) |
Production | Takes host port 8080; needs cap_add: NET_RAW,NET_ADMIN |
macvlan |
docker compose --profile macvlan up |
Container gets its own LAN IP; ARP/MAC work | Container must appear as its own LAN device | Host↔container unrouted by default (needs manual macvlan shim) |
Field experience backs this up: bridge mode recovers essentially no device MACs while host networking recovers nearly all of them, always use host networking for production scanning.
⚠️ Why bridge mode can't be used for real inventory The default Docker bridge places the container behind NAT. Consequences:
- ARP/MAC broken:
/proc/net/arpinside the container only sees the bridge gateway entry; LAN device MACs are essentially unrecoverable (ARPProbe,ARPCacheSource,LookupMACPostScanall read this file).- ICMP broken: ping replies crossing NAT are often dropped, so the heartbeat's 30s active probe falsely marks LAN devices offline.
- Passive multicast broken: the bridge doesn't forward 224/239 multicast, so mDNS/SSDP listeners self-disable.
Partial workaround: list your gateway router IPs in
scanner.router_arp.routersso the scanner can SNMP-walk the router's ARP table for MACs, but this only recovers MACs, not ICMP or multicast.
Full Host-Mode Example
# 1. Prepare config
cp configs/config.docker.yaml configs/config.yaml
# Edit jwt_secret / initial_admin_password / network.cidr
# 2. Build and start (host profile)
docker compose --profile host up -d --build
# 3. Verify
curl -s http://localhost:8080/api/v1/health
To enable raw-frame LLDP listeners or the eBPF passive observer (compiled out by default), pass build tags:
BUILD_TAGS=WITH_LLDP,WITH_EBPF docker compose --profile host build
# eBPF additionally needs cap_add: BPF + NET_ADMIN, kernel >=6.6 (BTF optional);
# on systemd use deploy/mibee-steward-ebpf-dropin.example.conf instead
Building behind a restricted network:
NPM_REGISTRY=https://registry.npmmirror.com \
GOPROXY=https://goproxy.cn,direct \
docker compose --profile host build
The Makefile wraps common flows: make docker-up (host profile, recommended), make docker-up-bridge (demo), make docker-up-macvlan, make docker-build-priv (privileged variant).
Running the Prebuilt Image Directly
docker run -d --name mibee \
--network host \
--cap-add NET_RAW --cap-add NET_ADMIN \
-v mibee-data:/data \
-v "$PWD/configs/config.yaml:/app/configs/config.yaml:ro" \
ghcr.io/mi-bee-studio/mibeesteward:latest
Nginx Reverse Proxy + TLS
Place MiBee Steward behind an Nginx reverse proxy with TLS encryption and security headers:
server {
listen 80;
server_name your-domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name your-domain.com;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
add_header X-Frame-Options DENY always;
add_header X-Content-Type-Options nosniff always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
client_max_body_size 100m;
}
location /metrics {
proxy_pass http://127.0.0.1:8080;
allow 127.0.0.1;
deny all;
}
}
Enable and test:
sudo ln -s /etc/nginx/sites-available/mibee-steward /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
SSL Certificate (Let's Encrypt):
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com
# Auto-renewal: 0 12 * * * /usr/bin/certbot renew --quiet
Data & Backup
Data Location
The SQLite database lives at ./data/mibee.db (binary deployment) or /data/mibee.db inside the container (Docker deployment).
Backup Strategy
Use scripts/backup.sh for safe SQLite backups (no database locking):
# Usage: ./scripts/backup.sh [DB_PATH] [BACKUP_DIR] [RETENTION_DAYS]
# Defaults: ./data/mibee.db → ./data/backups, retain 7 days
./scripts/backup.sh
# Scheduled backup (crontab)
# 0 2 * * * /opt/mibee-steward/scripts/backup.sh /opt/mibee-steward/data/mibee.db /opt/mibee-steward/data/backups 30
The backup script automatically verifies integrity and cleans up expired backups.
Automatic Maintenance
Every retention sweep (default every 6h, retention.sweep_interval_hours) also
runs a storage-health pass: the WAL is checkpointed and truncated
(PRAGMA wal_checkpoint(TRUNCATE), folds write-ahead log pages back into the
main file so -wal returns to zero), SQLite statistics are refreshed
(PRAGMA optimize), and the on-disk sizes plus high-volume table row counts
are exported to Prometheus:
| Metric | Labels | Meaning |
|---|---|---|
mibee_db_size_bytes |
db (main/heartbeat), kind (db/wal) |
On-disk file sizes |
mibee_db_table_rows |
db, table |
Row counts of the high-volume tables |
These are the growth baseline for capacity planning and for the
db-growth alert in the self-monitoring example (see deploy/prometheus).
Ready-to-import Grafana dashboards for all exported metrics live in
deploy/grafana/, see the Integrations guide.
Capacity Planning (field-measured baseline)
Measured on a 85-device LAN with default retention windows (30d scan results, 7d heartbeat results, 14d service evidence):
- Steady state: ~150 MB total for the main database + ~4 MB heartbeat store
- Growth is dominated by
scan_results(one row per task × IP per scan; a /24 scanned every 30 min ≈ 12k rows/day) andheartbeat_results(one row per probe per tick, ~30 devices × 3 probes × 2880 ticks/day ≈ 260k rows/day, pruned at 7d) - Rule of thumb: budget ~2 MB per scanned device per month at the default
retention windows, then watch
mibee_db_size_bytes, if growth deviates from linear, checkmibee_db_table_rowsfor which table is accumulating (a stuck sweeper shows as monotonic growth on one table).
Restore
Backups are binary database files produced by sqlite3 ".backup", not SQL scripts. Restore by copying the file back:
sudo systemctl stop mibee-steward
sudo cp /path/to/backup/mibee-YYYYMMDD_HHMMSS.db /opt/mibee-steward/data/mibee.db
# remove stale WAL/SHM sidecar files so old state can't interfere
sudo rm -f /opt/mibee-steward/data/mibee.db-wal /opt/mibee-steward/data/mibee.db-shm
sudo systemctl start mibee-steward
Upgrading
v0.10.0 important upgrade note (schema v9 → v10 → v11; no in-place upgrade): when upgrading from a v0.9.x or older database, run
scripts/backup.sh, remove the old database, start with a fresh database, and rescan to repopulate it. Probe history series reset, and archive entries do not survive the rebuild; they re-accumulate as devices cycle offline. Minor upgrades within v11 still need only a binary swap. Agents should also move to 0.2.4; older agents keep reporting, but HostNet attribution, SNTP clock offset, UDP DNS retransmit, and chained compression-pointer parsing require 0.2.4.
v0.9.x → v0.10.0 schema-boundary procedure
- Stop and back up: run
scripts/backup.shand keep a separate copy ofconfigs/config.yaml. - Remove the old database: delete
data/mibee.dband any leftover-wal/-shmfiles; do not rename the backup into place as the new database. - Start v0.10.0: keep the existing config to create a fresh v11 database, then run discovery to repopulate devices.
- Restore the quality matrix: binary/systemd and Docker upgrades with a missing
probe.qualitykey now default it to on; verify the Settings → Probes switches or follow thedoctorhint. OpenWrt kept-config upgrades add the default blocks viamigrate-config.sh. - Verify: confirm devices, the probe page's Egress & Paths panel, the site matrix, and Network Center have data before re-enabling alert rules.
Binary Upgrade (within one schema)
sudo systemctl stop mibee-steward
# Replace the binary (data files are unaffected)
sudo cp mibee-steward /opt/mibee-steward/
sudo systemctl start mibee-steward
Package Upgrade (deb / rpm)
Installing the new package over the old one is the entire upgrade: prerm stops the service, postinst restarts it, config and data are kept. The data-compatibility rules below apply unchanged.
Docker Upgrade
docker compose pull # pull new image
docker compose up -d
Data compatibility: since v0.7 the schema is created fresh on first start and is not upgraded in place. A database stamped with an older schema version is rejected at startup with instructions; a v0.9 → v0.10 boundary database must be rebuilt, and so must a v0.10 → v0.11 one — a binary swap or package install alone is not enough. Within a compatible schema version, replacing the binary is all an upgrade needs. ARMv7 devices have no prebuilt release artifact, cross-compile locally with make build-linux-arm.
Crossing schema 8 → 9 (the asset-archive portfolio, #662–#669) — two things to expect after the fresh database:
- The archive learner's window restarts from deployment day. The periodic-pattern exemption (
archive.smart.*) learns fromasset_archive_events, a new table that starts empty — a device that "always comes back in November" needs to re-accumulate appearance points for ~2 months (its learned cycle) before smart exemption re-engages. Devices with a known return pattern can be protected immediately with aforce_activepin.- Ledger columns (
lifecycle_state/owner/asset_no) and tag assignments exist only from the new database onward; if the old inventory carried that data inuser_attributesor device notes, it needs re-entry — the CSV export of the old database (Devices → export) is the practical migration source.
Home Assistant add-on (#622)
The add-on source pack lives at deploy/homeassistant (copy to the standalone hassio-addons repository; the image wraps the GHCR release with an options-to-env entrypoint). host_network: true — a scanner is its LAN; state lives on /data/steward and survives updates; secrets are add-on options with secure blanks (empty master key disables the v3 vault rather than inventing a weak key; the admin password always comes from the browser first-run setup). An HA-box center covers the LANs the box bridges — multi-segment sites still want one agent per segment reporting here.
apt / yum repositories (#621, parked until demand)
The publisher is ready but manual (workflow apt-yum-repo, workflow_dispatch): it signs the release deb/rpm assets with a dedicated GPG key (secrets GPG_PRIVATE_KEY / GPG_PASSPHRASE — the private key NEVER enters the repo), builds the apt pool via reprepro and the yum tree via createrepo_c + rpmsign, and publishes apt/, yum/ and the public KEY.gpg.asc to the gh-pages branch. Without the secrets it exits with a setup notice and publishes nothing — an unsigned repository would be worse than none.
Once live, installs become:
# Debian/Ubuntu
curl -fsSL https://mi-bee-studio.github.io/MiBeeSteward/KEY.gpg.asc | sudo tee /etc/apt/keyrings/mibee.asc
echo "deb [signed-by=/etc/apt/keyrings/mibee.asc] https://mi-bee-studio.github.io/MiBeeSteward/apt stable main" | sudo tee /etc/apt/sources.list.d/mibee.list
sudo apt update && sudo apt install mibee-steward
# Fedora/RHEL (once rpm assets carry the signature)
sudo rpm --import https://mi-bee-studio.github.io/MiBeeSteward/KEY.gpg.asc
sudo dnf config-manager --add-repo https://mi-bee-studio.github.io/MiBeeSteward/yum
Home Assistant add-on (#622)
The add-on source pack lives at deploy/homeassistant (copy to the standalone hassio-addons repository; the image wraps the GHCR release with an options-to-env entrypoint). host_network: true — a scanner is its LAN; state lives on /data/steward and survives updates; secrets are add-on options with secure blanks (empty master key disables the v3 vault rather than inventing a weak key; the admin password always comes from the browser first-run setup). An HA-box center covers the LANs the box bridges — multi-segment sites still want one agent per segment reporting here.
Kubernetes / k3s (Helm, #623)
The center ships a Helm chart at deploy/helm/mibee-steward (CI-linted). Architecture is single-instance by design: state is SQLite (WAL) on a ReadWriteOnce PVC, replicas: 1 is locked, strategy is Recreate — two writers are not a topology, and more LAN coverage means more agents, not more center replicas. The pod does NOT default to hostNetwork: the intended shape is the hybrid — center in the cluster, one agent per target LAN outside it, pointed at the service/ingress URL.
Secrets never live in values: create an Opaque secret (MIBEE_AUTH_JWT_SECRET, MIBEE_SECURITY_MASTER_KEY, MIBEE_AUTH_INITIAL_ADMIN_PASSWORD) and pass --set secrets.existingName=.... Eval installs may --set secrets.create=true (random jwt, browser first-run password; master key stays unset). See deploy/helm/mibee-steward/README.md.
Resetting the admin password
Forgot the admin password? No DB surgery needed:
sudo /opt/mibee-steward/mibee-steward reset-admin-password -config /opt/mibee-steward/configs/config.yaml
# interactive prompt, or: -password 'new-pass' / env MIBEE_RESET_PASSWORD
Security Checklist
- [ ] Non-root: create a dedicated user (e.g.
mibee), never run the service as root - [ ] JWT secret: generate with
openssl rand -base64 32, never use the default - [ ] Admin password: strong password (12+ chars), enable
cookie_secureandcookie_same_site - [ ] Firewall: open only necessary ports (80/443); internal scan port 8080 not exposed externally
- [ ] Reverse proxy TLS: production must use HTTPS via Nginx or similar reverse proxy
- [ ] Metrics endpoint: allow only localhost access to
/metrics, never expose Prometheus metrics externally - [ ] Regular backups: configure cron for daily automated SQLite backups
- [ ] Log monitoring: use
journalctl -u mibee-steward -for JSON-formatted logs
Health Checks & Monitoring
# Service health
curl -s http://localhost:8080/api/v1/health
# Response: {"status":"ok","db":"ok","version":"0.x.x"}
# Prometheus metrics (localhost only)
curl -s http://localhost:8080/metrics
Key metrics: mibee_devices_total (device count), mibee_heartbeat_checks_total (heartbeat checks), mibee_heartbeat_latency_seconds (heartbeat latency).
The repo ships Prometheus alert rules (deploy/prometheus/alert_rules.yml, 5 rules):
| Rule | Trigger |
|---|---|
MiBeeStewardDown |
instance unreachable |
HighErrorRate |
5xx share >5% over 5m (from mibee_api_requests_total) |
HeartbeatFailures |
heartbeat fail/timeout share >30% over 5m (status-label filter) |
DatabaseLocked |
sustained 5xx burst caused by DB lock |
HighMemoryUsage |
resident memory >500MB |
A matching deploy/prometheus/alertmanager.yml and scrape config (with /sd service discovery) live in the same directory.
The embedded SPA provides a real-time device status dashboard, heartbeat monitoring charts, and device uptime statistics.