Configuration Overview
ew-npvr is configured through the AgileTV Origin configuration system using a JSON schema, aka confd.
The service monitors for configuration changes and adapts dynamically when possible.
Configuration Structure
The configuration is divided into two main sections:
- Services Configuration: Channel-level NPVR settings
- Storage Configuration: NPVR storage backend and database settings
Services Configuration
Live Ingest Channels
To enable NPVR recording for a live ingest channel, add the npvrLocation property to the channel configuration:
{
"services": {
"liveIngest": {
"channels": [
{
"name": "channel-1",
"state": "enabled",
"npvrLocation": "storage-location-1"
}
]
}
}
}
Parameters:
npvrLocation(string): Identifier for the NPVR storage location to use for this channel’s recordings. Must match a configured storage location name.name(string): Channel namestate(string): Channel state (must be configured in live ingest)
Note: The channel must already be configured in the live ingest service (ESB3003) before NPVR can record from it.
Storage Configuration
NPVR Storage Locations
Configure one or more storage locations for NPVR recordings:
{
"storage": {
"npvr": {
"locations": [
{
"name": "storage-location-1",
"basePath": "/var/storage/npvr",
"copyBehavior": "copy",
"writePacingFactor": 4
}
]
}
}
}
Parameters:
name(string, required): Unique identifier for this storage locationbasePath(string, required): Base path for NPVR storage on the filesystem- This directory must exist and be writable by the ew-npvr service
- Ensure sufficient disk space for recordings
copyBehavior(string): File copy behavior for NPVR storagecopy: Copy files (default) - safer option, works across filesystemshard-link: Create hard links instead of copying - more efficient but requires source and destination on same logical partition
writePacingFactor(integer, default4294967295= unlimited; min2, max4294967295): Paces copy-mode recording writes to N× real-time to avoid write bursts that can exhaust shared storage (NAS) bandwidth. A recording’s content for a given period is written over at leastduration / Nseconds (for example, factor4writes a minute of content in about 15 seconds). A higher value allows faster writes (less throttling); a lower value throttles more aggressively. The default4294967295means unlimited (write as fast as possible).- Only applies when
copyBehavioriscopy- hard-link copies create no bytes and are unaffected. - Mirrors the ew-cbm catch-up
writePacingFactor.
- Only applies when
Storage Layout:
Recordings are stored with the following directory structure:
<basePath>/<channelName>/<date>/<hour>/<minute>/...
Metadata is stored in:
<basePath>/<channelName>/metadata/<startTime>-<endTime>/...
Database Configuration
Configure the database connection (PostgreSQL or MySQL). A database address is required; the service refuses to start without one.
{
"storage": {
"npvr": {
"database": {
"address": "postgres://localhost:5432",
"user": "npvr_user",
"password": "secure_password",
"databaseIndex": "npvr_db"
}
}
}
}
Parameters:
address(string, required): Database address, including scheme and port, e.g.postgres://host:5432ormysql://host:3306. The scheme selects the database driver. There is no default; an empty address is treated as unconfigured.user(string): Username for database authenticationpassword(string): Password for database authenticationdatabaseIndex(string): Database name to use for NPVR
Important Notes:
A database address is required. If
addressis empty or not configured, the service refuses to start (it exits with an error rather than guessing a driver). Configurestorage.npvr.database.addressbefore starting the service.Database settings (
address,user,password,databaseIndex) are read only at service startup. Changing any of them throughconfdupdates the stored configuration but does not reconnect the running service; the new settings take effect only after the service is restarted (systemctl restart ew-npvr).If the address is configured but the database is unreachable, the service still starts but runs in a degraded mode: it logs the connection error and continues, with the management API unavailable (no ability to create, update, or delete recordings via the API).
PostgreSQL and MySQL are supported. To use MySQL, specify the scheme
mysqlfor database address, for example:
confcli storage.npvr.database.address mysql://db.example.com:3306
Similarly, with PostgreSQL:
confcli storage.npvr.database.address postgres://db.example.com:5432
Log Level Configuration
Configure the logging verbosity:
{
"storage": {
"npvr": {
"logLevel": "info"
}
}
}
Log Levels:
trace: Most verbose, includes all debug informationdebug: Debug-level messagesinfo: Informational messages (default, recommended for production)warn: Warning messages onlyerror: Error messages onlyfatal: Fatal errors onlypanic: Panic-level errors
Important: The log level can be changed dynamically and will take effect immediately without restarting the service.
Complete Configuration Example
{
"services": {
"liveIngest": {
"channels": [
{
"name": "channel-1",
"state": "enabled",
"npvrLocation": "primary-storage"
},
{
"name": "channel-2",
"state": "enabled",
"npvrLocation": "primary-storage"
},
{
"name": "premium-channel",
"state": "enabled",
"npvrLocation": "backup-storage"
}
]
}
},
"storage": {
"npvr": {
"logLevel": "info",
"locations": [
{
"name": "primary-storage",
"basePath": "/mnt/npvr/storage1",
"copyBehavior": "copy"
},
{
"name": "backup-storage",
"basePath": "/mnt/npvr/storage2",
"copyBehavior": "hard-link"
}
],
"database": {
"address": "postgresql://db.example.com:5432",
"user": "npvr_service",
"password": "secret_password",
"databaseIndex": "npvr_production"
}
}
}
}
Dynamic Configuration Updates
The service monitors configuration changes and applies them dynamically when possible:
- Log Level: Applied immediately without restart
- Storage Locations: Applied immediately without restart
- Database Settings: Requires restart to take effect
- Channel NPVR Locations: Applied immediately when channels are updated
Troubleshooting Configuration
Common configuration issues:
- Service exits immediately on start: The database
addressis empty or not configured. Setstorage.npvr.database.address(including scheme and port) and restart. - Database connection fails: Address is configured but the database is unreachable - service continues in degraded mode (no management API); check logs for connection errors.
- Storage path not writable: Check file permissions and disk space
- Hard-link fails: Verify source and destination are on same filesystem, or use
copyinstead