Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traefik reverse proxy instructions #459

Open
0verEngineer opened this issue Aug 22, 2024 · 0 comments
Open

Traefik reverse proxy instructions #459

0verEngineer opened this issue Aug 22, 2024 · 0 comments

Comments

@0verEngineer
Copy link

Can someone please add instructions on how to run sliding-sync proxy and synapse on the same server with the same domain both behind traefik reverse proxy.

I tried it some time ago and i don't really know what the problem was but synapse itself did not work anymore after the sliding-sync proxy was running, i could not connect to it with Element and Nheko, i tried with ElementX to check if sliding-sync is working and i also could not connect.

Here is my setup:

version: '3.7'

networks:
  traefik-network:
    external: true
    name : traefik-network
  postgres-network:
    external: true
    name: postgres-network

services:

  redis:
    image: "redis:5"
    restart: "unless-stopped"
    networks:
      - default

    #  sliding-sync:
    #environment:
    #- SYNCV3_SERVER=http://synapse
    #- SYNCV3_SECRET=ads123!l2h423dhfasdk-dhj34hgad8a7968#56dfhj.-ah2jk3h
    #- SYNCV3_BINDADDR=:8009
    #- SYNCV3_DB=postgres://slidingsync:xxxxxxx@postgres-db-1/slidingsync?sslmode=disable
    #ports:
    #- 8009:8009
    #restart: "unless-stopped"
    #image: ghcr.io/matrix-org/sliding-sync:latest
    # networks:
    #- postgres-network
    #  - default
    #  - traefik-network
    # depends_on:
    #  - synapse
    #labels:
    #  - "traefik.enable=true"
    #  - "traefik.http.services.synapse.loadbalancer.server.port=8009"
    #  - "traefik.http.routers.synapse.rule=Host(`slidingsync.domain.io`)"
    #  - "traefik.http.routers.synapse.entrypoints=https"
    #  - "traefik.http.routers.synapse.tls.certresolver=le"


  synapse:
    image: "matrixdotorg/synapse:v1.109.0"
    restart: "unless-stopped"
    environment:
      SYNAPSE_CONFIG_DIR: "/data"
      SYNAPSE_CONFIG_PATH: "/data/homeserver.yaml"
      UID: "1000"
      GID: "1000"
      TZ: "Europe/Berlin"
      # ports:
      #- 8008:8008
    volumes:
      - ./synapse-config:/data
      - ../../data/matrix/synapse/media_store:/data/media_store
    networks:
      - default
      - traefik-network
      - postgres-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.synapse.loadbalancer.server.port=8008"
      - "traefik.http.routers.synapse.rule=Host(`synapse.domain.io`)"
      - "traefik.http.routers.synapse.entrypoints=https"
      - "traefik.http.routers.synapse.tls.certresolver=le"

  nginx:
    image: "nginx:stable"
    restart: "unless-stopped"
    networks:
      - default
      - traefik-network
    volumes:
      - "./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf"
      - ./nginx/www:/var/www/
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.matrix.loadbalancer.server.port=80"
      - "traefik.http.routers.matrix.rule=Host(`matrix.domain.io`)"
      - "traefik.http.routers.matrix.entrypoints=https"
      - "traefik.http.routers.matrix.tls.certresolver=le"


  element:
    image: "vectorim/element-web:latest"
    volumes:
      - "./element/config.json:/app/config.json"
    networks:
      - default
      - traefik-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.element.loadbalancer.server.port=80"
      - "traefik.http.routers.element.rule=Host(`element.domain.io`)"
      - "traefik.http.routers.element.entrypoints=https"
      - "traefik.http.routers.element.tls.certresolver=le"

  coturn:
    image: "instrumentisto/coturn:latest"
    restart: "unless-stopped"
    volumes:
      - "./coturn/turnserver.conf:/etc/coturn/turnserver.conf"
    ports:
      - "49160-49200:49160-49200/udp"
      - "3478:3478"
      - "5349:5349"




---

matrix.conf of nginx:

server {
  listen         80 default_server;
  server_name    matrix.domain.io;

 # Traefik -> nginx -> synapse
 location /_matrix {
    proxy_pass http://synapse:8008;
    proxy_set_header X-Forwarded-For $remote_addr;
    client_max_body_size 128m;
  }

  location /.well-known/matrix/ {
    root /var/www/;
    default_type application/json;
    add_header Access-Control-Allow-Origin  *;
  }
}


---

.well-known/matrix/client file:

{
  "m.homeserver": {
    "base_url": "https://matrix.domain.io",
    "im.vector.riot.jitsi": {
      "preferredDomain": "jitsi.domain.io"
    }
  }
}


---

.well-known/matrix/server file:

{
  "m.server": "synapse.domain.io:443"
}


---

I had this part added to the .well-known/matrix/client file for the sliding-sync:

"org.matrix.msc3575.proxy": {
    "url": "https://slidingsync.domain.io"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant