Skip to main content

Matrix - A full matrix stack

Docker compose

  conduit:
    image: matrixconduit/matrix-conduit:latest
    restart: unless-stopped
    networks:
      - traefik
      - matrix_default
    volumes:
      - /path/to/db:/var/lib/matrix-conduit/
    environment:
      - CONDUIT_SERVER_NAME=matrix-domaint.com
      - CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit/
      - CONDUIT_DATABASE_BACKEND=rocksdb
      - CONDUIT_PORT=6167
      - CONDUIT_MAX_REQUEST_SIZE=10000000 # in bytes, ~10 MB
      - CONDUIT_ALLOW_REGISTRATION=false
      - CONDUIT_ALLOW_FEDERATION=true
      - CONDUIT_MAX_CONCURRENT_REQUESTS=5
      - CONDUIT_ALLOW_CHECK_FOR_UPDATES=true
      - CONDUIT_TRUSTED_SERVERS=["matrix.org"]
      - CONDUIT_ADDRESS=0.0.0.0
      - CONDUIT_CONFIG='' # Ignore this
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.matrix.rule=Host(`matrix-domain.com`)"
      - "traefik.http.routers.matrix.entrypoints=websecure"
      - "traefik.http.routers.matrix.tls=true"
      - "traefik.http.routers.matrix.middlewares=cors-headers-matrix@docker"
      - "traefik.http.services.matrix.loadBalancer.server.port=6167"
      - "traefik.docker.network=traefik"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowOriginList=*"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"

  conduit-well-known:
    image: nginx:latest
    restart: unless-stopped
    networks:
      - traefik
    volumes:
      - /path/to/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
      - /path/to/www:/var/www/ # location of the client and server .well-known-files
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.matrix-wellknown.rule=Host(`matrix-domain.com`) && PathPrefix(`/.well-known/matrix`)"
      - "traefik.http.routers.matrix-wellknown.entrypoints=websecure"
      - "traefik.http.routers.matrix-wellknown.tls=true"
      - "traefik.http.routers.matrix-wellknown.middlewares=cors-headers-matrix@docker"
      - "traefik.http.services.matrix-wellknown.loadBalancer.server.port=80"
      - "traefik.docker.network=traefik"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowOriginList=*"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
      - "traefik.http.middlewares.cors-headers-matrix.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
  element-web:
    image: vectorim/element-web:latest
    restart: unless-stopped
    volumes:
      - /path/to/config.json:/app/config.json
    networks:
      - traefik
    depends_on:
      - conduit
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.element.rule=Host(`element.domain.com`)"
      - "traefik.http.routers.element.entrypoints=websecure"
      - "traefik.http.routers.element.tls=true"
      - "traefik.http.services.element.loadBalancer.server.port=80"
      - "traefik.docker.network=traefik"