无法连接到 localhost:6379 上的 Redis (Errno::EADDRNOTAVAIL)

在 CentOS 8 上使用"Docker version 20.10.5, build 55c4c88"安装 Discourse 后,网站已能运行,但向 /draft.json 发送 DELETE 请求时总会超时。

我运行了 Apache,并尝试了 Apache 反向代理和 HAProxy 两种方式,行为表现一致。

我不知道这是否与以下问题有关,但我在 unicorn.stdout.log 中发现了大量此类错误:

==\u003e ./shared/standalone/log/rails/unicorn.stdout.log \u003c==

2021-03-18T10:02:25.138Z pid=108 tid=ocs ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

Starting up 1 supervised sidekiqs

Loading Sidekiq in process id 119

2021-03-18T10:40:09.682Z pid=119 tid=orn ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-03-18T10:40:09.684Z pid=119 tid=ohf ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-03-18T10:40:09.685Z pid=119 tid=owv ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-03-18T10:40:09.683Z pid=119 tid=oob ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-03-18T10:40:09.683Z pid=119 tid=omr ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

Starting up 1 supervised sidekiqs

Loading Sidekiq in process id 121

Redis 是否在 /var/discourse/shared/standalone/log/var-log/redis 中记录任何错误?

这是“current”文件的内容:

53:M 2021 年 3 月 18 日 17:07:05.076 * 300 秒内发生 10 次变更。正在保存...
53:M 2021 年 3 月 18 日 17:07:05.076 * 后台保存已由进程 25018 启动
25018:C 2021 年 3 月 18 日 17:07:05.126 * 数据库已保存到磁盘
25018:C 2021 年 3 月 18 日 17:07:05.127 * RDB:写时复制使用了 2 MB 内存
53:M 2021 年 3 月 18 日 17:07:05.177 * 后台保存成功结束
53:M 2021 年 3 月 18 日 17:12:06.097 * 300 秒内发生 10 次变更。正在保存...
53:M 2021 年 3 月 18 日 17:12:06.098 * 后台保存已由进程 25337 启动
25337:C 2021 年 3 月 18 日 17:12:06.145 * 数据库已保存到磁盘
25337:C 2021 年 3 月 18 日 17:12:06.145 * RDB:写时复制使用了 2 MB 内存
53:M 2021 年 3 月 18 日 17:12:06.198 * 后台保存成功结束

这些日志在我看来没问题。你在使用 Discourse 实例进行导航时是否仍遇到问题?

我仍然无法删除帖子、邀请和作废帖子修改。

这似乎是所有使用 HTTP DELETE 方法的调用中存在的问题。我能否建议 Discourse 改用 POST 方法而不是 DELETE?这看起来类似于 How can Discourse make POST instead of DELETE for "smart" CDN? 中讨论的情况,但我并未使用任何 CDN,只是按照 Discourse 官网的说明,在一台普通的 CentOS 虚拟服务器上通过 Docker 进行了安装。

部分 HAProxy 日志中显示 HTTP DELETE 请求出现 408 错误,@codinghorror,是什么在“丢弃”这些 DELETE 请求?如果这些 DELETE 请求已到达 HAProxy,按理说它们也应能到达 Docker 内部的软件,是否有可能是 Docker 内部的某个组件“导致”了该问题?

Mar 20 01:47:46 id22302.example.com haproxy[43043]: 176.243.177.232:61760 [20/Mar/2021:01:47:16.622] http-in discourse_socket/server3 0/0/0/30004/30034 408 71 - - CD-- 3/3/2/2/0 0/0 "DELETE /draft.json HTTP/1.1"

Mar 20 01:47:46 id22302.example.com haproxy[43043]: 176.243.177.232:61760 [20/Mar/2021:01:47:16.622] http-in discourse_socket/server3 0/0/0/30004/30034 408 71 - - CD-- 3/3/2/2/0 0/0 "DELETE /draft.json HTTP/1.1"

Mar 20 01:48:09 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:47:43.921] http-in discourse_socket/server3 0/0/0/25081/25081 200 396 - - ---- 2/2/1/1/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:48:09 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:47:43.921] http-in discourse_socket/server3 0/0/0/25081/25081 200 396 - - ---- 2/2/1/1/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:48:12 id22302.example.com haproxy[43043]: 176.243.177.232:61887 [20/Mar/2021:01:47:42.886] http-in discourse_socket/server3 0/0/0/30007/30037 408 71 - - CD-- 2/2/1/1/0 0/0 "DELETE /draft.json HTTP/1.1"

Mar 20 01:48:12 id22302.example.com haproxy[43043]: 176.243.177.232:61887 [20/Mar/2021:01:47:42.886] http-in discourse_socket/server3 0/0/0/30007/30037 408 71 - - CD-- 2/2/1/1/0 0/0 "DELETE /draft.json HTTP/1.1"

Mar 20 01:48:25 id22302.example.com haproxy[43043]: 176.243.177.232:62083 [20/Mar/2021:01:48:25.863] http-in discourse_socket/server3 0/0/0/122/122 200 404 - - ---- 2/2/1/1/0 0/0 "POST /topics/timings HTTP/1.1"

Mar 20 01:48:25 id22302.example.com haproxy[43043]: 176.243.177.232:62083 [20/Mar/2021:01:48:25.863] http-in discourse_socket/server3 0/0/0/122/122 200 404 - - ---- 2/2/1/1/0 0/0 "POST /topics/timings HTTP/1.1"

Mar 20 01:48:34 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:48:09.193] http-in discourse_socket/server3 0/0/0/25044/25044 200 396 - - ---- 2/2/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:48:34 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:48:09.193] http-in discourse_socket/server3 0/0/0/25044/25044 200 396 - - ---- 2/2/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:48:59 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:48:34.487] http-in discourse_socket/server3 0/0/0/25087/25087 200 396 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:48:59 id22302.example.com haproxy[43043]: 176.243.177.232:61505 [20/Mar/2021:01:48:34.487] http-in discourse_socket/server3 0/0/0/25087/25087 200 396 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll HTTP/1.1"

Mar 20 01:49:35 id22302.example.com haproxy[43043]: 176.243.177.232:62413 [20/Mar/2021:01:49:35.637] http-in discourse_socket/server3 0/0/0/87/87 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

Mar 20 01:49:35 id22302.example.com haproxy[43043]: 176.243.177.232:62413 [20/Mar/2021:01:49:35.637] http-in discourse_socket/server3 0/0/0/87/87 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

Mar 20 01:50:36 id22302.example.com haproxy[43043]: 176.243.177.232:62714 [20/Mar/2021:01:50:36.568] http-in discourse_socket/server3 0/0/0/81/81 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

Mar 20 01:50:36 id22302.example.com haproxy[43043]: 176.243.177.232:62714 [20/Mar/2021:01:50:36.568] http-in discourse_socket/server3 0/0/0/81/81 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

Mar 20 01:51:37 id22302.example.com haproxy[43043]: 176.243.177.232:62993 [20/Mar/2021:01:51:37.541] http-in discourse_socket/server3 0/0/0/78/78 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

Mar 20 01:51:37 id22302.example.com haproxy[43043]: 176.243.177.232:62993 [20/Mar/2021:01:51:37.541] http-in discourse_socket/server3 0/0/0/78/78 200 417 - - ---- 1/1/0/0/0 0/0 "POST /message-bus/742b0b89384944a7b6376e2d6978889d/poll?dlp=t HTTP/1.1"

这是 production.log,我从未看到删除请求出现,但其他所有操作(如打开帖子、修改、保存等)都已记录:

Completed 200 OK in 81ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 14861)

Started GET "/composer_messages?composer_action=edit&topic_id=10&post_id=13" for 176.243.226.205 at 2021-03-20 15:51:09 +0100

Processing by ComposerMessagesController#index as JSON

Parameters: {"composer_action"=>"edit", "topic_id"=>"10", "post_id"=>"13"}

Completed 200 OK in 1191ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 16940)

Started POST "/presence/publish" for 176.243.226.205 at 2021-03-20 15:51:14 +0100

Processing by Presence::PresencesController#handle_message as */*

Parameters: {"state"=>"editing", "topic_id"=>"10", "post_id"=>"13"}

Completed 200 OK in 9ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 3192)

Started PUT "/t/e-previsto-un-ritorno-di-freddo-nutro/10" for 176.243.226.205 at 2021-03-20 15:51:17 +0100

Processing by TopicsController#update as */*

Parameters: {"title"=>"E' previsto un ritorno di freddo, nutro?", "category_id"=>1, "slug"=>"e-previsto-un-ritorno-di-freddo-nutro", "topic_id"=>"10", "topic"=>{"title"=>"E' previsto un ritorno di freddo, nutro?", "category_id"=>1}}

Completed 200 OK in 19ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 5149)

Started POST "/presence/publish" for 176.243.226.205 at 2021-03-20 15:51:17 +0100

Processing by Presence::PresencesController#handle_message as */*

Parameters: {"state"=>"closed", "topic_id"=>"10"}

Completed 200 OK in 10ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 3159)

Started PUT "/posts/13" for 176.243.226.205 at 2021-03-20 15:51:17 +0100

Processing by PostsController#update as */*

Parameters: {"post"=>{"edit_reason"=>"", "cooked"=>"<p>post di test per vedere. ssss</p>", "raw"=>"post di test per vedere. ssss", "topic_id"=>"10", "raw_old"=>""}, "id"=>"13"}

Completed 200 OK in 3296ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 86638)

Started GET "/t/10.json" for 176.243.226.205 at 2021-03-20 15:51:20 +0100

Processing by TopicsController#show as JSON

Parameters: {"id"=>"10"}

Completed 200 OK in 143ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 52707)

Started GET "/draft.json?draft_key=topic_10" for 176.243.226.205 at 2021-03-20 15:51:27 +0100

Processing by DraftController#show as JSON

Parameters: {"draft_key"=>"topic_10"}

Completed 200 OK in 38ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 4317)

Started GET "/posts/13" for 176.243.226.205 at 2021-03-20 15:51:27 +0100

Processing by PostsController#show as JSON

Parameters: {"id"=>"13"}

Completed 200 OK in 16ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 5026)

Started POST "/presence/publish" for 176.243.226.205 at 2021-03-20 15:51:29 +0100

Processing by Presence::PresencesController#handle_message as */*

Parameters: {"state"=>"editing", "topic_id"=>"10", "post_id"=>"13"}

Completed 200 OK in 20ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 3304)

Started GET "/posts/13" for 176.243.226.205 at 2021-03-20 15:51:38 +0100

Processing by PostsController#show as JSON

Parameters: {"id"=>"13"}

Completed 200 OK in 121ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 56890)

另外,PUMA 日志中未显示 DELETE 请求

2021-03-20 16:01:38 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:38 +0100] "GET /t/e-previsto-un-ritorno-di-freddo-nutro/10 HTTP/1.1" 200 - 1.0685

2021-03-20 16:01:39 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:39 +0100] "GET /uploads/default/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_32x32.png HTTP/1.1" 200 11945 0.0119

2021-03-20 16:01:39 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021 16:01:39] "POST /message-bus/557c51e14e57450c8c76ab216af0a279/poll HTTP/1.1" HIJACKED -1 0.0956

2021-03-20 16:01:42 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:42 +0100] "POST /message-bus/557c51e14e57450c8c76ab216af0a279/poll HTTP/1.1" 200 - 0.0128

2021-03-20 16:01:43 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021 16:01:43] "POST /message-bus/557c51e14e57450c8c76ab216af0a279/poll HTTP/1.1" HIJACKED -1 0.0886

2021-03-20 16:01:54 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:54 +0100] "GET /t/e-previsto-un-ritorno-di-freddo-nutro/10 HTTP/1.1" 200 - 0.1436

2021-03-20 16:01:55 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:55 +0100] "GET /uploads/default/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_32x32.png HTTP/1.1" 200 11945 0.0383

2021-03-20 16:01:56 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021 16:01:56] "POST /message-bus/1bddd2f9aaf54ec5a589bc74c9c8a409/poll HTTP/1.1" HIJACKED -1 0.0453

2021-03-20 16:01:59 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:01:59 +0100] "POST /message-bus/1bddd2f9aaf54ec5a589bc74c9c8a409/poll HTTP/1.1" 200 - 0.0129

2021-03-20 16:01:59 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021 16:01:59] "POST /message-bus/1bddd2f9aaf54ec5a589bc74c9c8a409/poll HTTP/1.1" HIJACKED -1 0.0096

2021-03-20 16:02:07 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:02:07 +0100] "GET /draft.json?draft_key=topic_10 HTTP/1.1" 200 - 0.0131

2021-03-20 16:02:08 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:02:08 +0100] "GET /posts/13 HTTP/1.1" 200 - 0.3559

2021-03-20 16:02:08 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:02:08 +0100] "GET /composer_messages?composer_action=edit&topic_id=10&post_id=13 HTTP/1.1" 200 - 0.2087

2021-03-20 16:02:12 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021:16:02:12 +0100] "POST /presence/publish HTTP/1.1" 200 - 0.0155

2021-03-20 16:02:24 +0100 : |Puma| 176.243.226.205 - - [20/Mar/2021 16:02:24] "POST /message-bus/1bddd2f9aaf54ec5a589bc74c9c8a409/

这意味着你的反向代理配置有误,丢弃了非 GET/POST 请求。这是一个相当常见的问题,也是我们在容器内预配置反向代理的原因之一,这样用户就不必在此问题上费心了。

如果你移除 HAProxy,让容器本身监听 80/443 端口,问题是否仍然存在?

@Falco 刚刚尝试过,问题依然存在。会不会是作为 Web 服务器的 Puma 本身丢弃了 DELETE 请求?

如果您按照 Discourse 官方标准安装指南 进行安装,我们在生产环境中并未使用 Puma。

我们在所有安装实例的整个应用中都使用 DELETE/PUT 动词,并未发现任何问题,因此我猜测这可能是您特定安装环境中的情况。

虽然可能性不大,但 @Andrea_Giovacchini,该域名前是否部署了某种 WAF(Web 应用防火墙)?

我在尝试官方安装遇到同样问题后,已尝试过替代安装方案。

现在我又试了一次官方安装流程(https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md),但在执行“./launcher rebuild app”时失败,报错信息如下(两天前该步骤尚未失败,但当时也受到了 DELETE 问题的影响):

请确保在执行 bundle 安装前,以下命令成功:
`gem install libv8 -v '8.4.255.0' --source 'https://rubygems.org/'`

在 Gemfile 中:
  mini_racer 被解析为 0.3.1,它依赖于
    libv8

/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer/parallel_installer.rb:220:in `handle_error'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer/parallel_installer.rb:102:in `call'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer/parallel_installer.rb:71:in `call'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer.rb:270:in `install_in_parallel'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer.rb:210:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer.rb:90:in `block in run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/process_lock.rb:12:in `block in lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/process_lock.rb:9:in `open'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/process_lock.rb:9:in `lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer.rb:72:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/installer.rb:24:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/cli/install.rb:64:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/cli.rb:259:in `block in install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/settings.rb:115:in `temporary'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/cli.rb:258:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/cli.rb:30:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/cli.rb:24:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/exe/bundle:49:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.15/exe/bundle:37:in `<top (required)>'
  /usr/local/bin/bundle:23:in `load'
  /usr/local/bin/bundle:23:in `<main>'

I, [2021-03-20T23:42:40.998961 #1]  INFO -- : 终止异步进程
I, [2021-03-20T23:42:40.998991 #1]  INFO -- : 向 HOME=/var/lib/postgresql USER=postgres 发送 INT 信号,执行 chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main,进程 ID: 66
I, [2021-03-20T23:42:40.999030 #1]  INFO -- : 向 exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf 发送 TERM 信号,进程 ID: 183
2021-03-20 23:42:40.999 UTC [66] LOG:  收到快速关闭请求
183:signal-handler (1616283760) 收到 SIGTERM,计划关闭...
2021-03-20 23:42:41.013 UTC [66] LOG:  中止任何活跃事务
2021-03-20 23:42:41.014 UTC [66] LOG:  后台工作进程 "logical replication launcher"(PID 75)以退出码 1 退出
2021-03-20 23:42:41.016 UTC [70] LOG:  正在关闭
183:M 20 Mar 2021 23:42:41.058 # 用户请求关闭...
183:M 20 Mar 2021 23:42:41.058 * 在退出前保存最终 RDB 快照。
183:M 20 Mar 2021 23:42:41.061 * 数据库已保存到磁盘
183:M 20 Mar 2021 23:42:41.061 # Redis 现在准备退出,再见...
2021-03-20 23:42:41.263 UTC [66] LOG:  数据库系统已关闭


失败
--------------------
Pups::ExecError: 执行 cd /var/www/discourse && su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development' 失败,返回状态为 #<Process::Status: pid 348 exit 5>
失败位置:/pups/lib/pups/exec_command.rb:112:in `spawn'
执行失败,参数如下:{"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development'"]}
9b0ca932a7dd52ccdd11e268910e3edcd8369c0c08f65e7f8686d542b9be473b
** 引导失败 ** 请向上滚动查看更早的错误信息,可能不止一条。
可尝试运行 ./discourse-doctor 来诊断问题。
➜  discourse git:(master) ✗

@Falco 我重新尝试了官方安装流程,但使用了 “tests-passed” 分支而非 stable 分支。虽然不再出现 mini_racer gem 错误,但仍遇到了 DELETE 请求的问题,正如视频中所示(视频展示了 nginx 日志的 tail 输出以及打开控制台的浏览器)。

POST 请求会立即出现在 nginx 日志中,而 DELETE 请求只有在报错后才会出现,这很奇怪。

这是屏幕录制视频:
https://drive.google.com/file/d/1SEOdZjjVkQTpqT3ZQJ7SaR-Ib2mO6m4M/view?usp=sharing

按照建议,我直接运行 Discourse 并监听 80 端口,中间没有部署其他软件(如 HAPROXY)进行测试。

好的,我会查看一下,并尝试明天复现这个问题。感谢报告。

是的,“稳定版”目前因 bundler 中的回归问题而不幸无法使用。

我们将在未来一天内着手修复。

@Falco 你复现这个问题了吗?

@Andrea_Giovacchini

首先,这里有两个不同的问题:

  1. DELETE 请求被阻止
  2. “stable”分支用户的重建功能失效

问题 2 已于今日通过 https://meta.discourse.org/t/cant-rebuild-current-stable/183859/6?u=falco 修复。

至于问题 1,以下是我的发现:

我运行了一个全新安装的 Discourse,在发送 DELETE 测试命令时,我得到:

curl -X DELETE https://falcoland.falco.dev/draft.json
["BAD CSRF"]%                                               

这是预期的,因为该命令还必须包含有效的用户会话 Cookie。

而在你的网站上:

curl -X DELETE http://apicolturaitalianawebinar.it/draft.json -v
*   Trying 213.229.86.117:80...
* Connected to apicolturaitalianawebinar.it (213.229.86.117) port 80 (#0)
> DELETE /draft.json HTTP/1.1
> Host: apicolturaitalianawebinar.it
> User-Agent: curl/7.75.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Date: Mon, 22 Mar 2021 18:51:55 GMT
< Server: Apache/2.4.37 (centos) OpenSSL/1.1.1g Phusion_Passenger/6.0.4 mod_perl/2.0.11 Perl/v5.26.3
< X-Runtime: 0.001594
< X-Request-Id: ebe50251-0f06-4b71-acd0-887fb2666abb
< X-Powered-By: Phusion Passenger 6.0.4
< Content-Length: 1351
< Status: 404 Not Found
< Content-Type: text/html; charset=UTF-8
< 

这返回了一个来自 Phusion Passenger 的 404 错误。这看起来不像是一个正常的 Discourse 安装 :thinking:

我关闭了 Discourse,因为删除功能的问题导致其无法使用。现在该 URL 已有另一个应用程序在响应。

明白了。既然在新安装中无法复现该问题,我们可以关闭此工单。如果问题再次出现,请新建一个主题并提供复现步骤。

@Falco 我再次将其部署在 http://discourse.apicolturaitalianafb.it/ 上,你可以尝试一下,按照这里的文档进行标准安装。

Curl 命令返回了错误的 CSRF,并立即出现在 Discourse 内部的 Nginx 日志中,但通过界面删除的操作仍然无效,且删除记录在日志中延迟约 35 秒才出现,正如我发送的视频所示。

如果我在 app.yml 中将主机名设置为 discourse.apicolturaitalianafb.it:8880,重新构建后访问 http://discourse.apicolturaitalianafb.it:8880,它能正常工作,但我无法以这种方式使用。

由于我有一台运行生产网站的 Apache 服务器,我尝试按照本网站的文档将其置于 HAProxy 之后,结果 Discourse 的删除功能失效,但你的 Curl 命令仍然有效;我也尝试了 Apache 反向代理,Curl 命令有效,但 Discourse 界面中的删除功能无效。我还尝试将 Discourse 配置为通过 Unix 套接字运行,并通过反向代理连接到该套接字,但问题依旧。

对我而言,证据表明反向代理并没有“阻止”删除操作,而是 Discourse 中的 JavaScript 出于某种原因无法正确执行 HTML 删除。

你测试的全新安装是否直接暴露在外?