Appearance
Recommended architecture
Bitstream runs on one server or on many. This page says what to put where, and why. Every option has a how-to; the defaults are the safe choice.
The parts
| Part | What it does | Where it can run |
|---|---|---|
bs-control | Panel API, client API (player_api, get.php, xmltv), node channel. Never runs ffmpeg. | One server, or several replicas behind a load balancer. |
| Panel (SPA) | The web interface. Static files. | Served by bs-control (default) or a static host like Cloudflare Pages. |
| PostgreSQL | Source of truth. | Same server (default) or a managed service. |
| Redis | Live state: connection slots, sessions, node stats. It is on the play path: every viewer waits for it. | Same server (recommended) or a managed service close to the control. |
bs-node | Pulls sources, delivers streams. | Its own machines. Never in Kubernetes (see below). |
bs-edge (panel proxy) | Sits between Cloudflare and the control so the control IP is never published. API traffic only, no video. | Two or more of the cheapest VPS you can find, ideally at different providers. |
Three sizes
Small: one server
sudo ./install.sh --role both # test lab onlyControl, node, Postgres and Redis on one machine. Good to learn and to test. Not for paying customers: a traffic spike on the node slows the panel, and one disk failure takes everything.
Medium: control plus nodes (recommended start)
sudo ./install.sh --role control # main server
sudo ./install.sh --node --join <token> --control https://api.example.com:8443 # each nodeOne control server with local Postgres and Redis, and one or more node servers. This is the default we recommend. Back up the control with the built-in backups.
Large: replicas and managed services
- 2 or more
bs-controlreplicas behind a load balancer (Docker Compose, plain VMs, or Kubernetes with the optional Helm chart). - Managed PostgreSQL (TLS, optionally behind PgBouncer) and Redis in the same region as the control. Keep Postgres under about 20 ms and Redis under about 5 ms from the control.
- The panel on Cloudflare Pages.
- Nodes on their own machines, as always.
See Several control replicas, External Postgres and Redis and Panel on Cloudflare Pages.
On a budget? Low-cost deployment shows where each part can live for little money, and what does not work.
Domains plan
Use different registrable domains for admin and for clients. If a client domain is blocked by an ISP or attacked, the panel stays up, and resellers never learn your admin address.
| Role | Example | Cloudflare proxy |
|---|---|---|
| Admin panel | painel.mybrand-admin.com | On |
| Admin API | same host, or api.mybrand-admin.com with the panel on Pages | On |
| Reseller panel (optional) | revenda.mybrand-tv.com | On |
| Client API (apps) | tv.mybrand-tv.com | On |
| Streaming (each node) | edge1.mybrand-cdn.com | Off |
- Minimum: 2 registrable domains, admin and clients plus streaming.
- Ideal: 3, admin, client API and streaming.
- Streaming stays DNS only: long streams break behind the proxy and it is against Cloudflare's terms.
The setup wizard has a Domains step, and Settings, Domains keeps the plan, checks DNS and creates the records through the Cloudflare integration. It warns about layouts that work but are risky (admin and clients on one domain, streaming behind the proxy, the reseller panel on the admin domain). It only refuses what cannot work: a panel and its API on different sites, because the login cookie would not be sent.
Once a plan is saved, bs-control routes by host name:
- the admin API answers only on the admin and reseller hosts;
- the client API does not answer on admin hosts (a setting turns it back on for old apps);
- the panel is not served on the client API host;
- IP addresses and
localhostare never restricted, so you can always get in.
Hide the control behind panel proxies
Recommended once the panel is public. Put two panel proxies in front of the control, let the panel manage the DNS record, then turn on Accept only from proxies. The control IP then never shows up in DNS, and the control answers no one but the proxies, the nodes and the database. A proxy that gets attacked is replaced in a minute. See Why panel proxies and Add or replace a panel proxy.
Panel and API on two hosts
When the panel is on Pages, the panel and the API must be on the same site: subdomains of one registrable domain, with the same scheme. panel.example.com and api.example.com work. panel.pages.dev and api.example.com do not: the refresh cookie is SameSite=Strict and host only, so the browser would drop it and you would be signed out on every reload. The control refuses such an origin with cross_site_panel instead of failing quietly.
Why nodes do not run in Kubernetes
- Networking. A node serves thousands of long TCP connections on its public IP. Kubernetes Services and ingress add NAT hops and connection tracking, and hide the client IP the play token is bound to. Host networking undoes most of what Kubernetes gives you.
- Kernel tuning. Nodes need large accept queues, socket buffers and BBR (
bs-node tune). Most of these sysctls are node wide and not allowed per pod. - Disk. Timeshift and VOD need large, fast local disks that stay with the machine.
- NIC. Throughput is the product. One node per machine, sized for its network card, is easier to reason about than pods sharing a NIC.
The control is a plain stateless web app and fits Kubernetes well. Nodes fit plain servers.