Matrix bridge for multiple rocket.chat servers

Description

Hello!
We want to set up federation between different organizations using Rocket.Chat and use the Matrix bridge (synapse) for this

Based on the documentation, it is not entirely clear how to fill in these fields correctly:

And on this page it’s also not entirely clear:

Is it possible to understand what needs to be entered in these fields:

  1. Homeserver URL: The URL of the Matrix server you want to use as your Proxy homeserver. e.g. http://localhost:8008

Enter the address of matrix (matrix.example.com) here if a reverse proxy is configured - that seems to make sense?


  1. Homeserver Domain: Your Matrix homeserver’s name, the same as you’ve configured in your Matrix configuration file.

here is also the same address as in the first paragraph or the address on which Rocket.Chat is published ??


  1. Bridge URL: The URL for the Matrix bridge. It is the location you want your bridge should run.

And here, too, it is not entirely clear. RocketChat post address? rocket.example.com:3300 ?


Can anyone share the config?

And is it necessary to configure well-known if all rc1.example.com / rc.anothercompany.com RC servers are in different infrastructures?

Thanks for any help!

Server Setup Information

  • Version of Rocket.Chat Server: 6.2.2
  • Operating System: RHEL 8
  • Deployment Method: Docker
  • Number of Running Instances: >20
  • DB Replicaset Oplog: -
  • NodeJS Version: 14.x
  • MongoDB Version: 5.*
  • Proxy: nginx
  • Firewalls involved:

Any additional Information

Hi All!

Any help on this issue?

this needs to be a direct access point, so http://nic_bind_address:8008

Address on which rocket.chat is published.

This Rocket.Chat doesn’t entirely use except for grabbing the port from it. Think of at what address can synapse reach the bridge running on port 3300. So most likely another http://nic_bind_address:3300

Yes.

Try going through this - GitHub - RocketChat/federation-airgap: Example airgap deployment of Rocket.Chat federation with Synapse

It documents how this federation works, and provides templated examples of the configs. If you’re using docker, you can simply alias podman=docker and run the script. Or, do alias podman=: and run the script to generate the configs for you without running anything, then use them however you want (you’ll miss synapse config though).

But remember if you’re not using podman or docker, the “hostnames” in those configs, like matrix or rocketchat are going to have to be changed to most likely an internal ip or a private ip and port so that they can reach each other.

You may need to get some of the private certificate fluff out manually.

You can also read this file to get an idea of how each container gets started.

Or fill the config templates manually and use the compose file.

There are multiple ways.

Shoot me a mention if you have any questions.

Hi! Many thanks for info!)

I’ll try and get back soon

I did the following, but intermittently I get an error after creating a channel (channel does not exist). After reloading the page, sometimes it starts to show up. In my case, I needed to enter the following values in the Rocket.Chat settings:

Homeserver URL: https://matrix.domain.com (nginx reverse proxy is configured)

Homeserver Domain: (root domain which rocketchat is working, for example rocket.company.com, i make company.com - is right?)
If I add the value (rocketchat.company.com) - (ROOT_URL) to the Homeserver domain, then synapse reports that Application Service has not registered this user

Bridge URL: The URL for the Matrix bridge. It is the location you want your bridge should run - i make (rocket.intranet.com:3000)

Sometimes I get the following errors from synapse (are they bugs?):

> 2023-06-06 13:02:47,713 - synapse.federation.sender - 587 - INFO - process_event_queue_for_federation-17 - Unexpectedly did not have cached prev group for $CJG9XD9E56jU1kwbDHbOgkaZfW8k7ief4oPIkN3FiZU
> 2023-06-06 13:02:47,728 - synapse.federation.sender - 587 - INFO - process_event_queue_for_federation-17 - Unexpectedly did not have cached prev group for $N83tqMM87TOGTlsNtZKFQlYGx1KW8yhHmv0G8lhql4M

From Rocket.Chat:

Could not find handler for m.room.canonical_alias {
   age: 193
   content: { alias: '#testf1122331686056567388:matrix.domain.com' },
   event_id: '$N83tqMM87TOGTlsNtZKFQlYGx1KW8yhHmv0G8lhql4M',
   origin_server_ts: 1686056567551,
   room_id: '!bNEFnhvHiPYeNCBNpm:matrix.domain.com',
   sender: '@rocket_admin:matrix.domain.com',
   state_key: '',
   type: 'm.room.canonical_alias',
   unsigned: { age: 193 },
   user_id: '@rocket_admin:matrix.domain.com'
}
Could not find handler for m.room.history_visibility {
   age: 192
   content: { history_visibility: 'shared' },
   event_id: '$V1woulVMFcaV9roPN3u7i6jtHvnnQNuHHIKstpNizvc',
   origin_server_ts: 1686056567552,
   room_id: '!bNEFnhvHiPYeNCBNpm:matrix.domain.com',
   sender: '@rocket_user:matrix.domain.com',
   state_key: '',
   type: 'm.room.history_visibility',
   unsigned: { age: 192 },
   user_id: '@rocket_user:matrix.domain.com'
}
Could not find handler for m.room.guest_access {
   age: 191
   content: { guest_access: 'can_join' },
   event_id: '$ccFWBYCZaUMO7qXz5rE_1ok8k8FJjqpa_O7-n-lIkE8',
   origin_server_ts: 1686056567553,
   room_id: '!bNEFnhvHiPYeNCBNpm:matrix.domain.com',
   sender: '@rocket_user:matrix.domain.com',
   state_key: '',
   type: 'm.room.guest_access',
   unsigned: { age: 191 },
   user_id: '@rocket_user:matrix.domain.com'
}

Perhaps I did something wrong or is this behavior correct? Please check if synapse server is displayed next to the room name? Or should there be something else? (second scrn)

I had success going through this tutorial which connects Rocket.chat to Dendrite with NGINX as the proxy: Rocket.Chat and the Matrix Protocol – Aaron's Ramblings - you may be able to adapt it for synapse if you’d like, but I found dendrite works just fine (despite being ‘experimental’ - it just means the API is a more little restricted than synapse).
I deployed it to an EC2 in AWS with the aim of setting up another so they could communicate between different domain names.

Hello, a question, if I saw this design : https://github.com/RocketChat/federation-airgap/blob/main/DESIGN.md I understand I have to make on matrix synapse for each rocket chat ? So if I have 200 rocketchat to federate I have to deploy 200 synapse ?

Regards

Hi! Yes, if you have many rc servers you need to deploy for everyone matrix server.

2 Likes