All chapters
Deployment
Reviir is one self-contained program. The web server, the database, the listeners, the Pulse app, the video tools and the detection model are all inside the executable, so there is nothing else to install: no database server, no message broker, no runtime. You decide where it runs.
Platforms#
| Platform | Runs as | Typical use |
|---|---|---|
| Linux x64 | A systemd service | Servers, virtual machines, mini PCs |
| Linux arm64 | A systemd service | Raspberry Pi-class computers, mostly as a Reviir Edge |
| Windows x64 | A Windows service | Servers and workstations; PowerShell 7 for the installer |
| Docker (linux/amd64, linux/arm64) | A container | Hosts that already run containers; the same program, see Docker |
Installing#
Get the installer for your platform from the download page; the releases themselves come from get.reviir.com. The installers verify the release before installing anything: the channel manifest carries an ECDSA signature and every archive a SHA-256 hash. They set up the program as a service, the updater as a second service, and a versioned folder layout that makes updates and rollbacks safe.
Linux#
sudo ./install.sh # a server, from the stable channel sudo ./install.sh --role edge # a Reviir Edge sudo ./install.sh --channel beta # another release channel sudo ./install.sh --bundle /path/to/dir # offline: a folder with manifest.json, manifest.json.sig and the archive
It needs systemd, curl (unless offline), openssl, tar, python3 and sha256sum. It creates a reviir user that is a member of the serial-port group so a Zigbee dongle can be used, enables reviir (or reviir-edge) and reviir-updater, and waits for the health check. An older flat install is migrated.
Windows#
./Install-Reviir.ps1 # a server ./Install-Reviir.ps1 -Role edge # a Reviir Edge ./Install-Reviir.ps1 -Bundle D:\reviir-1.4.0 # offline
Run it in PowerShell 7 as administrator. The services are Reviir (or ReviirEdge) and ReviirUpdater. Releases are not yet code-signed for Windows, so SmartScreen may warn the first time.
Folders#
| Item | Linux | Windows |
|---|---|---|
| Releases | /opt/reviir/releases/<version>/ | C:\Program Files\Reviir\releases\<version>\ |
| Active release | /opt/reviir/current (a link) | C:\Program Files\Reviir\current (a junction) |
| Configuration | /etc/reviir/ | C:\ProgramData\Reviir\config\ |
| Data | /var/lib/reviir/ | C:\ProgramData\Reviir\data\ |
Updates replace only releases and the link. Your configuration and data are never touched. REVIIR_CONFIG_DIR and REVIIR_DATA_DIR move them elsewhere.
First start#
- Copy your public address into
AppBaseUrl(for examplehttps://reviir.example.com). Password-reset links, Pulse links and passkeys are built from it, never from the request. - Set
Registration:InvitationKeyto a long random value. Registration is closed while it is empty. - Put a TLS reverse proxy in front (next section).
- Open the site, register, and sign in. The first organisation is the system organisation (
System:AdminTenantId, 1 by default): its Owners and Admins approve updates. - Configure outbound mail (
Notifications:Smtp) if you want rule e-mails and password resets.
Put these in appsettings.Production.json in the configuration folder, or in environment variables with __ for each level (Registration__InvitationKey). Do not put secrets in the shipped appsettings.json. See Configuration.
Docker#
The official image get.reviir.com/reviir holds the same executable as the Linux release archive, for linux/amd64 and linux/arm64, on Microsoft's .NET runtime base. One image runs the server, or a Reviir Edge with the command --edge. Tags: the version (1.4.0, never moved to other bytes), and stable, beta and canary, which follow the release channels. The download page has the pull command, the image's digest, a compose file and docker load archives for a site without internet.
With Docker Compose#
curl -fsSLO https://get.reviir.com/release/latest/compose.yaml echo "REVIIR_HOST=reviir.example.com" > .env # the public name; must point at this machine mkdir config # optional: appsettings.Production.json with your secrets docker compose up -d
The compose file starts Reviir and Caddy, which obtains the TLS certificate for REVIIR_HOST and holds requests while the container restarts. It needs Docker Compose 2.23 or newer. REVIIR_VERSION in .env chooses the tag (stable by default; a version such as 1.4.0 stays on it until you change it).
| Item | In the container | Notes |
|---|---|---|
| Data | /var/lib/reviir (a volume) | Database, pictures, keys, logs and backups. Mount it on a local disk that allows running programs: ffmpeg and native libraries are unpacked into it. |
| Configuration | /etc/reviir | appsettings.Production.json and the other settings files; environment variables work as everywhere else. |
| User | id 1654, not root | The configuration folder must be readable by it. |
| Web | 5000 | Behind the proxy; set AppBaseUrl and trust the proxy's network in ForwardedHeaders:KnownNetworks (the compose file does both). |
| MQTT, SMTP | 1883, 2525 | SMTP listens on 2525 inside, so publish the host's port 25 as 25:2525. |
| SIA DC-09, Contact ID | 2000, 2001 | Off until ReviirTcp__Enabled=true; publish the ports. |
| Health | HEALTHCHECK | Reviir --probe asks /health/ready (an edge: /edge-health). |
- Updates. The container has no updater: pull a newer image and recreate the container (
docker compose pull && docker compose up -d). The database is migrated on start. Migrations only add, so the previous image still runs on the migrated data, unless a release says otherwise; an image that is too old for the database stops with exit code 3, which a restart policy repeats, so start the newer image again or restore the backup taken before. - Backups.
docker compose exec reviir /opt/reviir/Reviir --backupwrites a backup into the data volume, and the nightly backup runs as usual. To restore, stop the service and rundocker compose run --rm --no-deps reviir --restore /var/lib/reviir/backups/<folder> --yes. Copy backups off the volume: they are on the same disk as the data. - Zigbee. Pass the dongle with
devices:and add the group that owns it on the host withgroup_add:(its id, fromstat -c %g /dev/ttyUSB0); then choose its path on the Devices page. - An edge is the
edgeservice of the compose file, started withdocker compose --profile edge up -d edgeon the site's computer, with itsReviirEdgesection inedge-config/appsettings.Production.json. - Not supported: running more than one server on the same data volume, a network file system for the volume, and Kubernetes manifests (the image itself runs there, with port 2525 for SMTP and a writable
/tmp).
Network and ports#
| Port | What | Notes |
|---|---|---|
| 5000 | Web interface, Ingest API, edge links | Listens on 127.0.0.1 in the shipped service, for the reverse proxy. |
| 443 | The same, through your reverse proxy | TLS ends here. |
| 1883 | MQTT broker | Plain TCP. ReviirMqtt:Enabled. |
| 25 | SMTP receiver | Plain TCP. Needs CAP_NET_BIND_SERVICE on Linux (the unit grants it); 2525 in the container. ReviirSmtp:Enabled. |
| 2000 | SIA DC-09 | Plain TCP. ReviirTcp:Enabled, ReviirTcp:SiaPort. |
| 2001 | Contact ID | Plain TCP. ReviirTcp:CidPort. |
A listener that cannot bind its port (in use, or no permission for port 25) is reported on /health and does not stop the server.
Reverse proxy and TLS#
Put a proxy that terminates TLS in front of the web port. It is not optional in practice: the sign-in cookie is Secure, API keys require HTTPS, and browsers allow passkeys, installing Pulse, location and service workers only on HTTPS.
- A ready Caddy configuration is in
deploy/Caddyfile. It terminates TLS with automatic certificates and holds requests for up to 30 seconds while Reviir restarts, so an update is a short pause instead of an error page. - Other proxies must pass WebSocket upgrades and allow connections that stay open for hours: the interface, edge links and live video all use them.
- Set
AppBaseUrlto the public address andAllowedHoststo its host name. - The proxy on the same machine is trusted to set
X-Forwarded-Forand-Proto. A proxy on another machine must be listed inForwardedHeaders:KnownProxiesorKnownNetworks; headers from anyone else are ignored, so clients cannot spoof their address. Real client addresses matter for logs and rate limits.
Reviir Edge#
A Reviir Edge is the same program, started with --edge on a small computer at a remote site. It makes only outbound connections to your server, over WebSocket (wss when the server address is https), so nothing needs opening on the site's firewall. It is how Reviir reaches cameras, Zigbee dongles and devices on a private network.
| Job | How it works |
|---|---|
| Cameras | Pulls each camera's RTSP stream locally and sends the server the live video and snapshots. The server tells the edge each camera's address and settings after it connects. |
| Object detection and clips | Analyses snapshots on the edge when the server asks and the edge can, and keeps the clip ring locally, uploading only the clip. See Object detection. |
| Zigbee | Runs a coordinator dongle at the site and relays it to the server. |
| HTTP relay | Makes the web calls of HTTP outputs on the site's own network for the server. |
| Updates | Follows its own server, never ahead of it; by default it updates itself between 02:00 and 05:00 and waits while someone is watching a camera. |
Setting up an edge#
- On the server, create the camera (a Live Camera sensor with its RTSP URL) and generate its edge secret on its settings page. For Zigbee or an HTTP relay, create the coordinator or relay on the Devices page.
- On the edge computer, install with the edge role (see above).
- Write the connection in
appsettings.Production.jsonin the edge's configuration folder (below) and restartreviir-edge. - Open the camera in the interface: it should go from Connecting to Live.
The edge's configuration; keep only the sections you need
{
"ReviirEdge": {
"ReviirUrl": "https://reviir.example.com",
"Cameras": [
{ "Token": "<camera sensor token>", "Secret": "<edge secret>" }
],
"ZigbeeGateways": [
{ "Token": "<coordinator token>", "Secret": "<edge secret>", "SerialPort": "/dev/ttyUSB0" }
],
"HttpRelays": [
{ "Token": "<relay token>", "Secret": "<edge secret>", "AllowedHosts": [ "192.168.1.50" ] }
]
}
}- Each camera is served by one edge at a time; a second connection for the same camera is refused. The secret is sent as
X-Edge-Secretand checked in constant time before the connection opens. - Limits.
ReviirEdge:Snapshotsshapes the pictures (MaxWidth1280,JpegQuality4);ReviirEdge:Clipscaps the memory of clip rings (MaxRingMegabytes24,MaxRingSeconds60,MaxConcurrentUploads2). - When the link drops the edge reconnects by itself, waiting 2 seconds, then longer, up to 60. It does not queue events: live video is dropped while it is disconnected, only the newest snapshot is kept, and Zigbee reports during an outage are lost. The radio and the cameras keep running.
- Health. On the edge,
http://127.0.0.1:5080/edge-healthis Unhealthy when no camera has been connected for five minutes, and/edge-statusshows version, viewers and the detector. - An edge that serves only Zigbee or HTTP relays and no camera cannot yet update itself through its server; update it with the installer.
One server, many sites#
The usual shape for a service provider or a multi-site operator is one central server and an edge at each site that has cameras or devices behind NAT. Set LocalEdge:Enabled=false on a server in a data centre so it never opens RTSP streams itself; a camera with an edge secret is always left to its edge anyway. Each site's people and operators use the one server's web address. There is no replication between servers.
Running without internet#
The server and its interface run entirely without internet access: every script, style and font is bundled, and nothing phones home. Four things are worth planning for:
- Maps draw their base layer from OpenStreetMap, loaded by the viewer's browser. Offline the base map is blank; markers and zones still draw. Camera-image regions need no map.
- Updates poll a release channel on
get.reviir.com. SetUpdates:Mode=Off, pointUpdates:ManifestUrlat an internal location, or install from an offline bundle: putmanifest.json,manifest.json.sigand the archive in<DataDir>/update/inbox/. The signature is still verified. - E-mail needs an SMTP server you can reach, and password resets and rule e-mails need it.
- Clocks must agree. Encrypted DC-09 frames must be stamped within seconds of the server's time, schedules and rules use it, and an edge refuses requests past their expiry.
Storage planning#
- Pictures. At the default archive interval (every 30 seconds) a camera stores roughly 0.3 GB a day, about 10 GB over the default 30 days of retention. Every second would be about 30 times that.
- Clips. Capped by
Clips:MaxTotalGigabytes(20 by default); no new clip is started belowClips:MinFreeDiskMegabytes(2,048). - Readings and events. Small, kept 90 days by default.
- Detection uses processor time rather than storage; it is capped at half of a processor by default.
Command-line modes#
| Command | What it does |
|---|---|
Reviir | Runs the server. |
Reviir --edge | Runs a Reviir Edge: cameras, Zigbee and HTTP relays, no interface and no database. |
Reviir --updater | Runs the privileged update service. |
Reviir --backup [dir] [--include-blobs] | Writes a backup folder: the database, signing keys, Zigbee state and settings. See Operations. |
Reviir --restore <folder> [--include-blobs] [--skip-config] --yes | Puts a backup folder back while the server is stopped. The files it replaces are kept in a pre-restore-… folder; --restore --help lists the exit codes. |
Reviir --preflight | Migrates a copy of the database, health-checks, and exits. The updater uses it before switching versions. |
Reviir --version, --version-json | Prints the version, the schema level and the edge protocol. |
Reviir --probe [url] | Asks the server (or edge) on this machine for its health once and exits 0 when it is healthy: the container's health check. |