build: opt-out WITH_MQTT/WITH_REDIS flags + extend Redis to /status parity
- Add CMake options WITH_MQTT (default ON) and WITH_REDIS (default ON).
When OFF, the matching .cpp is dropped from the target, the pkg_check
is skipped, and MqttPublisher.h / RedisStore.h expose no-op stub
classes so every call site in Reflector.cpp / ReflectorClient.cpp /
TrunkLink.cpp keeps compiling. svxreflector.cpp's --import-conf-to-redis
is gated on WITH_REDIS. Lets sysops who don't run MQTT or Redis drop
libmosquitto-dev / libhiredis-dev from their build environment.
README.md and docs/INSTALL.md document the flags.
- Fill the gap between /status and Redis with three new event-driven
keys (all small, all using the existing 60s TTL refresh):
* live:meta — mode, version, local_prefix, listen_port, http_port,
cluster_tgs, satellite-server stats. Written at startup, on
reloadClusterTgs(), and on satellite connect/disconnect.
* live📡<sat_id> — per-satellite status blob. Written via
a new SatelliteLink::statusChanged signal on hello + on every
talker start/stop. Cleared on disconnect / cleanup.
* live:trunk:<section>.status — extended trunk hash with the full
TrunkLink::statusJson() snapshot. Written at startup, on trunk
state changes, and on config.changed-all reloads.
A dashboard can now reconstruct the equivalent of GET /status from a
handful of small Redis keys instead of one ~500 KB blob — idiomatic
Redis usage, no per-second hot-write churn.
- New Redis tests: live_meta_populated_at_startup,
live_trunk_carries_status_blob.
All four flag combinations build cleanly. 31 trunk + 10 twin + 16 redis
pass.
This commit is contained in:
1 parent
688a62ec5b
commit
bd196d6365
13 files changed
+447
-19
No files matched your search
+40
-2
@@ -11,16 +11,26 @@ plus a few config additions.
|
||||
|
||||
- A working SvxReflector installation (any recent version)
|
||||
- Build tools: `git`, `cmake` (≥ 3.7), `g++` with C++11 support
|
||||
- Development libraries (same as SvxReflector itself):
|
||||
- Development libraries:
|
||||
```bash
|
||||
# Debian/Ubuntu
|
||||
# Debian/Ubuntu — required
|
||||
sudo apt install build-essential cmake libsigc++-2.0-dev libssl-dev \
|
||||
libjsoncpp-dev libpopt-dev
|
||||
|
||||
# Required for MQTT publishing (skip if building with -DWITH_MQTT=OFF)
|
||||
sudo apt install libmosquitto-dev
|
||||
|
||||
# Required for Redis-backed config store (skip if building with -DWITH_REDIS=OFF)
|
||||
sudo apt install libhiredis-dev
|
||||
|
||||
# Optional codec support
|
||||
sudo apt install libopus-dev libgsm1-dev libspeex-dev
|
||||
```
|
||||
|
||||
The MQTT and Redis backends are enabled by default. If your deployment doesn't
|
||||
need them, see step 2 below for the opt-out CMake flags — that lets you skip
|
||||
the matching `*-dev` packages entirely.
|
||||
|
||||
---
|
||||
|
||||
## 1. Get the source
|
||||
@@ -41,6 +51,34 @@ cmake --build build
|
||||
|
||||
The compiled binary is at `build/bin/svxreflector`.
|
||||
|
||||
### Optional: build without MQTT or Redis
|
||||
|
||||
The MQTT publisher and Redis-backed config store are enabled by default. To
|
||||
build without them — for example, on a host where you don't want to install
|
||||
`libmosquitto-dev` or `libhiredis-dev` — pass the matching CMake flags:
|
||||
|
||||
```bash
|
||||
# build without MQTT support
|
||||
cmake -S src -B build -DLOCAL_STATE_DIR=/var -DWITH_MQTT=OFF
|
||||
|
||||
# build without Redis support
|
||||
cmake -S src -B build -DLOCAL_STATE_DIR=/var -DWITH_REDIS=OFF
|
||||
|
||||
# build without either
|
||||
cmake -S src -B build -DLOCAL_STATE_DIR=/var -DWITH_MQTT=OFF -DWITH_REDIS=OFF
|
||||
```
|
||||
|
||||
CMake prints which mode it picked (`-- WITH_MQTT=ON: building with libmosquitto
|
||||
support`) at configure time.
|
||||
|
||||
Behavior with the feature disabled:
|
||||
|
||||
- **`WITH_MQTT=OFF`** + `[MQTT]` section in your conf → reflector logs a
|
||||
warning and continues without publishing. Safe to leave `[MQTT]` in place.
|
||||
- **`WITH_REDIS=OFF`** + `[REDIS]` section in your conf → reflector aborts
|
||||
startup (since Redis-mode auth would not work). Remove the `[REDIS]` section
|
||||
before starting.
|
||||
|
||||
---
|
||||
|
||||
## 3. Stop the running service
|
||||
|
||||
Reference in new issue
Block a user