Skip to content

Backup and restore

Central has one state carrier — PostgreSQL. Which means the installation's entire backup is a regular dump of one database; neither the streamers' state directories nor the archive belong in it, and neither is needed to restore the control plane.

Take dumps

pg_dump -U optic optic > optic-$(date +%F).sql

The credentials are in DATABASE_URL from /etc/optic/secrets.env. Put it on a timer and move the copies off the machine: the dump is small (configuration and records, not media), so taking it even hourly costs nothing.

Save the /etc/optic/secrets.env file itself once, at installation time: it is not in the dump, and a restored installation will need the same passwords.

Restore

Restore procedure:

  1. Stop all central instances: run systemctl stop optic on each control machine.
  2. Recreate the database and load the dump. In this example, the optic role must own the database and have the CREATEDB privilege:
psql -U optic -d postgres -c 'DROP DATABASE optic WITH (FORCE);' -c 'CREATE DATABASE optic OWNER optic;'
psql -U optic -d optic < optic-2026-07-21.sql
  1. Start central with central.components.migrate: true: systemctl start optic. Wait until it is ready, then start the remaining instances.

Nothing else is needed: the streams, the registry and the settings came back with the dump, and the streamers — which kept broadcasting on their own all along — reconnect automatically, within the minute-long retry pause. If the dump turns out older than what the streamers have applied, they get an explicit signal from central and take its state as the truth — configuration version rollback does not disrupt the cluster.

Complete destruction of central — broadcasting never stops

This is the core guarantee of the Optic architecture: losing the entire central machine — disk, database, everything — does not interrupt broadcasting. Streamers operate autonomously, and playback continues while central is being restored.

  1. Install Optic on a new machine without entering the console.
  2. Return the saved /etc/optic/secrets.env (or put the old DATABASE_URL into the new one, if the database was external and survived).
  3. Restore the database from the dump as above, and start the service.

Streamers find the replacement central at the original address and reconnect: their keys were restored from the dump with the registry. The control plane has been restored, while broadcasting continued without interruption.

If there is no dump — the control plane is built anew: an empty central, streams created from scratch, and every orphaned streamer re-attached with a state reset and a fresh join token. Broadcasting continues in this scenario too — but the stream configuration has to be recreated by hand. One regular pg_dump spares you rebalancing the whole cluster.

What not to back up

  • Streamer state directories — they identify individual machines; after a machine is lost, join its replacement again.
  • The DVR archive — media on streamer disks; its protection depends on disks and replication, not a database dump.
  • The metrics store — held in memory; history accumulates again.