Upgrading a Matrix server to 0.34.1 and later

Ecrit le 27/01/2019

After some discussion in one of the bix Matrix rooms (the server has managed to survive, go know how), I decided to put my hands in and go on adventure in uncharted waters. I thought that the upgrade would be much complicated that it has been.

One thing that the 0.34.1 brings is the splitting of the package matrix-synapse in many optionnal dependencies. It’s not that bad because you avoid some overhead but I didn’t know how to upgrade with an existing setup and all the data on a PostgreSQL database.

The full backup

Before upgrading, I stopped the Matrix server and then have a full server backup done. In case something goes wrong, I’d like to return to a known working state.


Before proceeding

Before writing this post, I tried keeping the current install, without success. Furthermore, Python 2.7 will reach end of life on January 1st 2020 and pip will drop support for this version. It was a good occasion to run the Matrix server on a newer version of Python.

In case something goes wrong, I advise keeping the old virtual environment by renaming it.

To reassure some people, the configuration files will not be affected because they are in a separate directory.

How to do it ?

irst, we have to create a new virtual environment which will run Python 3.7 for me with the following command: python3.7 -m virtualenv synapse. After the creation of the environment, we have to activate it with source synapse/bin/activate. Then, install the package which enables the Synapse server to work and some optionnal functions. I installed the PostgreSQL support and the URL previews: pip install matrix-synapse[postgres,url_preview]. The values between the square brackets come from the release page of Synapse 0.34.1. If it suits you, you can install everything with [all].

After the update

Nothing more complicated. Changing into the directory of the server configs and starting it with synctl start to see if the upgrade has been properly applied. If the server is alive, you can start it how you want to start it. On my side, I stopped the server and started the Systemd service. anticipé


In the end, it has been much less complicated than I have anticipated. It’s a server reinstall on another Python version.