This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Configuration

Configuring ew-npvr

    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:

    1. Services Configuration: Channel-level NPVR settings
    2. 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 name
    • state (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"
            }
          ]
        }
      }
    }
    

    Parameters:

    • name (string, required): Unique identifier for this storage location
    • basePath (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 storage
      • copy: Copy files (default) - safer option, works across filesystems
      • hard-link: Create hard links instead of copying - more efficient but requires source and destination on same logical partition

    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 PostgreSQL database connection:

    {
      "storage": {
        "npvr": {
          "database": {
            "address": "postgres://localhost:5432",
            "user": "npvr_user",
            "password": "secure_password",
            "databaseIndex": "npvr_db"
          }
        }
      }
    }
    

    Parameters:

    • address (string): Database address including port (default: “localhost”)
    • user (string): Username for database authentication
    • password (string): Password for database authentication
    • databaseIndex (string): Database name to use for NPVR

    Important Notes:

    • External database configuration is optional

    • If database connection fails, the service will log a warning but continue running

    • Without database:

      • Management API will not be available
      • Media API will still function for streaming existing content
      • No ability to create, update, or delete recordings via API
    • PostgreSQL and MySQL are supported. To use MySQL, specify the scheme mysql for 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 information
    • debug: Debug-level messages
    • info: Informational messages (default, recommended for production)
    • warn: Warning messages only
    • error: Error messages only
    • fatal: Fatal errors only
    • panic: 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:

    1. Database connection fails: Service will continue in degraded mode - check logs for connection errors
    2. Storage path not writable: Check file permissions and disk space
    3. Hard-link fails: Verify source and destination are on same filesystem, or use copy instead