Actualizar manualmente Discourse y la imagen Docker a la última versión

:bookmark: This guide provides step-by-step instructions for manually updating Discourse, the Docker container, and the Ubuntu operating system on a self-hosted setup.

:person_raising_hand: Required user level: System Administrator

:warning: SSH access to the server.

If you self-host Discourse, you occasionally need to run a manual update via the command line to get the latest security releases newest libraries.

These updates are not picked up in admin/update, which is why you’ll occasionally need to do these additional steps:

Updating Discourse

  1. Discourse itself should be updated about twice a month, by clicking the “Update to Latest Version” button in your admin dashboard (admin/update).

  2. Every two months we recommend SSH’ing into your web server (using putty or your favorite SSH client) and running the following commands, especially if the upgrade page doesn’t show up or you have any issues when trying to upgrade.

cd /var/discourse
./launcher rebuild app

Updating the Docker image and Ubuntu OS

For Ubuntu updates, make sure you have automatic security updates enabled for your Ubuntu! The command is:

dpkg-reconfigure -plow unattended-upgrades

However, that just covers critical security updates. Every so often you should get all the OS updates like so:

apt-get update
apt-get dist-upgrade

Due to the way docker packaging has changed you may also have to update your docker from lxc-docker or docker-engine packages. One way to do that is via the Docker script here (it will warn about an existing install but should upgrade ok):

wget -qO- https://get.docker.com/ | sh

This will now use the docker-ce main versions.

To summarize:

  • update Discourse twice a month via web updater
  • update the container every two months
  • update the OS every six months

You could double these numbers and still be fairly safe, e.g. update Discourse once a month, container every 4 months, OS once every 12 months, and so on.

But you really, really want automatic security updates enabled in Ubuntu, as listed above.

FAQ

What is the right time to update?

It just depends on the time you have available and how close to bleeding edge you want to be. If you have non-official plugins, it is highly advisable to utilize a test/staging site. If you do not have any non-official plugins, you can likely upgrade immediately, but even then, some plugins may break for a couple of days as the team fixes them (there are a lot of them).

What is common practice when updating with many plugins installed?

If you have a lot of plugins, testing locally or on a test server is highly advised. Especially if you have non-official plugins, as something could have broken. If you find something does break, then it is a matter of, do you have time to fix it? Does the original plugin author have time to fix it? Either of those could take weeks. So at least this way, you simply have a broken test site and not a broken production site.

I’m running low on disk space

If you are running low on disk space (check with df) try clearing up old images using:

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

Does updating the actual server version of Ubuntu matter since Discourse always operates in Docker?

It matters a lot less. But you should be on at least a currently supported LTS release of Ubuntu server. A 64-bit Linux OS with a modern kernel version is required.

177 Me gusta
"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
Issues upgrading from 1.6.0.Beta10+9 to 2.3.0.beta6
Upgrade container - keeping config and data
Manual upgrade fails
Installed OK. Working fine for one day. Suddenly stopped working
Discourse stopping working - CPU/RAM load?
Upgrade link no longer works
Why do I need a block storage?
Update error, website unavailable, possibly plugin related?
How to optimize storage?
Will not load, no access to installation, aufs not installed - my fix
Digital Ocean hosting: Do I need a system admin?
Upgrade V2.1 Beta 2 to Beta 4 Require ./launcher rebuild app Twice
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
Kernel version upgrade required when manually updating discourse
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?
Cannot rebuild following site failure: "postgres already running"
Determining whether my VPS needs any upgrades (generally)
Oops The software powering this discussion forum encountered an unexpected problem
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
Some trouble updating (many bugs)
What makes a successful volunteer Discourse sysadmin?