Skip to content

Updates and backups

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

Compose rebuilds both images and recreates the containers whose image changed. The web app applies database migrations when it starts. Videos that are playing stop only if the gateway itself is recreated.

Tag the running images before you rebuild:

Terminal window
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 start with the Compose project name, which is the directory name by default; docker images | grep owntube lists them. To go back, retag the saved images as latest and run docker compose up -d. Migrations only add to the database, but take a backup before a large update anyway.

Everything worth keeping is in the SQLite database in the owntube-data volume. SQLite’s online backup is safe while OwnTube runs:

Terminal window
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 a daily backup. The gateway’s volume is a cache and needs no backup.

Terminal window
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 applied to the restored copy.

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.