matrix-org / matrix-appservice-bridge

Bridging infrastructure for Application Services
Apache License 2.0
151 stars 71 forks source link

Adding support for postgres #131

Open 6be709c0 opened 5 years ago

6be709c0 commented 5 years ago

Hello, I'm using the following config to run a self-hosted matrix with postgres from https://github.com/spantaleev/matrix-docker-ansible-deploy

I would like to know if you can add a support for postgres.

I'm able to make the bridge & migrations work but nothing happen when I invite the bot @_webhook:<my_domain>

I suspect it come from the src/WebhookBridge.js where I commented userStore & roomStore because it was using a sqlite path.

        this._bridge = new Bridge({
            registration: this._registration,
            homeserverUrl: this._config.homeserver.url,
            domain: this._config.homeserver.domain,
            // userStore: process.env["WEBHOOKS_USER_STORE_PATH"] || "user-store.db",
            // roomStore: process.env["WEBHOOKS_ROOM_STORE_PATH"] || "room-store.db",

Note: I was able to invite the bot to a room using sqlite.

I can see The user store instance to use in bridge.js

 * @param {(UserBridgeStore|string)=} opts.userStore The user store instance to
 * use, or the path to the user .db file to load. A database will be created if
 * this is not specified.

What is the a user store instance? (tried with the table name: users & rooms but didn't work)

Half-Shot commented 5 years ago

The bridge library only supports NeDB which means it does not support any other database including PostgreSQL or SQLite. A store instance is either a NeDB datastore object or a string path to the file.

Postgres is unlikely to come to this library, but we are exploring options about how to include it in future bridges.

6be709c0 commented 5 years ago

Ok thanks for the fast answer.

Is there a way to use matrix with PostgresSQL alognside with matrix-appservice-bridge with SQLite?

Half-Shot commented 4 years ago

Is there a way to use matrix with PostgresSQL alognside with matrix-appservice-bridge with SQLite?

Once again, this isn't SQLite. The supported database type is NeDB which is just a file with a .db extension which actually stores json. The various *Store types you see inside the bridge are just implementations for different needs. Bridges such as the slack and discord bridges have implemented their own storage backends rather than using the included one here.