手动更新 Discourse 和 Docker 镜像至最新版

:bookmark: 本指南提供了在自托管环境中手动更新 Discourse、Docker 容器和 Ubuntu 操作系统的一步一步的说明。

:person_raising_hand: 所需用户级别:系统管理员

:warning: 需要 SSH 访问服务器。

如果您自托管 Discourse,您需要不时地通过命令行运行手动更新,以获取最新的安全补丁和最新的库。

这些更新不会在 admin/upgrade 中被检测到,这就是您偶尔需要执行这些额外步骤的原因:

更新 Discourse

  1. Discourse 本身应该大约每半个月更新一次,方法是点击您的管理仪表板(admin/upgrade)中的“更新到最新版本”按钮。

  2. 我们建议每两个月通过 SSH 连接到您的 Web 服务器(使用 putty 或您最喜欢的 SSH 客户端)并运行以下命令,特别是当升级页面未显示或您在尝试升级时遇到任何问题时。

cd /var/discourse
./launcher rebuild app

更新 Docker 镜像和 Ubuntu 操作系统

对于 Ubuntu 更新,请_务必_为您的 Ubuntu 启用自动安全更新!命令是:

dpkg-reconfigure -plow unattended-upgrades

然而,这只涵盖了关键安全更新。您应该时不时地像这样获取所有操作系统更新:

apt-get update
apt-get dist-upgrade

这也将通过标准的 docker-ce 包保持 Docker 的最新状态。

总结一下:

  • 每半个月通过 Web 更新器更新 Discourse
  • 每两个月更新容器
  • 每六个月更新操作系统

您可以将这些数字加倍,仍然相当安全,例如,每月更新一次 Discourse,每 4 个月更新一次容器,每年更新一次操作系统,依此类推。

但您真的、_真的_需要启用 Ubuntu 中的自动安全更新,如上所述。

常见问题解答

什么时候是正确的更新时间?

这完全取决于您可用的时间和您想保持在最新技术前沿的程度。如果您有非官方插件,强烈建议使用测试/暂存站点。如果您没有任何非官方插件,您可能会立即升级,但即使如此,一些插件可能也会在团队修复它们期间出现几天的中断(插件数量很多)。

安装了许多插件时,常见的做法是什么?

如果您安装了许多插件,强烈建议在本地或测试服务器上进行测试。特别是如果您有非官方插件,因为某些东西可能会损坏。如果您发现任何东西确实损坏了,那么问题在于,您是否有时间修复它?原始插件作者是否有时间修复它?这两者都可能需要数周时间。所以至少以这种方式,您只有一个损坏的测试站点,而不是一个损坏的生产站点。

我的磁盘空间不足

如果您的磁盘空间不足(使用 df 检查),请尝试使用以下命令清理旧映像:

./launcher cleanup
apt-get autoclean
apt-get autoremove

更新实际的 Ubuntu 服务器版本重要吗,因为 Discourse 始终在 Docker 中运行?

它的重要性要小得多。但您至少应该使用目前受支持的 Ubuntu 服务器 LTS 版本。需要 64 位 Linux 操作系统和现代内核版本。

178 个赞
"Upgrade all" button is awesome!
Ubuntu 16.04 LTS - upgrade or migrate?
Cannot upgrade due to old version of docker
Daily performance reports keep asking to rebuild container
No longer getting notifications for out of date containers
Discourse stopping working - CPU/RAM load?
Manual upgrade fails
Upgrade container - keeping config and data
Installed OK. Working fine for one day. Suddenly stopped working
Issues upgrading from 1.6.0.Beta10+9 to 2.3.0.beta6
Upgrade link no longer works
Update error, website unavailable, possibly plugin related?
How to optimize storage?
Why do I need a block storage?
Digital Ocean hosting: Do I need a system admin?
Will not load, no access to installation, aufs not installed - my fix
Upgrade V2.1 Beta 2 to Beta 4 Require ./launcher rebuild app Twice
Some trouble updating (many bugs)
What makes a successful volunteer Discourse sysadmin?
Searching locks up the server for a while
Link-image not shown
Oops - Error 500 After Update From Admin Dashboard
Crash After Recent Update
Edit CSS/HTML editor cursor offset makes it unusable due to CSS font override
Oops The software powering this discussion forum encountered an unexpected problem
Upgrades via UI disabled - and not being re-enabled after SSH upgrade
Error upgrading, failed to bootstrap
Help after updating from ssh site goes down
My Discourse is Down. Certificate Issue?
Unable to update Discourse...help?
Reset password link error
Empty update page?
My website is always down
Upgrade container - keeping config and data
Failed to update Discourse new version
Unable to upgrade docker_manager
Undefined method `timeout=' for Regexp:Class
How often should I update Discourse?
Migration failed: relation "user_required_fields_versions" already exists
Kernel version upgrade required when manually updating discourse
Cannot rebuild following site failure: "postgres already running"
Visiting /admin/upgrade may lead to a server error
Updating I get a "Configuring openssh-server" message about the "sshd_config" file
Update Not Completing
Problem with api version when updating docker manager
Problem with Upgrade [error 137]
Problem updating my installation
Update in browser vs Terminal
Docker update to latest version
How often should I update Discourse?
Self hosted Reply by Email stopped working after latest update
Error 500 how to fix?
Site down after UI update
Docker update to latest version
Selectable avatars upload broken (Missing required UppyUpload config: id)
Discourse broken after failed upgrade
How to tell whether to upgrade via web or console?
Oops The software powering this discussion forum encountered an unexpected problem
Determining whether my VPS needs any upgrades (generally)
Kernel version upgrade required when manually updating discourse
Upgrade button is 500-ing for me
1.4.3 Upgrade Oddity?
Add path to cookie
Your Docker installation is not working correctly - no space left on device - safe to use ./launcher cleanup?
PNG's a no show
Upgrade from v2.0.0.beta10 +37 to 2.1.0.beta1 does fail
Kernel Panic after droplet reboot... What now?
Failed to bootstrap 1.6.0.beta 8 with out of date docker
Problem with category style = box under firefox
Site fails to load with js errors
ERROR: You are running an old version of the Discourse image
Service not available | Update Error due to broken plugin
What do you want to do about modified configuration file grub?
Failed Upgrade Discourse and Plugins
Insert Date Timezone is always UTC ; my Timezone is ignored
Admin upgrade page does not exist
Upgrading from 2.9.0.beta8 broke the site, unrecoverable
Error when upgrading and would like to solve or reset
Update failed - Not starting
Failed to rebuild: no such file /usr/local/etc/ImageMagick-6/policy.xml
Upgrade ends with FAILED TO BOOTSTRAP
"400 Bad Request" error after upgrading
Hello, after clicking login, it takes 20 seconds to load before you can enter my page. why?