OwnTube

Updates and backups

Updating means pulling the code and rebuilding the images. Database migrations run automatically when the web app starts.

Update

cd owntube
git pull
docker compose up -d --build

Compose rebuilds both images and recreates the containers whose image changed. Running streams on the gateway are cut only when the gateway itself is recreated.

Keep a way back

Tag the current images before rebuilding, so you can return to them if an update misbehaves:

rev=$(git rev-parse --short HEAD)
docker tag owntube-app:latest owntube-app:pre-$rev
docker tag owntube-gateway:latest owntube-gateway:pre-$rev

Image names follow the Compose project name, by default the directory name; docker images | grep owntube lists them. To go back, check out the previous commit and run docker compose up -d --build, or retag the saved images as latest and run docker compose up -d. Migrations only add to the database, but take a backup before large updates anyway.

Back up

Everything that matters is in the SQLite database in the owntube-data volume. Copy it with SQLite's online backup, which is safe while OwnTube runs:

docker compose exec app node -e "
  const Database = require('better-sqlite3');
  new Database(process.env.DATABASE_PATH).backup('/app/apps/web/data/backup.db')
    .then(() => console.log('ok'));
"
docker compose cp app:/app/apps/web/data/backup.db ./owntube-$(date +%F).db

Run it from cron for daily backups. The gateway's volume is a cache and needs no backup.

Restore

docker compose stop app
docker compose run --rm --no-deps app \
  rm -f /app/apps/web/data/owntube.db-wal /app/apps/web/data/owntube.db-shm
docker compose cp ./owntube-2026-11-27.db app:/app/apps/web/data/owntube.db
docker compose start app

The database runs in WAL mode; removing the old -wal and -shm files keeps them from being replayed onto the restored copy.

Move to another server

Restore a backup on the new server and copy .env along with it. With the same AUTH_SECRET nobody has to sign in again; paired TVs and iPhones keep working once the address they use points to the new server.