6 Bridge setup
Tulir Asokan edited this page 2021-01-30 19:56:51 +02:00

Requirements

  • Python 3.7 or higher with pip and virtualenv
  • A Matrix homeserver that supports application services (e.g. Synapse)
  • A PostgreSQL server (which you should already have for Synapse)

Production setup

  1. Create a directory for the bridge.
  2. Set up a virtual environment.
    1. Create with virtualenv -p /usr/bin/python3 .
    2. Activate with source ./bin/activate
  3. Install the bridge with pip install --upgrade mautrix-facebook.
    • If you want the master branch instead of a release, use pip install --upgrade 'git+https://github.com/tulir/mautrix-facebook.git#egg=mautrix-facebook[all]'.
  4. Copy example-config.yaml to config.yaml.
  5. Update the config to your liking. You'll at least need to change the homeserver and database settings, and add yourself to the permissions section.
  6. Generate the appservice registration with python -m mautrix_facebook -g. You can use the -c and -r flags to change the location of the config and registration files. They default to config.yaml and registration.yaml respectively.
  7. Add the path to the registration file to your Synapse's homeserver.yaml under app_service_config_files. Restart Synapse to apply changes.
  8. Create the database with alembic upgrade head. If you have a custom config path, use alembic -x config=/path/to/config.yaml upgrade head No longer needed in v0.2.0 and up.
  9. Run the bridge python -m mautrix_facebook.

Upgrading

  1. Run the bridge install command again (install step #2).
  2. Update the database with the command in install step #7.

Development setup

  1. Clone the repository.
  2. Optional, but strongly recommended: Set up a virtual environment.
    1. Create with virtualenv -p /usr/bin/python3 .venv
    2. Activate with source .venv/bin/activate
  3. Install dependencies with pip install -r requirements.txt
  4. Continue from step #3 of production setup.

Upgrading

  1. Pull changes from Git.
  2. Update dependencies with pip install --upgrade -r requirements.txt.
    • If you installed optional dependencies, run the same pip command as when installing them, but with --upgrade
  3. Update the database with the command in install step #7.