matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
155 stars 140 forks source link

Install and setup Sygnal #321

Closed LavTeamProject closed 1 year ago

LavTeamProject commented 1 year ago

Hello. I have a home server matrix. There is a mobile application. You need to set up push notifications.

I can't install and configure Signal.

Step 1. git clone https://github.com/matrix-org/sygnal.git Step 2 cd signal/ Step 3 docker build -t as/signal -f docker/Dockerfile . Step 4 docker run -it -logs --mount type=bind,source=/<path>/sygnal.yaml,target=/sygnal.yaml as/sygnal -p 5000:8989

I run and see: Using configuration file: sygnal.yaml 2022-09-12 07:02:20,160 [1] DEBUG __main__ Started logging 2022-09-12 07:02:20,160 [1] INFO __main__ Importing pushkin module: sygnal.gcmpushkin 2022-09-12 07:02:20,234 [1] INFO __main__ Creating pushkin: GcmPushkin 2022-09-12 07:02:20,314 [1] INFO __main__ Importing pushkin module: sygnal.gcmpushkin 2022-09-12 07:02:20,314 [1] INFO __main__ Creating pushkin: GcmPushkin 2022-09-12 07:02:20,386 [1] INFO __main__ Configured with app IDs: dict_keys(['chat.housetalk.ru', 'im.housetalk.ru']) 2022-09-12 07:02:20,386 [1] INFO __main__ Starting listening on 127.0.0.1 port 5000 2022-09-12 07:02:20,388 [1] INFO twisted SygnalLoggedSite starting on 5000 2022-09-12 07:02:20,389 [1] INFO twisted Starting factory <sygnal.http.SygnalLoggedSite object at 0x7fcacc293850>

Next I want to check: curl -k -X POST http://127.0.0.1/_matrix/push/v1/notify -H "Content-Type: application/json" --data @test.json curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused

^^^^^^^ this localhost

PS A similar problem on the VPS and NAS Synology Docker

Am I doing something wrong?

Sygnal.yaml

LavTeamProject commented 1 year ago

sygnal_copy.txt

erikjohnston commented 1 year ago

Hi, I think its due to the port mapping in the docker run command: -p 5000:8989? Isn't that saying its mapping port 5000 on the host machine to port 8989 in the container, but sygnal is listening on port 5000 in the container? Does using -p 5000:5000 work? (Or alternatively updating the sygnal config to listen on 8989 instead)

LavTeamProject commented 1 year ago

Hi, I think its due to the port mapping in the docker run command: -p 5000:8989? Isn't that saying its mapping port 5000 on the host machine to port 8989 in the container, but sygnal is listening on port 5000 in the container? Does using -p 5000:5000 work? (Or alternatively updating the sygnal config to listen on 8989 instead)

5000 - in the container 8989 - on the host machine

docker run -it -logs --mount type=bind,source=//sygnal.yaml,target=/sygnal.yaml as/sygnal -p 5000:5000 no effect

curl -k -X POST http://127.0.0.1:5000/_matrix/push/v1/notify -H "Content-Type: application/json" --data @test.json curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused

erikjohnston commented 1 year ago

Can you run docker ps to see whether sygnal is still around? Also, do you have any firewall configured that might be blocking the connection?

LavTeamProject commented 1 year ago

Can you run docker ps to see whether sygnal is still around? Also, do you have any firewall configured that might be blocking the connection?

$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2a53baf15b89 as/sygnal "python -m sygnal.sy…" 8 minutes ago Up 8 minutes 5000/tcp suspicious_wu

Also, do you have any firewall configured that might be blocking the connection

no

erikjohnston commented 1 year ago

Oh! You'll probably need to set bind_addresses to ['0.0.0.0'] so that it accepts connections from outside the container?

LavTeamProject commented 1 year ago

Oh! You'll probably need to set bind_addresses to ['0.0.0.0'] so that it accepts connections from outside the container?

Thank you very much! I spent two days.

➜ sygnal curl -k -X POST http://192.168.0.9:5000/_matrix/push/v1/notify -H "Content-Type: application/json" --data @test.json {"rejected": ["V2h5IG9uIGVhcnRoIGRpZCB5b3UgZGVjb2RlIHRoaXM/"]}%