torstai 27. toukokuuta 2021

Matrix tips they don't tell you

 This is a random combination of FAQ and guides about Matrix. Mostly for my own notes but these might be useful for others.


FAQ

 

1. Why is this in blogger.com? This is ugly

 

Yes. Going to move it somewhere on fediverse soon.


2. Matrix is slow or not working properly. I'm on matrix.org homeserver


Matrix.org is used as default server in many clients. It is known to be slow occasionally. You should pick a server you like from list of public servers and register there. If you already have joined many rooms, you can use migration tool to "copy" your old account to the new account.
 
After finished, remember to leave all rooms with your matrix.org account so it won't use any resources on the already overloaded server. You can login to both accounts simultaneously with private browser windows.

This also helps decentralize Matrix which is important for the whole ecosystem.

3. Synapse is slow. I'm running sqlite database

 

The documentation should be more clear: sqlite is only for testing and development servers and not suitable for production use. You must migrate to PostgreSQL using this script.

If you have further problems, join Synapse Admins room and describe your problem.

4. I'm confused about Matrix terminology


It's a complex beast. Here is a short list of what is what:

  • Matrix = Protocol and ecosystem around it. You cannot "run Matrix" or have an "account on Matrix". Often mixed with matrix.org.
  • Homeserver = A Matrix server. There are lot of public ones or you can set up your own. You create user account on a homeserver you choose.
  • matrix.org = One of many public Matrix homeservers where you can make an account. Often mixed with Matrix.
  • Element = One of many Matrix client applications. Has different Web/Desktop/Android/iOS versions, so always specify which you use when asking for help.
  • Synapse = One of many Matrix server implementations. You can run Synapse on your server if you want your own Matrix homeserver.
  • Room = Called channel in some other messengers. Contains users that are in the room and the message contents. Rooms can also have topic, logo (room avatar), and widgets (small web pages such as calendar, webcam, weather etc).
  • Space = Group of rooms and other spaces. Can be used to organize rooms. A bit like Discord guilds or Slack workspaces, but more flexible.
  • Community = Old way of grouping rooms that was never fully implemented. Replaced by spaces. Do not use.

5. I'm running Element Android but notifications are unreliable. I installed it from F-Droid.


Unfortunatly F-Droid version doesn't have the google push notification support and there is no open alternative available. Better install from Google Play. 
 
Note: Unifiedpush support is in progress, you may want to follow this pull request if interested.


6. I'm running Element Android and a message is stuck in the bottom of the screen. I can't get rid of it.


Open Element Settings / General and press "Clear Cache". This is a long standing bug, I hope it gets fixed one day.


7. My Synapse is not working

  • Check that you are running the latest version. If you use debian packages, you should use the matrix.org repository. Distro packages may be old.
  • If it doesn't start at all, check that your homeserver.yaml is correctly formatted. Yaml files are quite strict about it.
  • Use federation tester to test for any federation errors. It understands delegation so give it your server name (server.org instead of matrix.server.org).
  • Check Synapse log file for any errors .
  • Check your reverse proxy log file for any errors.
If you still can't figure out the issue, come to Synapse admins room and seek for help.

8. Isn't matrix.org the main Matrix server?

It is common misconception that matrix.org is the "main" Matrix server. This is incorrect. Matrix.org is just one (large) homeserver and has no special powers in the federation. Matrix.org staff cannot ban anyone on other servers or give admins on rooms for users who don't have them. This is a conscious decision to keep Matrix decentralized.

Matrix.org is used as default server for registration in some clients, notably Element. Users are encouraged to register on other servers if possible. See FAQ 2.

Matrix.org has been offline on two occasions in history and Matrix federation kept working without issues for everyone else.

Getting rid of freenode bridge

 (If you spot errors in this process, come to #irc:matrix.org and let me know!)

 
So you have a community that has traditionally been on freenode and now due to recent events want to disconnect it to go full Matrix or bridge to another IRC network? Get admin power in the same process? Here's how:
 
This guide assumes you use Element Web or Desktop as client.

Unbridge

 

  • Make sure you have moderator in the room (op on IRC side)
  • Remove any aliases you have created for the room and set topic to tell people it's migrated.
  • Open integrations manager, existing integrations / IRC
  • Press unlink. Bridge should go down (this has reported to be slow sometimes)

Note: Make sure the IRC bridge is really unlinked. IRC users and the appservice bot should leave. It has been reported this does not always happen.


If you can't unbridge, seek help and wait. Do not create a tombstone - the bridge will follow and FUBAR your new room.


Create a new room 


Create a new room. Make sure it's not encrypted. Go to Room settings / Advanced and copy-paste the Internal room ID somewhere. Add the alias(es) you removed to this room. Set other room settings to your liking and don't forget a nice room icon picture.


Create tombstone 


This will move all Matrix users in the old room to the new room. Note: Do NOT use /upgraderoom instead, as IRC bridge will follow it and FUBAR the new room.
 
Go back to the old room. 
  • Type /devtools. 
  • Select "Create custom event"
  • Press red "Event" button to change to "State event"
  • Set event type to "m.room.tombstone"
  • In event content enter (you'll need the target room ID  now):
{
  "body": "This room has been replaced by new one",
  "replacement_room": "!target_room_id:server.org"
}
 
  • Press "Send"












Hooray! Users in the old room should now come to the new room. Your new room is also the latest version. If the IRC bridge automatically follows, you can kick it. Give admins and  mods to people you trust when they join.


Bridging a room to libera.chat

  • Make sure you have unencrypted public room and you have admin power in it
  • Make sure you (or an assistant) are on IRC side and have op status in the channel.
  • Click "Edit widgets, bridges & bots"
  • Click Bridges / IRC
  • Select network "Liberachat"
  • Enter channel name, nick of operator (you or assistant), and channel key if needed.
  • Press "Request integration"

 

Bridging should now happen.