Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
316 stars 417 forks source link

[Synapse] Explain how to add sliding sync proxy #1625

Closed tillmannheigel closed 10 months ago

tillmannheigel commented 1 year ago

In order to use Element X, one must use the sliding-sync proxy. An addition for Synapse should explain that properly.

taddydevil commented 12 months ago

Got it working on my instance. But I'm unsure if I setup it correctly and securely. The documentation is really unclear with the proxy and port setup imho. But my Element X works so far yay

ASAP I'm sure this setup is correct I'll try to update the guide.

nichtmax commented 11 months ago

Here might be some help (untested by us) for setting up sliding-sync proxy which seems to need shell variables in supervisord config: https://uberspace.social/@sebastian@social.burschel.com/111531710670020451

tillmannheigel commented 11 months ago

Got it working too, should we compare our config, @taddydevil ?

taddydevil commented 11 months ago

Of course. I got it working too as a service and would update the guide.

Can you post your config?

tillmannheigel commented 11 months ago

Here is my etc/slidingsync.ini

➜  slidingsync.ini 
[program:slidingsync]
command=/home/$USER/sliding-sync/syncv3
autostart=yes
autorestart=yes
environment=
      SYNCV3_SECRET="cdf44...2af9",
      SYNCV3_SERVER="https://matrix.$DOMAIN.$TLD",
      SYNCV3_DB="user=$PGR_USER dbname=$PGR_DB sslmode=disable password=$PGR_PW",
      SYNCV3_BINDADDR="0.0.0.0:8009"
tillmannheigel commented 11 months ago

if I remember correctly, I had to create (or update)

/var/www/virtual/$USER/matrix.$DOMAIN.$TLD/.well-known/matrix/client

{
    "m.homeserver": {
        "base_url": "https://matrix.$DOMAIN.$TLD"
    },
    "org.matrix.msc3575.proxy": {
        "url": "https://slidingsync.matrix.$DOMAIN.$TLD"
    }
}
taddydevil commented 11 months ago

Kk, our config is identical - perfect. And yes, the .well-known entry is urgently needed.

tillmannheigel commented 11 months ago

finally:

uberspace web backend set slidingsync.matrix.$DOMAIN.$TLD/ --http --port 8009

tillmannheigel commented 11 months ago

I just checked the documentation. Wasn't there something additionally required for the client/ path?:

location ~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync) {
    proxy_pass http://localhost:8009;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $host;
}

location ~ ^(\/_matrix|\/_synapse\/client) {
    proxy_pass http://localhost:8008;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $host;
}

location /.well-known/matrix/client {
    add_header Access-Control-Allow-Origin *;
}
taddydevil commented 11 months ago

I just checked the documentation. Wasn't there something additionally required for the client/ path?:

No, one path is already configured with synapse and the other one that you already mention comes with sliding-sync. It should be totally fine that the whole domain will be directed to the proxy.