Appearance
External Postgres and Redis
By default the installer puts PostgreSQL and Redis on the control server. You can use managed services instead.
Postgres
Needs PostgreSQL 14 or newer. Keep it close: above about 20 ms per round trip the panel feels slow, and the control logs a warning.
bash
sudo ./install.sh --role control \
--db-url 'postgres://bitstream:PASSWORD@db.example.com:5432/bitstream?sslmode=verify-full' \
--db-ca /etc/bitstream/pg-ca.pemsslmode=verify-fullchecks the certificate and the host name. Userequireonly if the provider gives you no CA bundle.--db-cabecomesdatabase.ca_file, added to the URL assslrootcert.
Behind PgBouncer
PgBouncer in transaction pooling cannot keep named prepared statements or session locks.
bash
--db-url 'postgres://bitstream:PW@pgbouncer.example.com:6432/bitstream?sslmode=require' \
--db-direct-url 'postgres://bitstream:PW@db.example.com:5432/bitstream?sslmode=require' \
--pgbouncer--pgbouncersetsdatabase.exec_mode=cache_describe: unnamed statements, described once per connection.--db-direct-urlis used for migrations (one advisory lock across replicas) and for backups (pg_dump,psql).- After an upgrade that changes the schema, restart every replica.
database.pooled: true(BS_DATABASE_POOLED=1) does the same as--pgbouncerfor a config you write by hand.- Only
pg_advisory_xact_lockruns through the pooler. It lasts one transaction, and the pooler keeps one server connection for the whole transaction, so it is safe. The control uses noLISTEN, no named prepared statements, no sessionSET, and its temp tables areON COMMIT DROP.
Neon
Neon gives two hosts: ep-name-123-pooler.region.aws.neon.tech (the pooler) and the same name without -pooler (direct). Pass the pooler host as --db-url and that is all: the control sees -pooler, turns on pooled mode, and runs migrations on the direct host. Turn off scale to zero for production, or the first request after a pause waits for the database to wake up.
Other managed services work the same way (Aiven, Supabase, DigitalOcean, for example). These are examples, not endorsements. Use sslmode=require at least, and keep the database in the same region as the control. See Low-cost deployment.
The test stack deploy/test/docker-compose.yml runs PgBouncer in transaction mode; go test ./internal/control/db/ runs the real query shapes through it.
Redis
Redis is on the play path: each viewer that opens a stream waits for it. Keep it in the same data center (under about 5 ms). Local Redis is the recommended choice.
bash
--redis-addr redis.example.com:6380 --redis-user bitstream --redis-password PW --redis-tls [--redis-ca /etc/bitstream/redis-ca.pem]Redis Cluster is not supported. A primary with a failover replica is fine. No persistence is needed (see Redis keys).
Check before you switch
bash
sudo -u bs-control env $(cat /opt/bitstream/etc/control.env | xargs) /opt/bitstream/bin/bs-control -checkIt prints the Postgres version, whether TLS is on, and the latency of both. The installer runs the same check and stops when a connection fails.
All of these are also YAML keys and BS_* variables, see Configuration.