androidseb25 / iGotify-Notification-Assistent

Docker container for sending Gotify notifications to iOS devices (bridge to gotify websocket)
MIT License
132 stars 6 forks source link

Fragen zur Konfiguration hinter Traefik, wie kann ich testen? #9

Closed buzzzerde closed 9 months ago

buzzzerde commented 9 months ago

Moin Sebastian,

erstmal danke für diesen Container. Ich möchte den Notification Assistent solo laufen lassen. Allerdings laufen meine Docker Container alle hinter einem Reverse Proxy (Traefik). Gotify läuft einwandfrei und die iGotify App findet den Server. Gebe ich meine API URL ein, bekomme ich immer den Fehler: "Keinen API Server gefunden."

Ich vermute, dass ich bei den Labels im docker-compose.yaml etwas falsch habe. Diese sehen so aus: labels: traefik.enable: "true" traefik.http.routers.igotify-notification.entrypoints: "websecure" traefik.http.routers.igotify-notification.rule: "Host(igotify.URL.de)" traefik.http.routers.igotify-notification.tls: "true" traefik.http.routers.igotify-notification.tls.certresolver: "http_resolver" traefik.http.services.igotify-notification-traefik.loadbalancer.server.port: "8681" traefik.docker.network: "proxy" traefik.http.routers.igotify-notification.middlewares: "default@file"

Hast Du da eine Idee?

Danke und Viele Grüße!

androidseb25 commented 9 months ago

Puuuh gute frage nächste frage ich bin eher der NPM freund, deswegen kenn ich mich mit traefik nicht aus.

Sorry, aber was ich als hinweis geben kann ist das der websocket aktiviert sein muss, damit das alles funktioniert

buzzzerde commented 9 months ago

Tjo schade. Container scheitert auch tatsächlich am Websocket. Auf die schnelle hab ich jetzt nichts gefunden, was hilft. Fehler: Connecting to server Client - Token: Gotify - Url: wss://gotify..de//stream?token=*** info: Microsoft.Hosting.Lifetime[14] Now listening on: http://[::]:8080 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /app info: Quartz.Core.QuartzScheduler[0] Scheduler QuartzScheduler_$_NON_CLUSTERED started. Unable to Connect to WS or WSS connection aborted at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue) at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken) at iGotify_Notification_Assist.GotifySocketService.Start() in /src/GotifySocketService.cs:line 82

majo1989 commented 9 months ago

traefik.http.services.igotify-notification-traefik.loadbalancer.server.port: "8681"

Lauscht iGotify intern nicht auf 8080? Müsste somit dann nicht dieser Port genommen werden?

androidseb25 commented 9 months ago

traefik.http.services.igotify-notification-traefik.loadbalancer.server.port: "8681"

Lauscht iGotify intern nicht auf 8080? Müsste somit dann nicht dieser Port genommen werden?

Nein, hier mal ne kurze Erklärung, wer es genauer wissen will muss sich die docker docs mal lesen.

8681 = Public Port von der Host Seite 8080 = interner Port vom Container

majo1989 commented 9 months ago

Nein, hier mal ne kurze Erklärung, wer es genauer wissen will muss sich die docker docs mal lesen.

8681 = Public Port von der Host Seite 8080 = interner Port vom Container

Das ist schon klar, aber ich gehe davon aus, dass der Public Port nicht exposed wird, denn solange der Container im selben Neztwerk wie der Traefik Container ist, greifen die entsprechenden Traefik-Labels. Ich pers. bin auch eher der NPM-Freund, aber bei Traefik läuft das etwas anders.

Hier ist da eigentlich ein schönes Bsp. unter Punkt 10.1 anhand von Wordpress: https://goneuland.de/traefik-v2-3-reverse-proxy-mit-crowdsec-im-stack-einrichten/#101_Neuen_Container_hinzufuegen

buzzzerde commented 9 months ago

traefik.http.services.igotify-notification-traefik.loadbalancer.server.port: "8681"

Lauscht iGotify intern nicht auf 8080? Müsste somit dann nicht dieser Port genommen werden?

Habs nun auch mit 8080 probiert, leider der gleiche Fehler. Ich hab tatsächlich auch die Trafik-Docker Konfiguration von goneuland übernommen.

majo1989 commented 9 months ago

traefik.http.services.igotify-notification-traefik.loadbalancer.server.port: "8681"

Lauscht iGotify intern nicht auf 8080? Müsste somit dann nicht dieser Port genommen werden?

Habs nun auch mit 8080 probiert, leider der gleiche Fehler. Ich hab tatsächlich auch die Trafik-Docker Konfiguration von goneuland übernommen.

Also bei mir klappt es einwandfrei mit den folgenden Labels und dem Port 8080:

labels: traefik.docker.network: proxy traefik.enable: "true" traefik.http.routers.igotify-secure.entrypoints: websecure traefik.http.routers.igotify-secure.middlewares: default@file traefik.http.routers.igotify-secure.rule: Host(igotify.domain-name.de) traefik.http.routers.igotify-secure.service: igotify traefik.http.routers.igotify-secure.tls: "true" traefik.http.routers.igotify-secure.tls.certresolver: http_resolver traefik.http.routers.igotify.entrypoints: web traefik.http.routers.igotify.rule: Host(igotify.domain-name.de) traefik.http.services.igotify.loadbalancer.server.port: "8080"

Du müsstest natürlich noch die URL anpassen. Ansonsten poste mal bitte dein Compose-file anonymisiert in die Kommentare.

buzzzerde commented 9 months ago

Hm, irgendwo muss doch mein Denkfehler sein. Ich hatte die selben Labels, ausser diesen beiden: traefik.http.routers.igotify.entrypoints: web traefik.http.routers.igotify.rule: Host(igotify.domain-name.de)

Sind jetzt mit drin, klappt aber nicht. Hier die komplette yaml:

version: "3.8" services: igotify-notification: # (iGotify-Notification-Assistent) environment:

  • IGOTIFY_CLIENT_TOKEN="token" # create a client in gotify an add here the client token
  • GOTIFY_SERVER_URL="https://gotify.URL.de/" # default container name from gotify server image: ghcr.io/androidseb25/igotify-notification-assist:latest pull_policy: always restart: unless-stopped networks:
    • proxy labels: traefik.docker.network: proxy traefik.enable: "true" traefik.http.routers.igotify-secure.entrypoints: websecure traefik.http.routers.igotify-secure.middlewares: default@file traefik.http.routers.igotify-secure.rule: Host(igotify.URL.de) traefik.http.routers.igotify-secure.service: igotify traefik.http.routers.igotify-secure.tls: "true" traefik.http.routers.igotify-secure.tls.certresolver: http_resolver traefik.http.routers.igotify.entrypoints: web traefik.http.routers.igotify.rule: Host(igotify.URL.de) traefik.http.services.igotify.loadbalancer.server.port: "8080" volumes:
  • /foo/bar/igotify-notification:/app/data

networks: proxy: external: true

Fehler: Unable to Connect to WS or WSS connection aborted at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue) at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken) at iGotify_Notification_Assist.GotifySocketService.Start() in /src/GotifySocketService.cs:line 82

majo1989 commented 9 months ago

Hm, irgendwo muss doch mein Denkfehler sein. Ich hatte die selben Labels, ausser diesen beiden: traefik.http.routers.igotify.entrypoints: web traefik.http.routers.igotify.rule: Host(igotify.domain-name.de)

Sind jetzt mit drin, klappt aber nicht. Hier die komplette yaml:

version: "3.8" services: igotify-notification: # (iGotify-Notification-Assistent) environment:

  • IGOTIFY_CLIENT_TOKEN="token" # create a client in gotify an add here the client token
  • GOTIFY_SERVER_URL="https://gotify.URL.de/" # default container name from gotify server image: ghcr.io/androidseb25/igotify-notification-assist:latest pull_policy: always restart: unless-stopped networks:
  • proxy labels: traefik.docker.network: proxy traefik.enable: "true" traefik.http.routers.igotify-secure.entrypoints: websecure traefik.http.routers.igotify-secure.middlewares: default@file traefik.http.routers.igotify-secure.rule: Host(igotify.URL.de) traefik.http.routers.igotify-secure.service: igotify traefik.http.routers.igotify-secure.tls: "true" traefik.http.routers.igotify-secure.tls.certresolver: http_resolver traefik.http.routers.igotify.entrypoints: web traefik.http.routers.igotify.rule: Host(igotify.URL.de) traefik.http.services.igotify.loadbalancer.server.port: "8080" volumes:
  • /foo/bar/igotify-notification:/app/data networks: proxy: external: true

Fehler: Unable to Connect to WS or WSS connection aborted at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue) at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken) at iGotify_Notification_Assist.GotifySocketService.Start() in /src/GotifySocketService.cs:line 82

OK und wo ist da der Teil vom Gotify-Container, läuft der in einer sep. Compose-File?

buzzzerde commented 9 months ago

Jo der ist separat.

version: '3.3' services: server: networks:

networks: proxy: external: true

Die Konfiguration hab ich von hier: https://florianjensen.com/2020/10/07/traefik-2-and-gotify-websockets/

Muss das alles in eine? Können die sonst nicht kommunizieren? Dachte das geht einfach über die URL mit dem Token...

androidseb25 commented 9 months ago

Nein die müssen nicht ins selbe Docker compose file.

Kurze Frage falls es funktioniert kann ich die Lösung dann in die Readme mit übernehmen?

buzzzerde commented 9 months ago

Na klar. Ich sage Bescheid wenn es läuft :)

buzzzerde commented 9 months ago

Wegen der Fehlermeldung hatte ich ich es in der App garnicht mehr versucht. Eben also trotzdem mal die Daten eingegeben. Gotify Server und API Server klappt. Im Docker Container gibts dann noch ne neue Warnung:

Connecting to server Client - Token: CWceXwp5kB_G4x0 Gotify - Url: wss://URL//stream?token=TOKEN Unable to Connect to WS or WSS connection aborted at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue) at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken) at iGotify_Notification_Assist.GotifySocketService.Start() in /src/GotifySocketService.cs:line 82 warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect.

Bei Nutzer und Passwort komme ich nicht weiter. Ich habe den Admin User probiert und auch einen neuen User angelegt, immer stimmt angeblich Passwort oder Token nicht ...

Hat da noch jemand eine Idee?

Edit: Ok ich bin dumm. URL und Token waren noch drin ...

androidseb25 commented 9 months ago

Also dein fett geschriebener Part kannst du ignorieren, die Meldung kommt nur weil er ein Redirect auf http im Container macht.

buzzzerde commented 9 months ago

@majo1989 Hast Du noch ne Idee oder kannst Du mal Deine kompletten Docker Files zeigen?

majo1989 commented 9 months ago

Das hier ist meine, mit der klappt es bei mir!

version: "3.8"

services:
  gotify:
    container_name: gotify
    image: gotify/server
    environment:
      - GOTIFY_DEFAULTUSER_PASS=Passwort_vergeben
      - TZ=Europe/Berlin
      - GOTIFY_REGISTRATION=false
    labels:
      traefik.docker.network: proxy
      traefik.enable: "true"
      traefik.http.routers.gotify-secure.entrypoints: websecure
      traefik.http.routers.gotify-secure.middlewares: default@file
      traefik.http.routers.gotify-secure.rule: Host(`gotify.domain-name.de`)
      traefik.http.routers.gotify-secure.service: gotify
      traefik.http.routers.gotify-secure.tls: "true"
      traefik.http.routers.gotify-secure.tls.certresolver: http_resolver
      traefik.http.routers.gotify.entrypoints: web
      traefik.http.routers.gotify.rule: Host(`gotify.domain-name.de`)
      traefik.http.services.gotify.loadbalancer.server.port: "80"
    networks:
      default: null
      proxy: null
    restart: unless-stopped
    volumes:
      - gotify-data:/app/data

  igotify-notification: # (iGotify-Notification-Assistent)
    container_name: igotify-notification
    image: ghcr.io/androidseb25/igotify-notification-assist:latest
  # pull_policy: always
    environment:
      - IGOTIFY_CLIENT_TOKEN="Client-Token"  # create a client in gotify an add here the client token
      - GOTIFY_SERVER_URL="http://gotify"  # default container name from gotify server
    labels:
      traefik.docker.network: proxy
      traefik.enable: "true"
      traefik.http.routers.igotify-secure.entrypoints: websecure
      traefik.http.routers.igotify-secure.middlewares: default@file
      traefik.http.routers.igotify-secure.rule: Host(`igotify.domain-name.de`)
      traefik.http.routers.igotify-secure.service: igotify
      traefik.http.routers.igotify-secure.tls: "true"
      traefik.http.routers.igotify-secure.tls.certresolver: http_resolver
      traefik.http.routers.igotify.entrypoints: web
      traefik.http.routers.igotify.rule: Host(`igotify.domain-name.de`)
      traefik.http.services.igotify.loadbalancer.server.port: "8080"
    networks:
      default: null
      proxy: null
    restart: always
    volumes:
      - igotify-notification-data:/app/data

networks:
  default:
  proxy:
    external: true
volumes:
  gotify-data:
  igotify-notification-data:
buzzzerde commented 9 months ago

Frohes neues! Ich hab noch so einiges probiert und hatte Erfolge aber auch Probleme. Mit Deinem DockerFile geht es nun bei mir. Ich teste mal ein wenig weiter und würde bei Bedarf ein neues issue aufmachen. Danke an @majo1989 & @androidseb25

androidseb25 commented 9 months ago

Frohes neues, Kannst du gegebenenfalls deine Config posten, damit ich das in die ReadMe packen könnte?

buzzzerde commented 9 months ago

Ich hab die oben von majo1989 genutzt. https://github.com/androidseb25/iGotify-Notification-Assistent/issues/9#issuecomment-1872170485

majo1989 commented 8 months ago

Frohes neues, Kannst du gegebenenfalls deine Config posten, damit ich das in die ReadMe packen könnte?

Du kannst natürlich auch meine config in die ReadMe packen ;-)