多站点与多个容器

Does anyone know the pros and cons of multisite vs multiple containers?

I currently have three Discourse instances as separate containers, and am thinking about converting two, maybe three more forums to Discourse - they’ll be on the same server (64GB RAM, running SSDs) so I’m wondering what might be the best way forward.

I’d prefer them to be as independent as possible, so each can be upgraded individually, backed up and restored individually, and issues with one should not affect another.

What do you suggest? Any pros and cons to look out for?

You won’t be able to upgrade individually with multisite, nor will you be able to segment plugins used. All of that is defined by the root multisite. Settings, themes, and backups can all happen separately, though.

Generally you’ll need a proxy in front to help with SSL certs, too.

3 个赞

Actually, I’ve worked out a way to get let’s encrypt to get certs for multiple domains and not redirect to the primary domain. Setup Multisite Configuration with Let's Encrypt and no Reverse Proxy

@AstonJ, would you be interested in testing my howto? I’m 90% sure that it works, but it was some weeks ago that I last tested and I’m not entirely sure that the instructions “work” for someone who’s not me.

If you want all the sites to have the same plugins and be upgraded all at the same time, multisite is great.

3 个赞

I could just switch off any unused plugins via the ACP (and I think there’s only one that one of the forums won’t need) so I guess it depends on are there any benefits to doing multisite? Specifically, performance and/or stability?

I think I read @Blake once post that it’s insane not to run PG in it’s own container (is that different to multisite?) hence why I’ve been thinking about doing this. Btw don’t quote me on what Blake said I could have well dreamt it :rofl:

I use HAProxy which deals with our SSL certs so I ‘think’ that may be ok.

I think it will depend on the benefits Jay - if there’s not much difference then I don’t mind carrying on as I have been as it’s become relatively easy to set-up and manage, but if there are some big advantages to going multisite I would definitely be interested :sunglasses:

The other advantage is that you’re running just one more copy of rails and nginx, so the additional RAM required is much less. You’ve got lots of RAM, though, so going with what works already is starting to sound like the best idea.

2 个赞

您好。是否可以将多站点用户合并,以便用户只需在一个站点注册即可同时在所有多站点上注册(如 Magento 中)?或者使用类似联合的 Discourse 超级变体。这样警报就可以同步工作,站点 1 的用户可以接收来自站点 2 的警报?聊天也同样如此。
我有 4 个同属一个大方向但主题不同的社区,我希望这些社区能够紧密集成在一起

您可以将一个站点设置为 discourse connect 身份验证服务器,并让所有其他站点以此服务器进行身份验证。

2 个赞

我正在尝试弄清楚我是否需要一个多站点设置、多个容器或其他东西。

我目前有 3 个独立的社区,其中两个相似(都关于大学体育,但针对两所不同的学校),第三个关于烹饪和烘焙。

我想将它们都放在同一台服务器上(因为我的 ISP 有 IP 地址限制),但使用不同的 URL,有点像这样:

foo.bar.com/team1
foo.bar.com/team2
foo.bar.com/cooking

team1.bar.com 重定向到 foo.bar.com/team1 等,或者到单独的虚拟服务器也可以。(我知道 Apache 可以做到这一点,所以我假设 nginx 也可以,无论是直接还是在前面放置一个代理服务器。)

理想情况下,foo.bar.com 本身将作为这些独立社区的网关,解释它们是什么以及如何访问它们。每个社区中的某些类别可能可以公开读取并被网络爬虫访问,以便它们出现在网络搜索中。

这是一个多站点设置还是多容器设置,或者完全是其他东西?

运行 Multisite 时是否有任何已知的插件设计陷阱?

看起来我的 Chatbot 不支持 Mulitsite(所以这是一个已知问题),但我想了解原因:它在标准安装上运行正常。

具体来说,似乎 setup db task 和可能 this job 存在问题。

1 个赞

我想更新一下我的情况。

研究之后,我决定需要一个多站点设置(目前是一个容器),并在外部设置一个 nginx 站点来解释设置并将人员和流量引导至单独的 discourse 站点。这样,我就可以让两个站点都对访问者(和网络爬虫)开放只读访问,而无需 list1 的用户处理来自 list2 的内容。我可能需要调整 robots.txt 来满足网络爬虫的要求。

多站点设置的示例很有启发性,但我无法使用 Unix 套接字(网关错误)使其正常工作,因此我最终将其转发到另一个端口,并将该端口重定向到容器内的 443。

在我的 app.yml 文件中,我启用了 SSL 模板,但未启用 letsencrypt 模板。

我已经让测试站点正常工作了,现在我正在寻找在将生产站点转换时可能出现的任何问题,希望在本月晚些时候或下个月进行。

我正在处理外部服务器端的证书问题,但遇到了“不安全”的问题,我通过在容器中强制使用 https 来解决。我有一个任务将通过 cron 运行,将最新的证书和密钥复制到容器的 /shared/ssl 目录(作为 ssl.crt 和 ssl.key)。我不确定是否需要强制重新加载容器内的 nginx 以确保在证书更改时(我认为是在七月)加载新证书。

我确实遇到了一个 discourse 的陷阱:

在容器的 /etc/nginx/conf.d/discourse.conf 文件中,有这个代码片段(域名已更改):

if ($http_host != 'site1.my.domain') {
   rewrite (.*) https://site1.my.domain$1 permanent
}

这导致 site2.my.domain 被重定向到 site1.my.domain,所以我不得不注释掉它。

注意:重建容器需要重新进行此编辑,是否有办法避免这种情况?

这还导致了一个浏览器陷阱,因为现在 Firefox 已将该重定向标记为永久性,所以我必须删除浏览器缓存。(这花了我太长时间才弄明白!)

我还发现了其他一些奇怪的事情。

在我的测试站点上,强制使用 https 的参数未为任一站点选中。在我的生产站点上,该参数甚至不存在于设置文件中。我猜测这与两个站点之间的差异有关。