我阅读了许多关于在 Traefik 代理后面运行 Discourse 的帖子,但似乎仍然缺少一些东西。
从主机上,如果我 curl 容器的内部 IP,我可以看到 Discourse 设置向导 HTML 返回,并且 Traefik 报告服务可用:
但是,当我尝试连接到通过 Traefik 的域时,我可以看到预期的 https 证书,但在几秒钟后收到 504 错误。
这是我的 Discourse 配置:
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
expose:
#- "80:80" # http
#- "443:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
DISCOURSE_HOSTNAME: 'redacted'
DISCOURSE_DEVELOPER_EMAILS: 'redacted'
DISCOURSE_SMTP_ADDRESS: smtp.postmarkapp.com
DISCOURSE_SMTP_USER_NAME: redacted
DISCOURSE_SMTP_PASSWORD: redacted
DISCOURSE_NOTIFICATION_EMAIL: noreply@redacted
## Docker container is stateless; all data is stored in /shared
volumes:
- volume:
host: /opt/discourse/shared/standalone
guest: /shared
- volume:
host: /opt/discourse/shared/standalone/log/var-log
guest: /var/log
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
docker_args:
- "-l traefik.enable=true"
- "-l traefik.http.routers.discourse.tls=true"
- "-l traefik.http.routers.discourse.rule=Host(`redacted`)"
- "-l traefik.http.routers.discourse.entrypoints=websecure"
- "-l traefik.http.routers.discourse.tls.certresolver=ledns"
- "-l traefik.http.services.discourse.loadbalancer.server.port=80"
- "-l traefik.http.services.discourse.loadbalancer.server.scheme=http"
run:
- exec: echo "Beginning of custom commands"
- exec: echo "End of custom commands"
我在同一个 Traefik 实例中有许多其他服务配置类似,位于不同的主机上,它们都可以正常工作。
在 Discourse nginx 访问日志中,我可以看到当我 curl 本地 IP 时发出的请求,但当我 curl 域时看不到。
有什么建议可以补充吗?似乎它在 Traefik 和 nginx 之间丢失了。
