mirror of
https://github.com/mautrix/telegram.git
synced 2026-11-16 23:18:33 +00:00
No results
45
Bridge setup
Andrew Morgan edited this page 2020-12-07 00:18:23 +00:00
Table of contents
Requirements
- Python 3.7 or higher with
pipandvirtualenv - A Matrix homeserver that supports application services (e.g. Synapse)
- Telegram app ID and hash (get from my.telegram.org)
- If installing optional dependencies, see the optional dependencies wiki page.
Production setup
- Create a directory for the bridge.
- Set up a virtual environment.
- Create with
virtualenv -p /usr/bin/python3 . - Activate with
source ./bin/activate
- Create with
- Install the bridge with
pip install --upgrade mautrix-telegram[all][all]at the end will install all optional dependencies. Some of the optional dependencies may need additional native packages. See the optional dependencies wiki page for more info.- If you want the master branch instead of a release, use
pip install --upgrade https://github.com/tulir/mautrix-telegram/tarball/master#egg=mautrix-telegram[all].
- Copy
mautrix_telegram/example-config.yamltoconfig.yaml. - Update the config to your liking. You'll at least need to change the homeserver settings and
api_id/api_hashin thetelegramsection. - Generate the appservice registration with
python -m mautrix_telegram -g. You can use the-cand-rflags to change the location of the config and registration files. They default toconfig.yamlandregistration.yamlrespectively. - Add the path to the registration file (
registration.yamlby default) to your Synapse'shomeserver.yamlunderapp_service_config_files. Restart Synapse to apply changes. - Create the database with
alembic upgrade head. If you have a custom config path, usealembic -x config=/path/to/config.yaml upgrade head - Run the bridge
python -m mautrix_telegram.
Upgrading
- Run the bridge install command again (install step #2).
- Update the database with the command in install step #7.
Development setup
- Clone the repository.
- Optional, but strongly recommended: Set up a virtual environment.
- Create with
virtualenv -p /usr/bin/python3 .venv - Activate with
source .venv/bin/activate
- Create with
- Install dependencies with
pip install -r requirements.txt- Optionally, add
-r optional-requirements.txtto install optional dependencies. Some of the optional dependencies may need additional native packages. See the optional dependencies wiki page for more info. - N.B. Dependency version ranges are not locked in
requirements.txt. Usepip install .instead if you want dependencies that are guaranteed to work (pip install .[all]for optional dependencies).
- Optionally, add
- Continue from step #3 of production setup.
Upgrading
- Pull changes from Git.
- Update dependencies with
pip install --upgrade -r requirements.txt.- If you installed optional dependencies, run the same
pipcommand as when installing them, but with--upgrade
- If you installed optional dependencies, run the same
- Update the database with the command in install step #7.
Wiki deprecated
mautrix-telegram docs are now on docs.mau.fi