Skip to content

Configuration ​

Each program reads an optional YAML file and then BS_* environment variables. Environment variables win. The installer writes the environment files in /opt/bitstream/etc/ (control.env, node.env, license.env), and the systemd units load them.

After you change a file, restart the service:

bash
sudo systemctl restart bs-control

Settings that you change at runtime from the panel (streaming, client API, security and so on) are not here. They live in the database and you change them with PATCH /settings/{group} in the admin API.

bs-control ​

Flags: -config <file> (or BS_CONFIG), -version, and -check, which tests Postgres and Redis from the config, prints JSON (version, TLS, latency) and exits with 1 when one of them fails. The installer runs it before starting the service.

The variable name is BS_ plus the YAML path in upper case, joined with _. Lists are comma separated in variables. Durations use Go syntax, like 30s or 2m.

YAML keyVariableDefaultWhat it is
data_dirBS_DATA_DIR/var/lib/bitstreamMaster key, node CA, setup code, xmltv cache, backups. The installer sets /opt/bitstream/data/control.
master_keyBS_MASTER_KEYemptyBase64 of the 32 byte master key (head -c 32 /dev/urandom | base64). Wins over the file. Use it for replicas without a data dir (Docker, Kubernetes secret).
master_key_fileBS_MASTER_KEY_FILE<data_dir>/master.key32 byte key that encrypts secrets and backups. Created on first start.
http.listenBS_HTTP_LISTEN:8080Admin API, client API and the panel. With tls_listen set, use port 80 here so ACME http-01 challenges work.
http.tls_listenBS_HTTP_TLS_LISTENemptyHTTPS address, usually :443. Serves the same handler with certificates from the ACME manager, or a self-signed one until you have a certificate. Empty turns HTTPS off.
http.trusted_proxiesBS_HTTP_TRUSTED_PROXIES127.0.0.1/32,::1/128CIDRs whose X-Forwarded-For is believed. The client API setting trusted_proxies is added at runtime.
http.cloudflare_proxiesBS_HTTP_CLOUDFLARE_PROXIESCloudflare's published rangesCF-Connecting-IP is believed only from a hop in this list, never from loopback or other proxies. Set it to an empty list to turn it off.
http.spa_originBS_HTTP_SPA_ORIGINemptyEnables CORS with credentials when the panel is served from another origin, for example http://localhost:5173 in development.
http.spa_originsBS_HTTP_SPA_ORIGINSemptyStrict list of other origins allowed to call the admin API with credentials, like https://panel.example.com for a panel on Cloudflare Pages. Each must be on the same site as the API (sibling subdomains, same scheme). A listed origin on another site gets 403 cross_site_panel.
http.drain_delayBS_HTTP_DRAIN_DELAY0sOn SIGTERM, /readyz answers 503 for this long before the listeners stop, so a load balancer moves traffic first. Use 5s behind a load balancer.
http.spa_dirBS_HTTP_SPA_DIRemptyServe the built panel from this folder at /. The installer sets /opt/bitstream/web.
http.read_header_timeoutBS_HTTP_READ_HEADER_TIMEOUT10s
http.request_timeoutBS_HTTP_REQUEST_TIMEOUT30sTime limit for admin API requests. Stream URLs have no limit.
node_api.listenBS_NODE_API_LISTEN:8443Node channel (mTLS).
node_api.hostsBS_NODE_API_HOSTSemptyExtra names and IPs for the 8443 certificate. localhost, 127.0.0.1 and the hostname are always in it.
node_api.public_urlBS_NODE_API_PUBLIC_URLemptyHow nodes reach the control, for example https://panel.example.com:8443. The join command uses it. Without it, the join command uses the panel URL host (or the request host) with the node API port.
node_api.local_join_fileBS_NODE_API_LOCAL_JOIN_FILEemptyWhere the setup wizard writes a one-time join token for the bs-node on the same machine, when you pick "Use this server". The installer sets /opt/bitstream/data/join/local.token for role both. Empty means there is no local node.
database.urlBS_DATABASE_URLdev stack URLPostgreSQL connection string.
database.max_connsBS_DATABASE_MAX_CONNS10Pool size. Keep it small.
database.direct_urlBS_DATABASE_DIRECT_URLemptyDirect connection that skips a pooler. Migrations (session advisory lock) and backups use it. Set it when url points at PgBouncer.
database.ca_fileBS_DATABASE_CA_FILEemptyCA bundle of a managed Postgres. Added to both URLs as sslrootcert. Use with sslmode=verify-full.
database.exec_modeBS_DATABASE_EXEC_MODEemptycache_describe behind PgBouncer in transaction pooling (no named prepared statements). Empty is fastest.
database.pooledBS_DATABASE_POOLEDfalseurl is a transaction pooler (PgBouncer, Neon pooler, Supabase pooler). Sets exec_mode to cache_describe when it is empty. A Neon host with -pooler turns it on by itself and fills an empty direct_url with the same host without -pooler. Without a pooler, leave it off: nothing changes.
redis.addrBS_REDIS_ADDRlocalhost:16379The installer sets 127.0.0.1:6379.
redis.usernameBS_REDIS_USERNAMEempty
redis.passwordBS_REDIS_PASSWORDemptyThe installer generates one.
redis.dbBS_REDIS_DB0
redis.tlsBS_REDIS_TLSfalseTLS to a managed Redis.
redis.ca_fileBS_REDIS_CA_FILEemptyPrivate CA for the Redis certificate (turns TLS on).
geoip.country_dbBS_GEOIP_COUNTRY_DB<data_dir>/geoip/country.mmdbCountry (or city) database in MaxMind DB format, for flags, country blocks and the map. The panel downloads and updates it (see IP location).
geoip.asn_dbBS_GEOIP_ASN_DB<data_dir>/geoip/asn.mmdbASN database, for ISP names and ASN blocks. Updated with the country file.
log.levelBS_LOG_LEVELinfodebug, info, warn, error. Logs are JSON on stdout.
media_rootsBS_MEDIA_ROOTS/srv,/mnt,/media,/data,/opt/bitstream/mediaFolders that local movie and episode paths may point into. The control refuses other paths. Keep it equal to the storage nodes' media_roots. / is never accepted.

Example YAML:

yaml
data_dir: /opt/bitstream/data/control
http:
  listen: ":8080"
  spa_dir: /opt/bitstream/web
node_api:
  public_url: https://panel.example.com:8443
database:
  url: postgres://bitstream:secret@127.0.0.1:5432/bitstream?sslmode=disable
redis:
  addr: 127.0.0.1:6379
  password: secret

Running from source ​

When you run bs-control straight from a build, without the installer, set at least these variables. The defaults match the dev stack in deploy/dev/docker-compose.yml.

bash
export BS_DATA_DIR=./data/control
export BS_DATABASE_URL='postgres://bitstream:bitstream@localhost:15432/bitstream?sslmode=disable'
export BS_REDIS_ADDR=localhost:16379
export BS_REDIS_DB=0
export BS_HTTP_SPA_DIR=../web/dist

While setup is pending, every boot logs setup pending with the path of the setup.code file in BS_DATA_DIR.

If Redis is down at boot, bs-control starts anyway. The admin API works, and new client playback fails closed until Redis is back.

bs-node ​

Flags: -config <file> (default from BS_CONFIG). Subcommands:

CommandWhat it does
bs-nodeRun the node.
bs-node ffmpegList the ffmpeg builds found and their capabilities.
bs-node probe <url>ffprobe a source and print JSON.
bs-node token -secret S -stream NMake a play token, for tests. Also -format ts|hls, -kind, -sid, -ip, -ttl.
bs-node dev-source -listen :9000Legal test source (test pattern and tone). Also -hls, -ffmpeg, -size, -bitrate, -gop.
bs-node versionPrint the version.

The variable name is BS_ plus the YAML key in upper case.

YAML keyVariableDefaultWhat it is
listenBS_LISTEN:8090Plain HTTP for viewers and relays.
listen_tlsBS_LISTEN_TLSemptyHTTPS address, usually :8091. Needs tls_cert and tls_key.
tls_cert, tls_keyBS_TLS_CERT, BS_TLS_KEYemptyCertificate and key files for HTTPS.
control_urlBS_CONTROL_URLemptyControl node channel, for example https://panel.example.com:8443.
public_port, public_tls_portBS_PUBLIC_PORT, BS_PUBLIC_TLS_PORT0The ports viewers reach, when they differ from the listen ports (NAT, reverse proxy). 0 means the same as the listen port. The node reports them to the control at enrollment and on every heartbeat.
join_tokenBS_JOIN_TOKENemptyUsed once, when state_dir has no identity yet.
join_token_fileBS_JOIN_TOKEN_FILEemptyWith no identity and no join_token, the node waits for the setup wizard to write a token to this file, enrolls with it and deletes it. The installer sets /opt/bitstream/data/join/local.token for role both.
state_dirBS_STATE_DIR/var/lib/bitstream/nodeNode identity (key, certificate, secret). The installer sets /opt/bitstream/data/node.
hostnameBS_HOSTNAMEmachine hostnameName reported to the control.
ffmpeg_pathsBS_FFMPEG_PATHSemptyExtra ffmpeg binaries.
ffmpeg_globsBS_FFMPEG_GLOBS/opt/bitstream/ffmpeg/*/bin/ffmpegWhere to look for ffmpeg builds.
work_dirBS_WORK_DIR/dev/shm/bitstreamScratch files such as created channel lists. The installer sets /opt/bitstream/data/node/work.
media_rootsBS_MEDIA_ROOTS/srv,/mnt,/media,/data,/opt/bitstream/mediaThe only folders local VOD files and created channel items are read from.
trusted_proxiesBS_TRUSTED_PROXIESemptyCIDRs allowed to set X-Forwarded-For. The node also trusts the control host's addresses and its own interface addresses, for proxy delivery.
ts_batch_msBS_TS_BATCH_MS0 (200 ms)The most a live TS viewer waits so several chunks go out in one write. Fewer writes means less CPU per viewer. Negative means no wait (chunks that are already there still go out together).
ts_stall_sBS_TS_STALL_S0 (60 s)A live TS viewer is cut only when it takes no data at all for this long (end reason slow). A viewer that is behind but still reading is never cut.
ts_queue_mbBS_TS_QUEUE_MB0 (16 MB)How much one TS viewer may fall behind live. Past it the viewer jumps to the newest keyframe instead of being cut. The jumps are counted in bs_node_ts_skips_total.
log_levelBS_LOG_LEVELinfoLogs are JSON on stderr.
streams_fileBS_STREAMS_FILEemptyStandalone mode for tests: streams come from this YAML file instead of the control. Reloaded when it changes.
node_secretBS_NODE_SECRETrandomStandalone mode only: the secret that signs play tokens.
dev_openBS_DEV_OPENfalseStandalone mode only: serve /live/<id>.ts and .m3u8 without a token. Never in production.

Buffer sizes, HLS window, on-demand timeout and similar values come from the control in the node config. See the node protocol.

bs-license ​

The platform's license server. Panel owners never run it. Flags: -config <file>, -version.

YAML keyVariableDefaultWhat it is
listenBS_LICENSE_LISTEN:8070
database_urlBS_LICENSE_DATABASE_URLrequiredIts own database, bitstream_license.
data_dirBS_LICENSE_DATA_DIR/opt/bitstream/data/licenseHolds admin.key.
trusted_proxiesBS_LICENSE_TRUSTED_PROXIESemptyCIDRs of a TLS proxy in front of bs-license. From those peers the client is the rightmost untrusted X-Forwarded-For hop.
BS_LICENSE_ADMIN_KEYgeneratedAdmin API key. Without it, one is generated into data_dir/admin.key.

License on the control ​

WhereWhat it does
License serverAlways https://license.bitstreamott.com. It is fixed in bs-control and cannot be changed.
BS_LICENSE_SKIP=1Setup finishes without a license and the panel never registers. For test labs only. See Free, with a license.
BS_ALLOW_SHARED_HOST=1A second node or a panel proxy may enroll on a machine that already has one. Only a log warning. For test rigs only, never production. See One node per machine.

Build time ​

Release builds set VERSION and BS_LICENSE_URL (the license server address built into bs-control).

Bitstream documentation