Documentation Index
Fetch the complete documentation index at: https://docs.laportenard.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Node.js 20+ on the hub machine
- Raspberry Pi 4/5 (recommended) or any ARM64/AMD64 Linux machine
- Network: Hub and terminals must be on the same LAN
- Odoo: Accessible from the hub (for token validation and event forwarding)
Option 1: Bare-metal install (systemd)
Best for dedicated Raspberry Pi deployments.Run the installer (as root)
- Checks Node.js 20+
- Creates a
pos-hubsystem user - Creates
/var/lib/pos-hub/data directory - Builds the protocol and hub packages
- Creates
/etc/pos-hub/envwith default config - Installs and starts a systemd service
Service management
Security hardening
The systemd unit includes:NoNewPrivileges=trueProtectSystem=strict(read-only root filesystem)ReadWritePaths=/var/lib/pos-hub(only writable path)ProtectHome=true,PrivateTmp=true- Runs as dedicated
pos-hubuser (no shell, no home)
Option 2: Docker
Best for testing or multi-service deployments.Build
From the repository root (notnu_pos_hub/):
Run
Docker Compose
CLI tool
Example output: pos-hub stats
Hub dashboard
Access athttp://<hub-ip>:8766/ — a self-contained HTML page with:
- Stats grid: Connected terminals, active leases, total orders, pending/forwarded events
- Terminals table: ID, device, role, last seen
- Leases table: Order reference, terminal, role, expiry
- Event log: Last 50 events with type, reference, status, timestamp
- Reset All Data button: Clears all SQLite data with confirmation
mDNS discovery
WhenHUB_MDNS_ENABLED=true (default), the hub advertises itself on the local network:
- Service type:
_pos-hub._tcp - Name: “POS Hub”
- Port: value of
HUB_HTTP_PORT
mDNS doesn’t work well in Docker. Disable it with
HUB_MDNS_ENABLED=false for container deployments.Enabling hub mode in Odoo
| Field | Value | Description |
|---|---|---|
nu_hub_enabled | True | Master switch for hub mode |
nu_hub_url | ws://10.0.0.5:8766 | Hub WebSocket URL |
nu_hub_fallback_ip | 10.0.0.5 | Fallback IP (auto-prefixed with ws:// and port 8766) |
createTransport() on the frontend.
Data persistence
| Data | Location | Survives restart |
|---|---|---|
| Hub orders, leases, events, tables | SQLite at HUB_DB_PATH | Yes |
| Terminal order state | IndexedDB (browser) | Yes |
| Terminal outbox | localStorage (browser) | Yes |
| Connected terminals (in-memory) | RAM | No (reconnect on restart) |
Monitoring checklist
| Check | How |
|---|---|
| Hub is running | systemctl status pos-hub or curl http://hub:8766/health |
| Terminals connected | Dashboard or pos-hub stats → “Terminals” count |
| Events forwarding | pos-hub stats → “Pending Forward” should be 0 or low |
| Odoo reachable | pos-hub stats → “Last Odoo Sync” should be recent |
| Disk usage | du -sh /var/lib/pos-hub/ (SQLite grows with events) |