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

281 lines
8.2 KiB
YAML
Raw Normal View History

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
db:
image: postgres:15
restart: always
environment:
- POSTGRES_USER={{ matrix.db.user }}
- POSTGRES_DB={{ matrix.db.database }}
- POSTGRES_PASSWORD={{ matrix.db.password }}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
networks:
- backend
2022-12-02 04:05:41 +01:00
volumes:
- db_data:/var/lib/postgresql/data
2022-11-12 14:24:54 +01:00
healthcheck:
2024-01-10 09:00:44 +01:00
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.db.user }}"]
2022-11-12 14:24:54 +01:00
interval: 10s
timeout: 5s
retries: 5
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:
2023-08-22 20:10:26 +02:00
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
syncv3-db:
image: postgres:15
restart: always
environment:
- POSTGRES_USER={{ matrix.syncv3.user }}
- POSTGRES_DB={{ matrix.syncv3.database }}
- POSTGRES_PASSWORD={{ matrix.syncv3.password }}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
networks:
- syncv3
volumes:
- syncv3_db_data:/var/lib/postgresql/data
healthcheck:
2024-01-10 09:00:44 +01:00
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.syncv3.user }}"]
2023-09-24 19:36:53 +02:00
interval: 10s
timeout: 5s
retries: 5
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"
- "SYNCV3_DB=user={{ matrix.syncv3.user }} dbname={{ matrix.syncv3.database }} sslmode=disable host=syncv3-db password='{{ matrix.syncv3.password }}'"
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
db-bridge-tg:
image: postgres:15
restart: always
environment:
- POSTGRES_USER={{ matrix.bridge.tg.dbuser }}
- POSTGRES_DB={{ matrix.bridge.tg.dbname }}
- POSTGRES_PASSWORD={{ matrix.bridge.tg.dbpass }}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
networks:
- backend
volumes:
- bridge_tg_db:/var/lib/postgresql/data
healthcheck:
2024-01-10 09:00:44 +01:00
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.tg.dbuser }}"]
2022-12-02 04:05:41 +01:00
interval: 10s
timeout: 5s
retries: 5
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
db-bridge-slack:
image: postgres:15
restart: always
environment:
- POSTGRES_USER={{ matrix.bridge.slack.dbuser }}
- POSTGRES_DB={{ matrix.bridge.slack.dbname }}
- POSTGRES_PASSWORD={{ matrix.bridge.slack.dbpass }}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
networks:
- backend
volumes:
- bridge_slack_db:/var/lib/postgresql/data
healthcheck:
2024-01-10 09:00:44 +01:00
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.slack.dbuser }}"]
2022-12-02 04:05:41 +01:00
interval: 10s
timeout: 5s
retries: 5
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
db-bridge-signal:
image: postgres:15
restart: unless-stopped
networks:
- backend
environment:
- POSTGRES_USER={{ matrix.bridge.signal.dbuser }}
- POSTGRES_DB={{ matrix.bridge.signal.dbname }}
- POSTGRES_PASSWORD={{ matrix.bridge.signal.dbpass }}
volumes:
- bridge_signal_db:/var/lib/postgresql/data
2024-01-10 09:00:44 +01:00
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.signal.dbuser }}"]
interval: 10s
timeout: 5s
retries: 5
2023-04-04 17:37:39 +02:00
2022-11-12 14:24:54 +01:00
networks:
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:
synapse_data:
2023-09-24 19:36:53 +02:00
syncv3_db_data:
2022-12-02 04:05:41 +01:00
bridge_tg_data:
bridge_tg_db:
bridge_slack_data:
bridge_slack_db:
2023-04-04 17:37:39 +02:00
bridge_signal_data:
bridge_signal_db:
signald_data:
2022-11-12 14:24:54 +01:00
db_data:
...