mtakaki / cachet-url-monitor

URL monitor plugin for cachethq.io
MIT License
125 stars 49 forks source link

api_url is incorrect when CachetHQ send a email in button "manage subscriptions" #45

Open nasatome opened 6 years ago

nasatome commented 6 years ago

with the following docker-compose (I'm behind a reverse proxy: traefik)

version: "3"

services:
  postgres:
    image: postgres:10-alpine
    volumes:
      - ./db_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=postgress
      - POSTGRES_PASSWORD=postgress
      - POSTGRES_DB=postgress
    networks:
      - cachethq_internal
    restart: always

  cachet:
    image: cachethq/docker:2.3-latest
    networks:
      - ak_cachethq_outside
      - ak_cachethq_internal
#    environment:
#...
    depends_on:
      - postgres
    restart: always
  cachet_url_monitor:
    image: mtakaki/cachet-url-monitor
    networks:
      - ak_cachethq_internal
    depends_on:
      - cachet
    volumes:
      - ${PWD}/.config.yml:/usr/src/app/config/config.yml:ro
    restart: always

networks:
  cachethq_outside:
    external:
      name: traefik_proxy
  cachethq_internal:
    driver: bridge

And the following configuration:

endpoint:
  url: https://myworpresspage.com
  method: GET
  timeout: 1 # seconds
  expectation:
    - type: HTTP_STATUS
      status_range: 200-300
    - type: LATENCY
      threshold: 1
    - type: REGEX
      regex: ".*WORDPRESS FOOTER HOOK.*"
  allowed_fails: 0
cachet:
  api_url: http://cachet:8000/api/v1
  token: xxxxxxxxxxxxxxxxxxx
  component_id: 1
  metric_id: 1
  action:
    - CREATE_INCIDENT
    - UPDATE_STATUS
  public_incidents: true
frequency: 30
latency_unit: ms

It works perfectly, but when cachetHQ sends an email, in the URL inside the email, redirects me to http://cachet:8000/subscribe/manage/xxxxxxx instead of https://status.myworpresspage.com/subscribe/manage/xxxxxxx in button "manage subscriptions"

I do not understand the API very well, but you could place an API URL and a LINK (A hyperlink to the component)???

mtakaki commented 4 years ago

Lemme try understand this better. The hostname cachet is only available from your private network, but your public hostname is status.mywordpresspage?

nasatome commented 4 years ago

That's right.: The hostname cachet is only available from my private network, but my public hostname is status.mywordpresspage.com

mtakaki commented 4 years ago

@nasatome did you figure this out?

nasatome commented 4 years ago

That's right, that's why I mentioned it. is a minor bug so if you like, you can close this issue

mtakaki commented 4 years ago

Have you tried setting up the Site URL under /dashboard/settings/setup? Have you tried putting the public hostname there? If that doesn't, I recommend you reaching out to the folks that owns CachetHQ. We own only until we create the incident on cachet and anything after that is under CachetHQ's ownership.

Would mind giving an update after you try this out?

thomvaill commented 4 years ago

I had the same issue, because APP_URL / Site URL is not taken into account. Here is an ugly hotfix: https://github.com/CachetHQ/Cachet/issues/3952