Appearance
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-controlSettings 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 key | Variable | Default | What it is |
|---|---|---|---|
data_dir | BS_DATA_DIR | /var/lib/bitstream | Master key, node CA, setup code, xmltv cache, backups. The installer sets /opt/bitstream/data/control. |
master_key | BS_MASTER_KEY | empty | Base64 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_file | BS_MASTER_KEY_FILE | <data_dir>/master.key | 32 byte key that encrypts secrets and backups. Created on first start. |
http.listen | BS_HTTP_LISTEN | :8080 | Admin API, client API and the panel. With tls_listen set, use port 80 here so ACME http-01 challenges work. |
http.tls_listen | BS_HTTP_TLS_LISTEN | empty | HTTPS 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_proxies | BS_HTTP_TRUSTED_PROXIES | 127.0.0.1/32,::1/128 | CIDRs whose X-Forwarded-For is believed. The client API setting trusted_proxies is added at runtime. |
http.cloudflare_proxies | BS_HTTP_CLOUDFLARE_PROXIES | Cloudflare's published ranges | CF-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_origin | BS_HTTP_SPA_ORIGIN | empty | Enables CORS with credentials when the panel is served from another origin, for example http://localhost:5173 in development. |
http.spa_origins | BS_HTTP_SPA_ORIGINS | empty | Strict 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_delay | BS_HTTP_DRAIN_DELAY | 0s | On 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_dir | BS_HTTP_SPA_DIR | empty | Serve the built panel from this folder at /. The installer sets /opt/bitstream/web. |
http.read_header_timeout | BS_HTTP_READ_HEADER_TIMEOUT | 10s | |
http.request_timeout | BS_HTTP_REQUEST_TIMEOUT | 30s | Time limit for admin API requests. Stream URLs have no limit. |
node_api.listen | BS_NODE_API_LISTEN | :8443 | Node channel (mTLS). |
node_api.hosts | BS_NODE_API_HOSTS | empty | Extra names and IPs for the 8443 certificate. localhost, 127.0.0.1 and the hostname are always in it. |
node_api.public_url | BS_NODE_API_PUBLIC_URL | empty | How 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_file | BS_NODE_API_LOCAL_JOIN_FILE | empty | Where 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.url | BS_DATABASE_URL | dev stack URL | PostgreSQL connection string. |
database.max_conns | BS_DATABASE_MAX_CONNS | 10 | Pool size. Keep it small. |
database.direct_url | BS_DATABASE_DIRECT_URL | empty | Direct connection that skips a pooler. Migrations (session advisory lock) and backups use it. Set it when url points at PgBouncer. |
database.ca_file | BS_DATABASE_CA_FILE | empty | CA bundle of a managed Postgres. Added to both URLs as sslrootcert. Use with sslmode=verify-full. |
database.exec_mode | BS_DATABASE_EXEC_MODE | empty | cache_describe behind PgBouncer in transaction pooling (no named prepared statements). Empty is fastest. |
database.pooled | BS_DATABASE_POOLED | false | url 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.addr | BS_REDIS_ADDR | localhost:16379 | The installer sets 127.0.0.1:6379. |
redis.username | BS_REDIS_USERNAME | empty | |
redis.password | BS_REDIS_PASSWORD | empty | The installer generates one. |
redis.db | BS_REDIS_DB | 0 | |
redis.tls | BS_REDIS_TLS | false | TLS to a managed Redis. |
redis.ca_file | BS_REDIS_CA_FILE | empty | Private CA for the Redis certificate (turns TLS on). |
geoip.country_db | BS_GEOIP_COUNTRY_DB | <data_dir>/geoip/country.mmdb | Country (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_db | BS_GEOIP_ASN_DB | <data_dir>/geoip/asn.mmdb | ASN database, for ISP names and ASN blocks. Updated with the country file. |
log.level | BS_LOG_LEVEL | info | debug, info, warn, error. Logs are JSON on stdout. |
media_roots | BS_MEDIA_ROOTS | /srv,/mnt,/media,/data,/opt/bitstream/media | Folders 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: secretRunning 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/distWhile 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:
| Command | What it does |
|---|---|
bs-node | Run the node. |
bs-node ffmpeg | List the ffmpeg builds found and their capabilities. |
bs-node probe <url> | ffprobe a source and print JSON. |
bs-node token -secret S -stream N | Make a play token, for tests. Also -format ts|hls, -kind, -sid, -ip, -ttl. |
bs-node dev-source -listen :9000 | Legal test source (test pattern and tone). Also -hls, -ffmpeg, -size, -bitrate, -gop. |
bs-node version | Print the version. |
The variable name is BS_ plus the YAML key in upper case.
| YAML key | Variable | Default | What it is |
|---|---|---|---|
listen | BS_LISTEN | :8090 | Plain HTTP for viewers and relays. |
listen_tls | BS_LISTEN_TLS | empty | HTTPS address, usually :8091. Needs tls_cert and tls_key. |
tls_cert, tls_key | BS_TLS_CERT, BS_TLS_KEY | empty | Certificate and key files for HTTPS. |
control_url | BS_CONTROL_URL | empty | Control node channel, for example https://panel.example.com:8443. |
public_port, public_tls_port | BS_PUBLIC_PORT, BS_PUBLIC_TLS_PORT | 0 | The 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_token | BS_JOIN_TOKEN | empty | Used once, when state_dir has no identity yet. |
join_token_file | BS_JOIN_TOKEN_FILE | empty | With 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_dir | BS_STATE_DIR | /var/lib/bitstream/node | Node identity (key, certificate, secret). The installer sets /opt/bitstream/data/node. |
hostname | BS_HOSTNAME | machine hostname | Name reported to the control. |
ffmpeg_paths | BS_FFMPEG_PATHS | empty | Extra ffmpeg binaries. |
ffmpeg_globs | BS_FFMPEG_GLOBS | /opt/bitstream/ffmpeg/*/bin/ffmpeg | Where to look for ffmpeg builds. |
work_dir | BS_WORK_DIR | /dev/shm/bitstream | Scratch files such as created channel lists. The installer sets /opt/bitstream/data/node/work. |
media_roots | BS_MEDIA_ROOTS | /srv,/mnt,/media,/data,/opt/bitstream/media | The only folders local VOD files and created channel items are read from. |
trusted_proxies | BS_TRUSTED_PROXIES | empty | CIDRs 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_ms | BS_TS_BATCH_MS | 0 (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_s | BS_TS_STALL_S | 0 (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_mb | BS_TS_QUEUE_MB | 0 (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_level | BS_LOG_LEVEL | info | Logs are JSON on stderr. |
streams_file | BS_STREAMS_FILE | empty | Standalone mode for tests: streams come from this YAML file instead of the control. Reloaded when it changes. |
node_secret | BS_NODE_SECRET | random | Standalone mode only: the secret that signs play tokens. |
dev_open | BS_DEV_OPEN | false | Standalone 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 key | Variable | Default | What it is |
|---|---|---|---|
listen | BS_LICENSE_LISTEN | :8070 | |
database_url | BS_LICENSE_DATABASE_URL | required | Its own database, bitstream_license. |
data_dir | BS_LICENSE_DATA_DIR | /opt/bitstream/data/license | Holds admin.key. |
trusted_proxies | BS_LICENSE_TRUSTED_PROXIES | empty | CIDRs 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_KEY | generated | Admin API key. Without it, one is generated into data_dir/admin.key. |
License on the control
| Where | What it does |
|---|---|
| License server | Always https://license.bitstreamott.com. It is fixed in bs-control and cannot be changed. |
BS_LICENSE_SKIP=1 | Setup finishes without a license and the panel never registers. For test labs only. See Free, with a license. |
BS_ALLOW_SHARED_HOST=1 | A 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).