Skip to content

Instantly share code, notes, and snippets.

@unbelauscht
Created February 3, 2023 14:28
Show Gist options
  • Save unbelauscht/847f8cf499480fa370a83108ccaadc85 to your computer and use it in GitHub Desktop.
Save unbelauscht/847f8cf499480fa370a83108ccaadc85 to your computer and use it in GitHub Desktop.
Dendrite homeserver with Traefik configuration
version: "3.4"
services:
postgres:
image: postgres:14
restart: always
volumes:
- ./src/build/docker/postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh
# To persist your PostgreSQL databases outside of the Docker image,
# to prevent data loss, modify the following ./path_to path:
- ./data/postgresql:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: yournewsecurepassword
POSTGRES_USER: dendrite
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dendrite"]
interval: 5s
timeout: 5s
retries: 5
networks:
internal:
aliases:
- dendritepg
dendrite:
hostname: dendrite
image: matrixdotorg/dendrite-monolith:latest
command: ["--tls-cert=server.crt", "--tls-key=server.key"]
volumes:
- ./data/dendrite/config:/etc/dendrite
- ./data/dendrite/media:/var/dendrite/media
depends_on:
- postgres
labels:
traefik.enable: true
traefik.http.services.dendrite.loadbalancer.server.port: "8008"
traefik.http.services.dendritefed.loadbalancer.server.port: "8448"
traefik.http.services.dendritefed.loadbalancer.server.scheme: "https"
traefik.http.routers.dendrite.service: "dendrite"
traefik.http.routers.dendritefed.service: "dendritefed"
traefik.http.routers.dendrite.entrypoints: "web-secure"
traefik.http.routers.dendritefed.entrypoints: "web-secure"
traefik.http.routers.dendrite.rule: >
(Host(`chat.example.com`) && (PathPrefix(`/_matrix/client`) || PathPrefix(`/_matrix/media`))) || (Host(`example.com`) && PathPrefix(`/.well-known/matrix`))
traefik.http.routers.dendritefed.rule: (Host(`chat.example.com`) && (PathPrefix(`/_matrix/federation`) || PathPrefix(`/_matrix/key`) )) || (Host(`example.com`) && PathPrefix(`/.well-known/matrix/server`))
traefik.http.routers.dendrite.tls: "true"
traefik.http.routers.dendritefed.tls: "true"
traefik.http.routers.dendrite.tls.certresolver: "letsencrypt"
traefik.http.routers.dendritefed.tls.certresolver: "letsencrypt"
networks:
internal:
web:
restart: unless-stopped
networks:
internal:
attachable: true
web:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment