When a small organization that I’m involved with wanted to move from text messages or Telegram to a more robust real-time chat platform, we had a few options. There’s Slack, of course, and Discord, but we’re geeks and wanted to look to open-source solutions. The open-source aspect was appealing for a few reasons—no corporate overloads involved, able to tweak/hack things that didn’t quite work for us, and it was a chance to explore something none of us have worked on before.
After using Matrix a bit with the organization, I realized the power of bridging, where you interlink other chat tools into the Matrix instance, and decided to create my own personal instance as well. I took two different approaches to setting up Matrix for each.
The Hard Way
Initially, I did it manually. I started a 1 GB Linode running Debian 11 and followed the instructions for installing Synapse. Additionally, since the group already had a Telegram chat, I installed the Mautrix Telegram bridge. This was a bit of work getting everything working just right. I did modify the Synapse settings to restrict new users to only those with a verified e-mail address on a particular domain and auto-add all new members to a particular room.
The positive is you really know everything going into setting up the server. The negative is it is a lot of steps for each bridge, keeping things up to date, etc.
The Simpler Way
When wanting to setup a personal server, I decided to try out the Ansible playbook. The biggest thing I noticed it that it is more resource intensive than the manual setup I had, in particular I’m running on a 2 GB Linode on Debian 11 instead, granted I ended up having a lot more running because it was just so easy to setup compared to the manual viersion.
What is nice about the Ansible playbook is that you setup everything with the proper keys, settings, etc in a config file, then the playbook automatically installs/upgrades everything. It just works.
Some notes that helped me. This particular playbook is meant to run on your own machine and it’ll SSH into the target server to run the various commands to setup everything. Additionally, you can run the commands again to reconfigure if you make changes to the config file (ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
).
Server and Clients
For both the hard and simpler way, Synapse is the server-side component for Matrix. There are other servers out there as Matrix is simply a protocol, but Synapse is the most battle-tested. For clients, you can install the client to your own server or you can use Element which is available for various device platforms or a web version. Using the https://app.element.io web version, you can still log into your own homeserver.
If you want to self-host your client as well, the Ansible playbook provides a handful of different options.
Bridging
The Ansible playbook makes adding the various bridges relatively easy compared to installing them each individually. I’ve setup my personal instance to bridge between Telegram, WhatsApp, Facebook Messages, Twitter DM, and Signal. In practice, this means that I can use Element (web, desktop, or on my mobile devices) as the single client I use for any of those systems. No matter how you message me, if it is one of the above platforms, it all is loaded in Element.
Simplified, this works by having a special room on my server to house each chat on another service. There’s a bot that interfaces both systems and passes the data between them, whether that is actual messaging or “so and so is typing…” information. It’s not 100% perfect—I’m not sure how to start a new conversation in Element with someone on a bridged tool—but I’m no longer opening 5 different apps to catch any conversation that happened while my phone was put away.
Have you tricked out Matrix?
What’s something cool that you’ve done or seen done?
Leave a Reply