matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
283 stars 68 forks source link

Running Hookshot on homeserver with nginx #829

Closed EnlitHamster closed 11 months ago

EnlitHamster commented 11 months ago

Hi! I am trying to setup Matrix Hookshot on my homeserver. I am currently running Matrix Synapse and Gitea on it. I am also using Nginx as a reverse proxy for both. I would like to use Hookshot to receive notifications on my Matrix server whenever commits are pushed.

I have been trying to setup Hookshot during the weekend, but I am hitting a brick wall. When starting Hookshot I get the following errors:

ERROR 08:17:15:143 [MatrixHttpClient] (REQ-1) Error: connect ECONNREFUSED ::1:8008
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1481:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 8008
}
ERROR 08:17:15:145 [Appservice] Encountered error registering user: 
ERROR 08:17:15:145 [Appservice] Error: connect ECONNREFUSED ::1:8008
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1481:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 8008
}
WARN 08:17:15:146 [Bridge] Failed to connect to homeserver, retrying in 5s Error: connect ECONNREFUSED ::1:8008
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1481:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 8008
}

My config.yml file (only relevant parts of it) with the domain masked as mydomain.com:

bridge:
  domain: mydomain.com
  url: http://localhost:8008
  port: 9993
  bindAddress: 127.0.0.1
listeners:
  - port: 9000
    bindAddress: 127.0.0.1
    resources:
      - webhooks

My registration.yml:

id: matrix-hookshot
as_token: MyAsToken
hs_token: MyHsToken
namespaces:
  rooms: []
  users:
    - regex: "@_webhooks_.*:mydomain.com"
      exclusive: true

sender_localpart: hookshot
url: "http://localhost:9993"
rate_limited: false

My Appservice file:

id: matrix-hookshot
url: http://localhost:9993
as_token: MyAsToken
hs_token: MyHsToken
sender_localpart: hookshot
namespaces:
  users:
    - exclusive: true
      regex: "@_gitea_bridge_.*"
  aliases: []
  rooms: []

I have tried the following:

I am quite a newbie to this, so I also struggled a bit with the documentation. I would like to understand what I'm doing wrong so I can write a guide for non experienced users as I can't find one and it's something I feel I am missing throughout my attempts.

EnlitHamster commented 11 months ago

The issue was solved through the Matrix channel. The problem was my homeserver IPv6s are not yet setup correctly, and using localhost the MatrixHttpClient would automatically use IPv6. Using 127.0.0.1 everywhere fixed the issue.