如何在不重新构建的情况下安装插件(或设置维护消息)

Hi.

I’m searching for a solution that don’t make me rebuild my Discourse when I install a new plugin, which cause a long downtime.
On some forum scripts (like PHPBB, FluxBB, etc…), we can install a plugin without causing a downtime.

I’m also looking for a solution to set a message when the users visits my rebuilding Discourse who says that the forum is currently in maintainance (instead of the web browser error).

Thanks!

1 个赞

It’s really not possible to install a plugin without rebuilding afaik.

This can be done by setting up an offline page while rebuilding here is a guide:

2 个赞

The solution is to use a two-container install. This will let you build a new image while the old one keeps running. The amount of downtime is just what it takes to shutdown the old container and start the new one.

7 个赞

Thanks, I will follow your solution.

A more advanced version can include a load balancer in front of the application container(s) to reduce downtime to a bare minimum right?

1 个赞

Yes, I’ve experimented with having HAproxy in front of two containers, so it should be possible to leave the old server running, crank up the new one, shut down the old one with no downtime. I’ve not yet gotten it working correctly, however.

1 个赞

Can you tell me what kind of issues you had?

1 个赞

I’ll need to crank it up again and document it. It’ll take a while to figure it out again. :frowning:

1 个赞

抱歉回复旧帖,但此帖在 Google 搜索结果中排名靠前,而我也遇到了同样的“问题”。这需要在 Docker 容器中进行一些操作,因此如果您不清楚自己在做什么,不建议在生产环境中执行。SSH 登录服务器后的操作步骤:
您正在执行不受支持的操作,不提供任何形式的保证!

# cd /var/discourse
# ./launcher enter app
# su discourse
$ cd /var/www/discourse/plugins
$ git clone <plugin_git_url>
$ exit
# exit
# docker restart app

容器启动期间仍会有少量停机时间,但比完整重建快得多(在最小的 DigitalOcean 实例上,前者只需几秒,后者则需数分钟)。

3 个赞

你好!
您很可能在寻找以下内容:

1 个赞

您也可以

  sv restart unicorn 

在容器内执行此操作,这比重启容器稍快一些。

此外,对于某些插件,您可能需要迁移数据库。

3 个赞