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

Unable to set up hookshot, Cannot POST #812

Closed Kuechlin closed 11 months ago

Kuechlin commented 1 year ago

I am unable to get hookshot to work, i followed the instructions in the docs but always get 404 responses. When i send a POST request it always returns the default express-js 404 result Cannot POST /hookshot/webhooks. I checked the nginx_reverse proxy and the configuration of it is correct, so the request gets forwarded to the correct container. When i send !hookshot webhook example command to the bot it responds with

Failed to handle command: The bridge is not configured to support webhooks.

Any Idea how i can get it running an what i could try next?

This is my config.yml

bridge:
  domain: mydomain.app
  url: http://synapse:8008 # The URL where Hookshot can reach the client-server API.
  mediaUrl: https://mydomain.app
  port: 9993 # The port where hookshot will listen for appservice requests.
  bindAddress: 0.0.0.0

passFile: /data/passkey.pem

gitlab:
  instances:
    gitlab.com:
      url: https://gitlab.com
  webhook:
    secret: some_secret
    publicUrl: https://mydomain.app/hookshot/gitlab/
  userIdPrefix: _gitlab_
  commentDebounceMs: 5000

generic:
  enabled: false
  enableHttpGet: false
  urlPrefix: https://mydomain.app/hookshot/webhooks/
  userIdPrefix: _webhooks_
  allowJsTransformationFunctions: false
  waitForComplete: true

bot:
  displayname: Hookshot
  avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d

logging:
  level: info
  colorize: true
  json: false
  timestampFormat: HH:mm:ss:SSS

permissions:
  - actor: "*"
    services:
      - service: "*"
        level: commands
  - actor: mydomain.app
    services:
      - service: "*"
        level: admin

listeners:
  - port: 9000
    bindAddress: 0.0.0.0
    resources:
      - webhooks

i am using docker compose with this config:

version: "3"

services:
  synapse:
    image: matrixdotorg/synapse:latest
    container_name: matrix_synapse
    restart: always
    volumes:
      - ./homeserver.yaml:/data/homeserver.yaml
      - ./hookshot/registration.yml:/data/hookshot_registration.yml
      - /var/lib/matrix/synapse-data:/data
    environment:
      - TZ=DE
      - UID=0
      - GID=0
      - VIRTUAL_HOST=mydomain.app
      - VIRTUAL_PORT=8008
      - VIRTUAL_PATH=/
      - LETSENCRYPT_HOST=mydomain.app
      - LETSENCRYPT_EMAIL=admin@mydomain.app
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    depends_on:
      - postgresql
    networks:
      - default
      - nginx_proxy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8008"]
      interval: 30s
      timeout: 5s
      retries: 5

  postgresql:
    image: postgres:latest
    container_name: matrix_postgres
    restart: always
    volumes:
      - "/var/lib/matrix/postgresdata:/var/lib/postgresql/data"
    environment:
      POSTGRES_PASSWORD: some_password
      POSTGRES_USER: synapse
      POSTGRES_DB: synapse
      POSTGRES_INITDB_ARGS: "--encoding='UTF8' --lc-collate='C' --lc-ctype='C'"
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  hookshot:
    container_name: matrix_hookshot
    volumes:
      - "./hookshot:/data"
    image: "halfshot/matrix-hookshot:latest"
    environment:
      - VIRTUAL_HOST=mydomain.app
      - VIRTUAL_PORT=9000
      - VIRTUAL_PATH=/hookshot
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    depends_on:
      synapse:
        condition: service_healthy
    networks:
      - default
      - nginx_proxy

networks:
  nginx_proxy:
    external: true
yncyrydybyl commented 1 year ago

I think you should try to generic -> enabled -> true.

Half-Shot commented 11 months ago

Closing because I think @yncyrydybyl has advised correctly. Please comment if that's not the case.