Try to do the signald (0.19.0) data migration automatically

Improvement over e4caf3fa81.

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1921
development
Slavi Pantaleev 2 years ago
parent e4caf3fa81
commit a1d0b58471

@ -1,35 +1,16 @@
# 2022-07-14 # 2022-07-14
## mautrix-signal upgrade requires manual data migration ## signald (0.19.0+) upgrade requires data migration
In [Pull Request #1921](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1921) we upgraded [signald](https://signald.org/) (used by the mautrix-signal bridge) from `v0.18.5` to `v0.20.0`. In [Pull Request #1921](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1921) we upgraded [signald](https://signald.org/) (used by the mautrix-signal bridge) from `v0.18.5` to `v0.20.0`.
Back in the `v0.19.0` released of signald (which we skipped and migrated straight to `v0.20.0`), a new `--migrate-data` command had been added that migrates avatars, group images, attachments, etc., into the database (those were previously stored in the filesystem). Back in the [`v0.19.0` released of signald](https://gitlab.com/signald/signald/-/blob/main/releases/0.19.0.md) (which we skipped and migrated straight to `v0.20.0`), a new `--migrate-data` command had been added that migrates avatars, group images, attachments, etc., into the database (those were previously stored in the filesystem).
If you've been using the mautrix-signal bridge for a while, you may have files stored in the local filesystem, which will need to be upgraded using a `--migrate-data` command when you're upgrading mautrix-signal and signald. If you've been using the mautrix-signal bridge for a while, you may have files stored in the local filesystem, which will need to be upgraded.
We don't have a test setup running signald with actual data in it, so we're not sure what the best way to upgrade is. You could try the following steps: We attempt to do this data migration automatically every time Signald starts (`matrix-mautrix-signal-daemon.service`) using a `ExecStartPre` systemd unit definition.
1. Update the playbook's source code Keep an eye on your Signal bridge and let us know (in our [support room](README.md#support) or in [Pull Request #1921](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1921)) if you experience any trouble!
2. Do a full install (update), but tell Ansible to stop all services (note the `stop` tag): `ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,stop`
3. Start Postgres manually by running this **on the server**: `systemctl start matrix-postgres`
4. Run the following migration command **on the server**:
```sh
/usr/bin/env docker run --rm --name matrix-mautrix-signal-daemon \
--log-driver=none \
--user=997:1002 \
--cap-drop=ALL \
--network=matrix \
-v /matrix/mautrix-signal/signald:/signald:z \
docker.io/signald/signald:0.20.0 \
--migrate-data
```
If you're doing this upgrade in the future, you may need to adjust the Signald version in the command above to match the up-to-date value of `matrix_mautrix_signal_daemon_version`, as seen in `roles/matrix-bridge-mautrix-signal/defaults/main.yml`. As of 2022-07-14, the signald version is `v0.20.0`
5. Start all services: `ansible-playbook -i inventory/hosts setup.yml --tags=start`
6. Tell us how this upgrade went in our [support room](README.md#support) or in [Pull Request #1921](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1921)
# 2022-07-05 # 2022-07-05

@ -21,6 +21,16 @@ ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }}
# Intentional delay, so that the homeserver (we likely depend on) can manage to start. # Intentional delay, so that the homeserver (we likely depend on) can manage to start.
ExecStartPre={{ matrix_host_command_sleep }} 5 ExecStartPre={{ matrix_host_command_sleep }} 5
# Migration task required by the 0.19.0 upgrade
ExecStartPre=-{{ matrix_host_command_docker }} run --rm --name matrix-mautrix-signal-daemon \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
-v {{ matrix_mautrix_signal_daemon_path }}:/signald:z \
{{ matrix_mautrix_signal_daemon_docker_image }} \
--migrate-data
# We can't use `--read-only` for this bridge. # We can't use `--read-only` for this bridge.
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-signal-daemon \ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-signal-daemon \
--log-driver=none \ --log-driver=none \

Loading…
Cancel
Save