Telegram bridge for Matrix #33

Merged
skobkin merged 3 commits from feature_mautrix_telegram into master 2022-03-25 01:07:30 +00:00
6 changed files with 78 additions and 2 deletions

View file

@ -0,0 +1,12 @@
# see https://mau.dev/mautrix/telegram/
IMAGE_VERSION=latest
HOST_USER=1337
HOST_GROUP=1337
# Do not modify unless you know what you're doing!
# It is used by 'synapse' stack.
#HOST_DATA_DIR=./data
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

View file

@ -0,0 +1,16 @@
# Telegram Bridge for Matrix
## Create internal network for Matrix services
You should've created this network while setting up [synapse](../synapse/README.md). But if you didn't, then do it
before trying to run this stack:
```shell
docker network create --internal matrix
```
## Bridge setup documentation
- https://docs.mau.fi/bridges/python/setup/docker.html?bridge=telegram
- https://docs.mau.fi/bridges/general/registering-appservices.html
- https://docs.mau.fi/bridges/python/telegram/relay-bot.html (optional)

2
mautrix-telegram/data/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/*
!/.gitignore

View file

@ -0,0 +1,30 @@
# https://mau.dev/mautrix/telegram/
version: '3.7'
services:
mautrix-telegram:
image: "dock.mau.dev/mautrix/telegram:${IMAGE_VERSION:-latest}"
container_name: mautrix-telegram
volumes:
# This volume is also used by 'synapse' stack.
# Do not change the path unless you know what you're doing.
- "${HOST_DATA_DIR:-./data}:/data"
env_file: .env
environment:
UID: "${HOST_USER:-1337}"
GID: "${HOST_GROUP:-1337}"
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- default
- matrix
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "${LOG_MAX_SIZE:-5m}"
max-file: "${LOG_MAX_FILE:-5}"
networks:
matrix:
external: true

View file

@ -1,6 +1,12 @@
# [Synapse](https://matrix.org/docs/projects/server/synapse) ([Matrix.org](https://matrix.org/) server) # [Synapse](https://matrix.org/docs/projects/server/synapse) ([Matrix.org](https://matrix.org/) server)
# Generating server configuration ## Create internal network for Matrix services
```shell
docker network create --internal matrix
```
## Generate server configuration
Do not forget to prepare `.env` file before running this. Do not forget to prepare `.env` file before running this.
@ -15,7 +21,7 @@ If you want to use full-fledged PostgreSQL instead of SQLite, you can check
To use PostgreSQL running on the host machine, use [this](../_docs/access_database_on_host_from_docker.md) configuration. To use PostgreSQL running on the host machine, use [this](../_docs/access_database_on_host_from_docker.md) configuration.
# Running the server ## Run the server
```shell ```shell
docker-compose up -d docker-compose up -d

View file

@ -15,10 +15,20 @@ services:
- "${DATA_PATH:-./data}:/data" - "${DATA_PATH:-./data}:/data"
# SSL certs directory # SSL certs directory
- "${SSL_PATH:-./ssl}:/ssl:ro" - "${SSL_PATH:-./ssl}:/ssl:ro"
# Bridges
# Telegram
- "../mautrix-telegram/data:/bridges/mautrix-telegram/data:ro"
env_file: .env env_file: .env
networks:
- default
- matrix
restart: unless-stopped restart: unless-stopped
logging: logging:
driver: "json-file" driver: "json-file"
options: options:
max-size: "${LOG_MAX_SIZE:-5m}" max-size: "${LOG_MAX_SIZE:-5m}"
max-file: "${LOG_MAX_FILE:-5}" max-file: "${LOG_MAX_FILE:-5}"
networks:
matrix:
external: true