Here is my example using mautrix-facebook as example‌

$ mkdir bridges/facebook
$ cd bridges/facebook
$ virtualenv -p /usr/local/bin/python3.7 .
$ bash
$ source bin/activate
$ pip install --global-option=build_ext --global-option="-I/usr/local/include" --upgrade git+https://github.com/tulir/mautrix-facebook.git#egg=mautrix-facebook[all]
$ cp example-config.yaml config.yaml

Edit config.yaml file to suit your current setup. Please note line ‌

database: postgres://bridge_facebook:[secret_password]@127.0.0.1/bridge_facebook

Next step is to create postgres database for bridge.‌

su - postgres
$ createuser --pwprompt bridge_facebook
$ psql
CREATE DATABASE bridge-facebook
ENCODING 'UTF8'
LC_COLLATE='C'
LC_CTYPE='C'
template=template0
OWNER bridge_facebook;‌

Start generation of registration.yaml file‌

$ python -m mautrix_telegram -g
$ vi registration.yaml‌

Add additinaly listening port again, bellow url: line.‌

url: http://localhost:29319
port: 29319‌‌
$ vi /usr/local/etc/matrix-synapse/homeserver.yaml‌

Put additional lines like bellow:‌

app_service_config_files:
/usr/home/synapse/bridges/facebook/registration.yaml
service synapse restart‌

Next step is to write rc startup script for your daemon...