Help needed with synapse (matrix) behind swag server

I need help with setup synapse from matrixdotorg.

I have running nextcloud behind the swag server and everything works well.
I can reach the server from external via https://nextcloud.my.duckdns.org.

Now I have add the synapse container with following docker.compose setup:

version: "3.3"

services:
    synapse:
        image: "matrixdotorg/synapse:latest"
        container_name: "synapse"
        volumes:
            - /docker_data/synapse-data:/data
        environment:
            TZ: DE
            UID: 1000
            UID: 1000
            VIRTUAL_HOST: "matrix.my.duckdns.org"
            VIRTUAL_PORT: 8008
            LETSENCRYPT_HOST: "matrix.my.duckdns.org"
            SYNAPSE_SERVER_NAME: "matrix.my.duckdns.org"
            SYNAPSE_REPORT_STATS: "yes"
        restart: always
        networks: ["server"]

networks:
    server:
        external: true
    default:
        external:
            name: swag_default

In the swag configuration nginx/proxy-confs I have renamed the synapse.subdomain.conf.sample to synapse.subdomain.conf without change the configuration file.

When I try to connect to https://matrix.my.duckdns.org/ I get a 502 Bad Gateway error.

Any idea what I do wrong?

Thank you in advance for your suggestion!

I found a solution myself!

I deleted the /data folder where all the custom data for the synapse docker container is located, in my case /docker_data/synapse-data.

I have modified the docker-comose file as follows, the main change concerns the network setting:

version: "3.3"

services:
    synapse:
        image: "matrixdotorg/synapse:latest"
        container_name: "synapse"
        volumes:
            - /docker_data/synapse-data:/data
        environment:
            TZ: DE
            VIRTUAL_HOST: "matrix.my_own.duckdns.org"
            VIRTUAL_PORT: 8008
            LETSENCRYPT_HOST: "matrix.my_own.duckdns.org"
            SYNAPSE_SERVER_NAME: "matrix.my_own.duckdns.org"
            SYNAPSE_REPORT_STATS: "yes"
        restart: always
        networks: ["swag_default"]

networks:
  swag_default:
    external: true

In the swag configuration nginx/proxy-confs I have renamed the synapse.subdomain.conf.sample to synapse.subdomain.conf without changes. After that I restarted swag.

I did the initial configuration of synapse with the following command.
docker-compose run --rm synapse generate

In the homeserver.yaml I verified that the server name is stored correctly and that TLS is deactivated.

Finally, I started the synapse server with the docker-compose up -d command.

If the following image appears after calling https://matrix.my_own.duckdns.org in the browser, everything works.

Depending on the setting of the homserver.yaml file, new USERs must be created manually, this can be done by using the command docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.