Automating Cleaning Synapse Empty Rooms and Room History

I’ve been trying out the matrix protocol (code>@stevensaus:faithcollapsing.com</code), largely because of its focus on bridging between different protocols. I’ve been selfhosting a node on the network (using Synapse) because, well, I’m me. For the most part, it’s been the challenging kind of fun… at least for me.

But sometimes I’ve thought there has to be a better way – particularly when talking about documentation for how to run a Synapse node.

For example, there’s a relatively clear tutorial on cleaning up the history on your Synapse server (and compressing the database, but I’m focusing on the first bit) over on Levan’s Workshop.

But it didn’t work out of the box. And a lot of it is set up to be done by hand. For example, their explanation on how to purge "forgotten" or empty rooms suggests that you’ve got to manually cut and paste all the addresses every time.

Forget that.

So I put together this BASH script (uses CURL and jq as well) which will automatically remove rooms that have no participants and purge the history of the rooms on your server – both high volume ones more frequently than the "regular" rooms.

You can find the script (the documentation still needs some work, ironically) on GitHub at https://github.com/uriel1998/synapse-utility.

Featured Image by Michal Jarmoluk from Pixabay

One thought on “Automating Cleaning Synapse Empty Rooms and Room History

Comments are closed.