matrix-docker-ansible-deploy/docs/importing-synapse-sqlite.md
Slavi Pantaleev 8ef23a655d Restore --tags=import-synapse-sqlite-db support
Fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2669

Removed in 04b9483f0d (2022-11-28) when switching from matrix-postgres to
the devture-postgres external Ansible role.
More details: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md#matrix-postgres-has-been-replaced-by-the-comdevtureansiblerolepostgres-external-role

The `import_synapse_sqlite_db.yml` file and documentation has been adapted somewhat compared to before, so that:

- it doesn't try to start Postgres automatically. You need to handle
  this part manually
- it doesn't rely on the integrated Postgres and may potentially work
  with external Postgres instances just the same
- it doesn't wipe out the whole database anymore. By default, we assume
  it's empty anyway and there's no need for such things. If it's not,
  then it's also probably dangerous to be so destructive.

This is all completely untested, but will hopefully work.
2023-05-02 13:34:42 +03:00

2.1 KiB

Importing an existing SQLite database from another Synapse installation (optional)

Run this if you'd like to import your database from a previous default installation of Synapse. (don't forget to import your media_store files as well - see the importing-synapse-media-store guide).

While this playbook only supports running Synapse in combination with PostgreSQL, a Synapse instance installed manually usually defaults to using an SQLite database.

If you have such a Synapse setup and wish to migrate it to one managed by the playbook (and over to PostgreSQL), this documentation page is for you.

Prerequisites

Before doing the actual import:

  • ensure you have NOT started Synapse yet. That is, make sure you have followed the Installing step, but haven't run the playbook's start tag yet. If you had started your new Synapse instance, it may have already initialized your Postgres database and importing onto it may not work. In such cases, you may need to clean up the synapse database first.
  • ensure you have uploaded your SQLite database file to the server (any path is okay)
  • if you're using the integrated Postgres server (by default, you are using it, unless you've explicitly switched to Using an external PostgreSQL server), make sure Postgres is started by running just start-group postgres

Importing

Run this command (make sure to replace <server-path-to-homeserver.db> with a file path on your server):

just run-tags import-synapse-sqlite-db --extra-vars=server_path_homeserver_db=<server-path-to-homeserver.db>

Notes:

  • <server-path-to-homeserver.db> must be replaced with a file path to a homeserver.db file on the server (not on your local machine!).
  • if the SQLite database is from an older version of Synapse, the importing procedure may run migrations on it to bring it up to date. That is, your SQLite database file may get modified and become unusable with your older Synapse version. Keeping a copy of the original is probably wise.