mautrix / facebook

A Matrix-Facebook Messenger puppeting bridge
https://matrix.to/#/#facebook:maunium.net
GNU Affero General Public License v3.0
389 stars 64 forks source link

Multiple bridges in PostgreSQL database? #257

Closed NielsVanderstraeten closed 2 years ago

NielsVanderstraeten commented 2 years ago

I have succesfully set-up my own Matrix Synapse homeserver with PostgreSQL database and have succesfully connected the mautrix-whatsapp bridge. However, when now attempting to set-up the mautrix-facebook bridge as well, I am presented with the following error during the last step of the installation.

How can I allow my PostgreSQL database, which is being used by Synapse, to be both available to mautrix-whatsapp and mautrix-facebook at the same time?


[2022-09-15 12:14:21,277] [INFO@mau.init] Initializing mautrix-facebook 0.4.0
[2022-09-15 12:14:21,279] [INFO@mau.init] Initialization complete in 0.08 seconds
[2022-09-15 12:14:21,279] [DEBUG@mau.init] Running startup actions...
[2022-09-15 12:14:21,279] [DEBUG@mau.init] Starting database...
[2022-09-15 12:14:21,279] [DEBUG@mau.db] Connecting to postgres://synapse_user:[password-redacted@localhost](mailto:password-redacted@localhost)/synapse
[2022-09-15 12:14:21,321] [CRITICAL@mau.init] Failed to initialize database
Traceback (most recent call last):
  File "/etc/mautrix_facebook/lib/python3.9/site-packages/mautrix/bridge/[bridge.py](http://bridge.py/)", line 191, in start_db
    await self.db.start()
  File "/etc/mautrix_facebook/lib/python3.9/site-packages/mautrix/util/async_db/[asyncpg.py](http://asyncpg.py/)", line 63, in start
    await super().start()
  File "/etc/mautrix_facebook/lib/python3.9/site-packages/mautrix/util/async_db/[database.py](http://database.py/)", line 103, in start
    await self._check_owner()
  File "/etc/mautrix_facebook/lib/python3.9/site-packages/mautrix/util/async_db/[database.py](http://database.py/)", line 124, in _check_owner
    raise DatabaseNotOwned(owner)
mautrix.util.async_db.errors.DatabaseNotOwned: The database is owned by mautrix-whatsapp
[2022-09-15 12:14:21,322] [INFO@mau.init] Sharing the same database with different programs is not supported
tulir commented 2 years ago

You can't. Create separate databases.

NielsVanderstraeten commented 2 years ago

Thanks for the quick response. But then how do I link multiple databases to my Synapse set-up? The homeserver.yaml file only allows for one database configuration?

NielsVanderstraeten commented 2 years ago

I figured it out, for future reference:

  1. Create a new PostgreSQL database (see https://matrix-org.github.io/synapse/latest/postgres.html)
  2. Set-up the mautrix-facebook bridge with the new database
  3. Do not touch the Synapse homeserver.yaml file - only the original database needs to be referenced here.