Skip to content

Back up and restore

At the end of this guide, a xixo deployment has a backup that has been restored at least once. The commands assume the example compose file, with the web service named xixo, the worker worker, and Postgres postgres.

What Back it up Why
xixo_production Yes The catalog: every item, note, tag, and connection, each analysis, every resource’s settings and encrypted credentials, and the vectors search uses.
xixo_production_masks Yes, with the built-in masks The built-in masks’ accounts, clients, and keys. With MASKS_ISSUER_TEMPLATE set, this database does not exist. Back up your masks server with masks instead.
ENCRYPTION_PRIMARY_KEY, ENCRYPTION_DETERMINISTIC_KEY, ENCRYPTION_KEY_DERIVATION_SALT, and SECRET_KEY_BASE Yes, apart from the dumps The first three decrypt the credentials in xixo_production. The built-in masks derives its keys from SECRET_KEY_BASE. A restore without them loses every stored credential.
The files volume Yes Uploads placed in the default storage, /data/files/xixo on xixo link beside the server.
The storage volume Yes Uploads that are still staged, waiting for a place.
xixo_production_queue, xixo_production_cache, xixo_production_cable No Jobs that have not run yet, and data rebuilt as xixo runs. Each resource syncs again at its next interval.
OpenSearch No Rebuilt from the catalog. See the search index.
Your other files Your own way The files stay in the resources they came from. Back up a folder, a bucket, or a mail server the way you already do.
  1. Dump the catalog in Postgres’s custom format:

    Terminal window
    docker compose exec -T postgres pg_dump -U postgres -Fc xixo_production > xixo-$(date +%F).dump
  2. Dump the built-in masks:

    Terminal window
    docker compose exec -T postgres pg_dump -U postgres -Fc xixo_production_masks > masks-$(date +%F).dump
  3. Copy the staged uploads out of the storage volume:

    Terminal window
    docker compose exec -T xixo tar -czf - -C /rails storage > storage-$(date +%F).tar.gz
  4. Copy the placed uploads out of the files volume:

    Terminal window
    docker compose exec -T link tar -czf - -C /data files > files-$(date +%F).tar.gz
  5. Keep every file somewhere the host does not hold, such as another machine or a bucket. Keep the keys in a password manager or a vault, apart from the dumps.

xixo keeps running during a backup. Each pg_dump reads one consistent snapshot of its database.

  1. Stop xixo and the worker, so nothing writes while the databases are replaced:

    Terminal window
    docker compose stop xixo worker
  2. Replace the catalog. The new database must belong to the xixo role, because row-level security is forced on the owner of every table:

    Terminal window
    docker compose exec -T postgres dropdb -U postgres xixo_production
    docker compose exec -T postgres createdb -U postgres -O xixo xixo_production
    docker compose exec -T postgres pg_restore -U postgres --exit-on-error -d xixo_production < xixo-2026-10-11.dump
  3. Replace the built-in masks the same way:

    Terminal window
    docker compose exec -T postgres dropdb -U postgres xixo_production_masks
    docker compose exec -T postgres createdb -U postgres -O xixo xixo_production_masks
    docker compose exec -T postgres pg_restore -U postgres --exit-on-error -d xixo_production_masks < masks-2026-10-11.dump
  4. Put the staged uploads back:

    Terminal window
    docker compose run --rm --no-deps -T --entrypoint "" xixo tar -xzf - -C /rails < storage-2026-10-11.tar.gz
  5. Put the placed uploads back:

    Terminal window
    docker compose exec -T link tar -xzf - -C /data < files-2026-10-11.tar.gz
  6. Start xixo with the same keys the backup was made with:

    Terminal window
    docker compose up -d

    The web container migrates the databases on start, so a dump from an older release is brought up to date.

  7. Check /up, then open the catalog. See health check.

OpenSearch holds nothing that the catalog does not. Every ten minutes, the recurring rebuild_search_index job checks the index. When the index is missing or out of date, the job builds a new one from the catalog, using the vectors stored in Postgres. No model embeds anything again. Search answers from the old index, or answers nothing, until the new one is ready.

To rebuild now instead of waiting:

Terminal window
docker compose exec -T worker bin/rails runner RebuildSearchIndexJob.perform_now

Restore the catalog into a scratch database, compare its count of items with the real one, and drop it:

Terminal window
docker compose exec -T postgres createdb -U postgres -O xixo xixo_restore_check
docker compose exec -T postgres pg_restore -U postgres --exit-on-error -d xixo_restore_check < xixo-2026-10-11.dump
docker compose exec -T postgres psql -U postgres -d xixo_restore_check -c "SELECT count(*) FROM feeds"
docker compose exec -T postgres psql -U postgres -d xixo_production -c "SELECT count(*) FROM feeds"
docker compose exec -T postgres dropdb -U postgres xixo_restore_check

The two counts match when the backup is whole, apart from what was added since it was made.