首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通知/集线器上的Traefik 2和bitwarden协议ws

通知/集线器上的Traefik 2和bitwarden协议ws
EN

Stack Overflow用户
提问于 2019-10-20 23:34:52
回答 1查看 3.6K关注 0票数 2

我正在使用Traefik2.0 (v2),并尝试在我服务器上配置bitwardenrs。

这是我的docker-compose.yml:

代码语言:javascript
复制
version: "3"

services:
  bitwarden:
    image: bitwardenrs/server
    restart: always
    volumes:
      - ./bw-data:/data
    environment:
      WEBSOCKET_ENABLED: "true" # Required to use websockets
      SIGNUPS_ALLOWED: "false"
      ADMIN_TOKEN: "myadmintoken"
    networks:
      - traefik_network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.bitwardenRouter.rule=Host(`mywebsite.com`)"
      - "traefik.http.routers.bitwardenRouter.entrypoints=web-secured"
      - "traefik.http.routers.bitwardenRouter.tls=true"
      - "traefik.http.routers.bitwardenRouter.tls.options=default"
      - "traefik.http.routers.bitwardenRouter.tls.certResolver=letsencrypt"

networks:
  traefik_network:
    external: true

当我这样做的时候,我有一个错误:

代码语言:javascript
复制
bitwarden_1  | [2019-10-20 15:12:07][rocket::rocket][INFO] POST /notifications/hub/negotiate text/plain; charset=UTF-8:
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Matched: POST /notifications/hub/negotiate (negotiate)
bitwarden_1  | [2019-10-20 15:12:07][rocket::rocket][INFO] GET /api/sync?excludeDomains=true application/json:
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Matched: GET /api/sync?<data..> (sync)
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Outcome: Success
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Response succeeded.
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Outcome: Success
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Response succeeded.
bitwarden_1  | [2019-10-20 15:12:07][rocket::rocket][INFO] GET /notifications/hub?id=myId&access_token=myToken:
bitwarden_1  | [2019-10-20 15:12:07][_][INFO] Matched: GET /notifications/hub (websockets_err)
bitwarden_1  | [2019-10-20 15:12:07][bitwarden_rs::error][ERROR] '/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.. '/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.

这是错误:

代码语言:javascript
复制
[2019-10-20 15:12:07][bitwarden_rs::error][ERROR] '/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.. '/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.

我试图找到如何使用traefik 1.7,我发现了以下内容:

代码语言:javascript
复制
- traefik.hub.frontend.rule=Host:bitwarden.domain.tld;Path:/notifications/hub
- traefik.hub.port=3012
- traefik.hub.protocol=ws

但这不适用于traefik的V2。我是这样问的,但也不管用:

代码语言:javascript
复制
- "traefik.http.routers.notificationBitwardenRouter.rule=(Host(`mywebsite.com`) && Path(`/notifications/hub`))"
- "traefik.http.routers.notificationBitwardenRouter.entrypoints=web-secured"
- "traefik.http.services.notificationBitwardenRouter.loadbalancer.server.port=3012"
- "traefik.http.services.notificationBitwardenRouter.loadbalancer.server.protocol=ws"
- "traefik.http.services.notificationBitwardenService.loadBalancer.servers=0.0.0.0:3012"

有人能帮帮我吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-23 16:56:56

https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples已使用traefik v2进行了更新。

迁移到Traefik v2的Traefik v1标签

代码语言:javascript
复制
labels:
  - traefik.enable=true
  - traefik.docker.network=traefik
  - traefik.http.routers.bitwarden-ui.rule=Host(`bitwarden.domain.tld`)
  - traefik.http.routers.bitwarden-ui.service=bitwarden-ui
  - traefik.http.services.bitwarden-ui.loadbalancer.server.port=80
  - traefik.http.routers.bitwarden-websocket.rule=Host(`bitwarden.domain.tld`) && Path(`/notifications/hub`)
  - traefik.http.routers.bitwarden-websocket.service=bitwarden-websocket
  - traefik.http.services.bitwarden-websocket.loadbalancer.server.port=3012

迁移的标签加上HTTP到HTTPS的重定向

这些标签假设Traefik中为端口80和443定义的入口点分别是'web‘和'websecure’。

这些标签还假设您已经在Traefik中定义了默认证书解析器。

代码语言:javascript
复制
labels:
  - traefik.enable=true
  - traefik.docker.network=traefik
  - traefik.http.middlewares.redirect-https.redirectScheme.scheme=https
  - traefik.http.middlewares.redirect-https.redirectScheme.permanent=true
  - traefik.http.routers.bitwarden-ui-https.rule=Host(`bitwarden.domain.tld`)
  - traefik.http.routers.bitwarden-ui-https.entrypoints=websecure
  - traefik.http.routers.bitwarden-ui-https.service=bitwarden-ui
  - traefik.http.routers.bitwarden-ui-http.rule=Host(`bitwarden.domain.tld`)
  - traefik.http.routers.bitwarden-ui-http.entrypoints=web
  - traefik.http.routers.bitwarden-ui-http.middlewares=redirect-https
  - traefik.http.routers.bitwarden-ui-http.service=bitwarden-ui
  - traefik.http.services.bitwarden-ui.loadbalancer.server.port=80
  - traefik.http.routers.bitwarden-websocket-https.rule=Host(`bitwarden.domain.tld`) && Path(`/notifications/hub`)
  - traefik.http.routers.bitwarden-websocket-https.entrypoints=websecure
  - traefik.http.routers.bitwarden-websocket-https.service=bitwarden-websocket
  - traefik.http.routers.bitwarden-websocket-http.rule=Host(`bitwarden.domain.tld`) && Path(`/notifications/hub`)
  - traefik.http.routers.bitwarden-websocket-http.entrypoints=web
  - traefik.http.routers.bitwarden-websocket-http.middlewares=redirect-https
  - traefik.http.routers.bitwarden-websocket-http.service=bitwarden-websocket
  - traefik.http.services.bitwarden-websocket.loadbalancer.server.port=3012
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58474538

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档