infrastructure/ansible/plays/services/matrix/docker-compose.yaml

208 lines
6.4 KiB
YAML
Raw Permalink Normal View History

2024-02-05 18:44:13 +01:00
{% import 'macro/postgres.j2' as pg with context %}
2022-11-12 14:24:54 +01:00
---
version: '3.9'
services:
synapse:
image: registry.tobiasmanske.de/matrixdotorg/synapse:latest
2022-12-02 04:05:41 +01:00
user: "1000:1000"
2022-11-12 14:24:54 +01:00
# Since synapse does not retry to connect to the database, restart upon
# failure
restart: unless-stopped
# See the readme for a full documentation of the environment settings
# NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
environment:
- SYNAPSE_CONFIG_DIR=/config
- SYNAPSE_CONFIG_PATH=/config/homeserver.yaml
- TZ=Europe/Berlin
2023-02-17 14:06:35 +01:00
ulimits:
nofile:
soft: 10000
hard: 40000
2022-11-12 14:24:54 +01:00
volumes:
- synapse_data:/data
- ./synapse-config:/config:ro,Z
2022-12-02 04:05:41 +01:00
- ./mautrix-telegram/registration.yaml:/data/reg-mautrix-tg.yaml:ro,Z
- ./mautrix-slack/registration.yaml:/data/reg-mautrix-slack.yaml:ro,Z
2023-04-04 17:37:39 +02:00
- ./mautrix-signal/registration.yaml:/data/reg-mautrix-signal.yaml:ro,Z
2022-11-12 14:24:54 +01:00
depends_on:
- db
2022-12-02 04:05:41 +01:00
- redis
2022-11-12 14:24:54 +01:00
networks:
- default
- backend
2023-08-10 16:29:52 +02:00
- metrics
2022-11-12 14:24:54 +01:00
labels:
- "traefik.enable=true"
2024-01-22 18:56:17 +01:00
- "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
2022-12-02 04:05:41 +01:00
- "traefik.http.routers.http-synapse.rule=Host(`synapse.{{ matrix.baseurl }}`)"
- "traefik.http.routers.http-synapse.entryPoints=websecure"
- "traefik.http.routers.http-synapse.service=matrix-synapse"
2023-03-05 22:20:26 +01:00
- "traefik.http.routers.matrix-synapse.rule=Host(`{{ matrix.baseurl }}`) && PathPrefix(`/_{path:(matrix|synapse)}/`)"
2022-11-12 14:24:54 +01:00
- "traefik.http.routers.matrix-synapse.entryPoints=websecure"
2022-12-02 04:05:41 +01:00
- "traefik.http.routers.matrix-synapse.service=matrix-synapse"
2022-11-12 14:24:54 +01:00
- "traefik.http.services.matrix-synapse.loadbalancer.server.port=8008"
2023-04-16 16:10:44 +02:00
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=9091"
- "prometheus-scrape.metrics_path=/_synapse/metrics"
2022-11-12 14:24:54 +01:00
2024-02-22 00:28:08 +01:00
{{ pg.postgres("db", matrix.db.user, matrix.db.password, matrix.db.database, ["backend"] ) }}
2022-11-12 14:24:54 +01:00
2023-03-28 13:11:48 +02:00
caddy:
image: caddy:2
2022-11-12 14:24:54 +01:00
volumes:
2023-03-28 13:11:48 +02:00
- ./Caddyfile:/etc/caddy/Caddyfile:ro,z
restart: unless-stopped
2022-11-12 14:24:54 +01:00
labels:
- "traefik.enable=true"
2024-01-22 18:56:17 +01:00
- "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
2022-11-12 14:24:54 +01:00
- "traefik.http.routers.matrix-well-known.rule=Host(`{{ matrix.baseurl }}`) && PathPrefix(`/.well-known/matrix/`)"
- "traefik.http.routers.matrix-well-known.entrypoints=websecure"
- "traefik.http.services.matrix-well-known.loadbalancer.server.port=80"
2023-03-09 12:53:22 +01:00
cinny:
2024-02-08 23:37:12 +01:00
image: ghcr.io/cinnyapp/cinny:latest
# image: registry.tobiasmanske.de/cinnyapp/cinny:latest
2023-03-09 12:53:22 +01:00
restart: unless-stopped
labels:
2024-01-22 18:56:17 +01:00
- "traefik.enable=true"
- "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
- "traefik.http.routers.matrix-cinny.rule=Host(`cinny.{{ matrix.baseurl }}`)"
- "traefik.http.routers.matrix-cinny.entryPoints=websecure"
- "traefik.http.services.matrix-cinny.loadbalancer.server.port=80"
2023-03-09 12:53:22 +01:00
volumes:
- ./cinny-config.json:/app/config.json:ro,Z
networks:
- default
2022-11-12 14:24:54 +01:00
redis:
2022-12-02 04:05:41 +01:00
image: redis:latest
2022-11-12 14:24:54 +01:00
restart: unless-stopped
networks:
- backend
2023-09-24 19:36:53 +02:00
### SLIDING SYNC
2024-02-05 18:44:13 +01:00
{{ pg.postgres("db-syncv3", matrix.syncv3.user, matrix.syncv3.password, matrix.syncv3.database, ["syncv3"] ) }}
2023-09-24 19:36:53 +02:00
syncv3-proxy:
image: ghcr.io/matrix-org/sliding-sync:latest
restart: always
environment:
- "SYNCV3_SERVER=https://synapse.{{ matrix.baseurl }}"
- "SYNCV3_SECRET={{ matrix.syncv3.secret }}"
- "SYNCV3_BINDADDR=:8008"
- "SYNCV3_PROM=:2112"
2024-02-08 23:37:12 +01:00
- "SYNCV3_DB=user={{ matrix.syncv3.user }} dbname={{ matrix.syncv3.database }} sslmode=disable host=db-syncv3 password='{{ matrix.syncv3.password }}'"
2023-09-24 19:36:53 +02:00
labels:
- "traefik.enable=true"
2024-01-22 18:56:17 +01:00
- "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
2023-09-24 19:36:53 +02:00
- "traefik.http.routers.matrix-syncv3-proxy.rule=Host(`syncv3.{{ matrix.baseurl }}`)"
- "traefik.http.routers.matrix-syncv3-proxy.entrypoints=websecure"
- "traefik.http.services.matrix-syncv3-proxy.loadbalancer.server.port=8008"
2023-11-14 16:41:11 +01:00
- "prometheus-scrape.enabled=false"
2023-09-24 19:36:53 +02:00
- "prometheus-scrape.port=2112"
networks:
- syncv3
- default
2022-12-02 04:05:41 +01:00
### BRIDGES
2023-04-04 17:37:39 +02:00
#### Telegram
2022-12-02 04:05:41 +01:00
mautrix-telegram:
image: dock.mau.dev/mautrix/telegram:latest
user: "1000:1000"
restart: unless-stopped
environment:
- "MAUTRIX_DIRECT_STARTUP=1"
volumes:
- bridge_tg_data:/data
- ./mautrix-telegram/config.yaml:/data/config.yaml:ro,Z
- ./mautrix-telegram/registration.yaml:/data/registration.yaml:ro,Z
networks:
- backend
- default # Needs to contact UFOs in the sky
depends_on:
- db-bridge-tg
- synapse
2024-02-05 18:44:13 +01:00
{{ pg.postgres("db-bridge-tg", matrix.bridge.tg.dbuser, matrix.bridge.tg.dbpass, matrix.bridge.tg.dbname, ["backend"] ) }}
2022-12-02 04:05:41 +01:00
2023-04-04 17:37:39 +02:00
#### SLACK
2022-12-02 04:05:41 +01:00
mautrix-slack:
image: dock.mau.dev/mautrix/slack:latest
environment:
- "UID=1000"
- "GID=1000"
restart: unless-stopped
volumes:
- bridge_slack_data:/data
- ./mautrix-slack/config.yaml:/data/config.yaml:ro,Z
- ./mautrix-slack/registration.yaml:/data/registration.yaml:ro,Z
networks:
- backend
- default # Needs to contact UFOs in the sky
depends_on:
- db-bridge-slack
- synapse
2024-02-05 18:44:13 +01:00
{{ pg.postgres("db-bridge-slack", matrix.bridge.slack.dbuser, matrix.bridge.slack.dbpass, matrix.bridge.slack.dbname, ["backend"] ) }}
2022-12-02 04:05:41 +01:00
2023-04-04 17:37:39 +02:00
#### SIGNAL
mautrix-signal:
image: dock.mau.dev/mautrix/signal:latest
restart: unless-stopped
2023-04-04 17:47:23 +02:00
environment:
- "MAUTRIX_DIRECT_STARTUP=1"
2023-12-22 15:43:01 +01:00
- "UID=1000"
2023-04-04 17:37:39 +02:00
networks:
2023-04-04 17:47:23 +02:00
- default
2023-04-04 17:37:39 +02:00
- backend
volumes:
- bridge_signal_data:/data
- signald_data:/signald
- ./mautrix-signal/config.yaml:/data/config.yaml:ro,Z
- ./mautrix-signal/registration.yaml:/data/registration.yaml:ro,Z
depends_on:
- signald
- db-bridge-signal
signald:
image: docker.io/signald/signald:latest
restart: unless-stopped
networks:
- default
- backend
volumes:
- signald_data:/signald
2024-02-05 18:44:13 +01:00
{{ pg.postgres("db-bridge-signal", matrix.bridge.signal.dbuser, matrix.bridge.signal.dbpass, matrix.bridge.signal.dbname, ["backend"] ) }}
2023-04-04 17:37:39 +02:00
2022-11-12 14:24:54 +01:00
networks:
2024-03-11 04:07:41 +01:00
default:
enable_ipv6: true
2024-02-05 18:44:13 +01:00
postgres:
internal: true
2022-11-12 14:24:54 +01:00
backend:
internal: true
2023-09-24 19:36:53 +02:00
syncv3:
internal: true
2023-08-10 16:29:52 +02:00
metrics:
external: true
2022-11-12 14:24:54 +01:00
volumes:
2023-04-04 17:37:39 +02:00
bridge_signal_data:
2024-02-05 18:44:13 +01:00
bridge_slack_data:
bridge_tg_data:
db-bridge-signal_data:
db-bridge-slack_data:
db-bridge-tg_data:
db-syncv3_data:
2022-11-12 14:24:54 +01:00
db_data:
2024-02-05 18:44:13 +01:00
signald_data:
synapse_data:
2022-11-12 14:24:54 +01:00
...