# 单个 Discourse 站点使用多个应用容器

**URL:** <https://meta.discourse.org/t/multiple-app-containers-for-a-single-discourse-site/393913>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [2026年一月19日 10:03 UTC](https://meta.discourse.org/t/multiple-app-containers-for-a-single-discourse-site/393913 "2026-01-19T10:03:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)\
**Post date:** [2026年一月19日 10:09 UTC](https://meta.discourse.org/t/multiple-app-containers-for-a-single-discourse-site/393913/2 "2026-01-19T10:09:39Z")

</div>

关于上述 HAProxy 设置的另一个补充说明。

HAProxy + Discourse 存在一个常见行为，即重建 Web 容器（例如使用 `./launcher rebuild app1`）时，会短暂返回 `503 Service Unavailable` 响应，因为 HAProxy 在后端重启期间仍在向其发送流量。这本身并不是 Discourse 中的错误——它发生是因为后端在重建过程中暂时不可用。

推荐的解决方法是使用 HAProxy 管理套接字来：

1. 在重建之前禁用 HAProxy 中的服务器，以及
2. 在重建完成后重新启用它

这可以防止瞬态 503 错误。

有一个现有的 Meta 讨论记录了这种行为以及对解决方法​​的解释：

> [@Transient 503s after ./launcher rebuild appN when they’re fronted by HAProxy](https://meta.discourse.org/t/transient-503s-after-launcher-rebuild-appn-when-they-re-fronted-by-haproxy/383179):
>
> I had created a test forum with two web\_only containers, the mail-receiver container, Postgres and Redis on a Docker network. The two web containers nginx’s were fronted by HAProxy. They worked well, but i found on rebuilding one of the two web containers there was always a small amount of downtime where 503 was returned. Fortunately, i found a mitigating workaround, but nothing perfect; before rebuilding app1, run echo "disable server be\_discourse/app1" | socat stdio /run/haproxy/admin.sock …

如果这里有人对滚动重建使用 HAProxy，那么该帖子为 runbook 中包含管理套接字命令提供了有用的背景信息。

---

_[View the full topic](https://meta.discourse.org/t/multiple-app-containers-for-a-single-discourse-site/393913)._
