Configuration File

Configuration File

This page describes the main configuration file of Centova Cast, castd.conf, and the local configuration file of the Centova Cast web server, cc-web-local.conf. Most administrators do not need to change these files. The installer writes the correct values for a normal installation.

The files are in the etc directory of the Centova Cast installation:

  • /usr/local/centovacast/etc/castd.conf - the configuration of the Centova Cast daemon (cc-castd).
  • /usr/local/centovacast/etc/cc-web-local.conf - the ports and the hostname of the Centova Cast web server (cc-web).

CAUTION: Make a copy of a configuration file before you change it. An incorrect value can stop the control panel.

Format of castd.conf

castd.conf contains blocks. Each block has a name and a list of keys between braces ({ and }). A block can contain other blocks. Each key is on a line of its own. The value comes after the key name, separated by a space.

web-service {
    hostname "cast.example.com"
    http-port 80 2197
}

These rules apply to the values:

  • Put a text value between double quotation marks, for example "cast.example.com".
  • Write a number, true and false without quotation marks.
  • If a key has more than one value, separate the values with spaces, for example http-port 80 2197.
  • Write a time period in the named blocks as a number and a unit: s (seconds), m (minutes) or h (hours). For example, 30s is 30 seconds and 5m is 5 minutes.
  • A line that starts with // is a comment. Centova Cast ignores it.

A relative path in the file is relative to the installation directory. For example, var/run/castd/castd.sock is /usr/local/centovacast/var/run/castd/castd.sock.

The file belongs to the root user and the centovacast group. Its permissions are 0640. Keep these permissions. The file contains the cryptography key and the license key of your installation.

Note: castctl register and the installer also write to castd.conf.

Applying Changes

After you change castd.conf, tell Centova Cast to use the new values. There are two methods:

  • Reload
    Centova Cast reads the file again, and applies the new values to the parts that can change while it runs. The streams and the control panel continue. To reload, type:

    systemctl reload cc-castd
    
  • Restart
    Centova Cast stops and starts again. A restart applies all of the values in the file. To restart, type:

    systemctl restart cc-castd
    

A reload applies changes to these items: the file-server block, the binaries block, the error-reporting key, and the media block in system. For all other changes, restart cc-castd. Some parts of Centova Cast read their values only when they start, so a reload does not apply them.

If the file contains an error, a reload does not change the configuration. Centova Cast keeps the previous values, and writes a warning to its log. Make sure that the file is correct before you restart cc-castd. If the file contains an error at start time, Centova Cast does not start.

The access-control block of the api-server block always needs a restart.

After you change cc-web-local.conf, tell the web server to read the file again:

systemctl reload cc-web

The web-service Block

The web-service block configures the address of the control panel. Centova Cast uses these values to make the links to the control panel, for example in email messages and in tune-in links.

  • hostname
    Specifies the hostname of the control panel. To give the control panel more than one hostname, separate the hostnames with spaces, for example hostname "cast.example.com" "panel.example.com". Centova Cast uses the first hostname in links. This key must contain at least one hostname. The installer sets it from its --hostname option. If you change it, also change the server_name line in cc-web-local.conf.

  • tls-method
    Specifies how Centova Cast gets the TLS certificate of the control panel. The values are acme (a certificate from Let's Encrypt), self (a self-signed certificate) and custom (a certificate that you supply). For more information, see the TLS Certificates section.

  • http-port
    Specifies the HTTP ports of the control panel. Separate more than one port with spaces, for example http-port 80 2197. Centova Cast uses the first port in links. These ports must be the same as the HTTP ports in cc-web-local.conf. If this key contains 80, Centova Cast can get ACME certificates with HTTP validation. The value in the shipped file is 2197.

  • https-port
    Specifies the HTTPS ports of the control panel. Separate more than one port with spaces, for example https-port 443 2199. Centova Cast uses the first port in links. These ports must be the same as the HTTPS ports in cc-web-local.conf. If this key is empty, Centova Cast makes HTTP links only. The value in the shipped file is 2199.

  • http-proxy
    Specifies the base URL for the HTTP tune-in links that go through the stream proxy of the control panel, for example "http://proxy.example.com:8000". Centova Cast adds the path /proxy/USERNAME to this URL. If this key is not in the file, Centova Cast uses the first hostname and the first HTTP port of the control panel.

  • https-proxy
    Specifies the base URL for the HTTPS tune-in links that go through the stream proxy. If this key is not in the file, Centova Cast uses the first hostname and the first HTTPS port of the control panel.

The changes to hostname and tls-method take effect only when cc-castd starts. For the procedure, see the Changing the Certificate of the Control Panel section.

The api-server Block

The api-server block configures the internal server of the Centova Cast daemon. The web server sends the requests for the control panel and the API to this server. Do not change these keys unless Centova Technologies tells you to.

  • bind-address
    Specifies the address on which the daemon receives requests. The value in the shipped file is the UNIX socket "unix:var/run/castd/castd.sock". The web server configuration (etc/cc-web.conf) contains the same address. If you change one, you must change the other.

  • unix-socket
    Specifies the permissions (perms) and the group (group) of the UNIX socket. The values in the shipped file are 0o660 and "ccui". The web server runs in the ccui group, and must be able to open the socket.

  • access-control
    Specifies which addresses can use the parts of the daemon, and which proxies the daemon trusts (trusted-proxies). A change in this block needs a restart of cc-castd.

  • max-request-size
    Specifies the maximum size of an HTTP request, in megabytes. This size is the maximum size of a file that a user uploads through the control panel, and of a backup that a user restores. The value in the shipped file is 256.

  • max-api-request-size
    Specifies the maximum size of an API request that is not an upload, in megabytes. The default is 1.

  • private-address
    Specifies the TCP address on which the daemon receives requests from the autoDJ software of the accounts. The value in the shipped file is "127.0.0.1:2198". Use an address on the local server only.

The file-server Block

The file-server block configures the services that clients use to manage their media files without the control panel. Each service has an enable key. If enable is true, the service runs. A reload applies the changes in this block.

  • webdav
    Controls the WebDAV service. The service uses the ports of the control panel, at the URL path /dav/. The value in the shipped file is enable true.

  • s3
    Controls the S3-compatible service. The service uses the ports of the control panel, at the URL path /s3/. The value in the shipped file is enable false.

  • ftp
    Controls the FTP service. The FTP service also supports FTPS, with the certificate of the control panel. The block has these keys:

    • enable
      If true, the FTP service runs. The value in the shipped file is false.

    • bind-address
      Specifies the address and the port of the FTP service. The value in the shipped file is "0.0.0.0:2121", that is, port 2121 on all IPv4 addresses.

    • passive-port-range
      Specifies the range of ports for passive FTP connections, with the keys start and end. This block is not in the shipped file. If it is not set, the FTP service selects the ports itself. If the server has a firewall, set a range and open these ports in the firewall. For example:

      ftp {
          enable true
          bind-address "0.0.0.0:2121"
          passive-port-range {
              start 50000
              end 50100
          }
      }
      
  • sftp
    Controls the SFTP service (file transfer over SSH). The SFTP service has its own SSH server, which permits only SFTP. It does not give a shell, and it does not use or change the SSH server of the system. The block has these keys:

    • enable
      If true, the SFTP service runs. The value in the shipped file is false.

    • bind-address
      Specifies the address and the port of the SFTP service. The value in the shipped file is "0.0.0.0:2222".

If you enable the FTP or the SFTP service, make sure that the firewall of the server permits connections to its port.

The system Block

The system block contains the license, the cryptography key, and other values for the full installation.

  • license-key
    Specifies the license key of Centova Cast. The installer sets it.

  • media
    Contains the extensions key. This key specifies the file name extensions of the media files, without the dot. The media library imports only files with these extensions, and the file manager marks them as media files. Upper case and lower case are the same. The value in the shipped file is extensions mp3 ogg aac aacp wma wmv.

  • crypto
    Contains the key key. This key specifies the cryptography key of the installation, as a base64 text. The installer generates it.

    CAUTION: Do not change or remove the cryptography key. Keep it secret. Centova Cast uses it to encrypt stored data. If the key changes, Centova Cast cannot read the data that it encrypted with the old key.

  • error-reporting
    If true, Centova Cast sends a report to Centova Technologies when it finds a critical error. The report contains basic information about the server (the Linux distribution and version, the CPU, the memory use) and the details of the error. Centova Cast removes usernames, IP addresses and other personal data from the error message. Centova Cast keeps the reports in var/spool/errors/current.jsonl, and a background job sends them every few hours. To stop the reports, set this key to false. The value in the shipped file is true.

The events Block

The events block configures the monitoring of the streaming servers.

  • poller
    Configures how frequently Centova Cast asks each Shoutcast and Icecast streaming server for its status, for example the number of listeners. The block has these keys:

    • frequency
      Contains two keys. standard specifies the interval when Centova Cast can read the playlist log of the streaming server. no-playlist-log specifies the interval when there is no playlist log, and Centova Cast finds the current track through the status of the streaming server. The values in the shipped file are standard 5m and no-playlist-log 30s.

    • timeout
      Specifies the maximum time for one status request. The value in the shipped file is 8s.

  • bitrate-checker
    Configures the bit rate checker. The bit rate checker measures the bit rate of each mount point of a stream, and compares it with the bit rate limit of the account. The block has these keys:

    • bitrate-tolerance
      Specifies how much the measured bit rate can be more than the limit, as a fraction of the limit. For example, 0.08 is 8 percent. The value in the shipped file is 0.08.

    • frequency
      Specifies the interval between two checks of a stream. Centova Cast adds a random time of up to 90 percent of this interval to each check. The value in the shipped file is 30m.

    • timeout
      Specifies the maximum time for one connection of the bit rate checker. The value in the shipped file is 30s.

  • log-parser
    Configures how Centova Cast reads the playlist logs of the streaming servers. It contains the rate-limit block, which limits the number of track changes that Centova Cast accepts. Some sources send many track changes in a short time, to make an animated title in players. The rate-limit block has these keys:

    • meta-changes
      Specifies the maximum number of track changes in one period. The value in the shipped file is 3.

    • per
      Specifies the length of the period. The value in the shipped file is 15s.

    Example: With meta-changes 3 and per 15s, Centova Cast accepts at most 3 track changes in each period of 15 seconds for a stream.

The websockets Block

The websockets block configures the websocket server. The control panel uses websockets to show live information, for example the listener count.

  • channels
    Contains the state-file key. This key specifies the file in which the websocket server saves the state of its channels. The value in the shipped file is "var/lib/websocketd/cc-websocketd.state".

The workers Block

The workers block sets the number of parallel workers for some tasks. More workers make a task faster, but use more CPU, memory, disk and network capacity.

  • events
    Contains these keys:

    • poll-workers
      Specifies the number of workers that ask the streaming servers for their status. The value in the shipped file is 8.

    • bitrate-checker-workers
      Specifies the number of workers that measure the bit rates of the streams. The value in the shipped file is 4.

  • media
    Contains these keys:

    • import-workers
      Specifies the number of workers that read media files for one import job of the media library. The value must be from 1 to 20. If the value is less than 1, Centova Cast uses 3. If it is more than 20, Centova Cast uses 20. The value in the shipped file is 3.

    • album-data-workers
      Specifies the number of workers that get album information and cover images for one import job. The value must be from 1 to 64. If the value is less than 1, Centova Cast uses 3. If it is more than 64, Centova Cast uses 64. For a job that only updates the album data of the media library, the maximum is 20. The value in the shipped file is 6.

    Note that more than one import job can run at the same time. The disk is the usual limit for the import workers. The album data workers usually wait for the network. Keep these values low.

The binaries Block

The binaries block specifies the program file of each streaming server and autoDJ package. Each key is a package name: shoutcast2, icecast, mediamtx, centovasrc, liquidsoap or icescc. The value is the full path of the program.

The package installer (sbin/install) writes this block through the castctl register command. Do not change it yourself. For more information, see the castctl register section.

Note that the streaming software runs in a restricted environment. The program must be in a directory that the systemd unit file of Centova Cast permits.

The advanced Block

The advanced block contains keys that change the behavior of Centova Cast in detail. This manual does not describe these keys, with one exception: the tls.acme.dns.* keys for DNS validation. For these keys, see the DNS Validation (Wildcard Hostnames) section. Write each key on a line of its own, followed by its value:

advanced {
    session.timeout 3600
    auth.password.minlength 8
}

If a key is not in the block, Centova Cast uses its default value. Restart cc-castd after you change this block.

The cc-web-local.conf File

cc-web-local.conf contains the local settings of the Centova Cast web server. The web server is based on nginx, and the file uses the nginx syntax. Each line ends with a semicolon. A line that starts with # is a comment.

The file belongs to the root user and the ccui group. Its permissions are 0640.

  • listen
    Specifies a port on which the web server receives connections. Each port has its own listen line. A line with ssl is an HTTPS port. A line without ssl is an HTTP port. To use one address only, write ip:port instead of the port, for example 192.0.2.5:2199. Write an IPv6 address between brackets, for example [2001:db8::5]:2199. On a server with IPv6, the installer adds a [::]:port line for each port.

    The installer always configures port 2199 (HTTPS) and port 2197 (HTTP). It also configures port 443 and port 80, unless you install with the --no-webports option. A typical file contains these lines:

    listen      2199 default ssl;
    listen      443 ssl;
    listen      2197 default;
    listen      80;
    
  • set $startpagedomain
    Specifies a domain for start page URLs of the form http://USERNAME.example.com. If a request for the root path of USERNAME.example.com arrives, the web server shows the start page of the account USERNAME. For this function, configure a wildcard DNS record *.example.com that points to the server. The installer sets this value to the hostname of the control panel.

  • server_name
    Specifies the hostname of the control panel for the web server. The installer sets it. If you change hostname in the web-service block of castd.conf, also change this line.

If you change a listen line, also change http-port or https-port in the web-service block of castd.conf. Then reload cc-web and restart cc-castd.

Example: To stop the use of ports 80 and 443 for the control panel:

  1. Remove the lines listen 443 ssl; and listen 80; from cc-web-local.conf. Also remove the [::]:443 and [::]:80 lines, if they are in the file.
  2. In castd.conf, set http-port 2197 and https-port 2199.
  3. Reload the web server with systemctl reload cc-web.
  4. Restart the Centova Cast daemon with systemctl restart cc-castd.

Note that the control panel then cannot get ACME certificates with HTTP validation. For more information, see the HTTP Validation section.


Previous: Command-Line Tools
Section: Advanced