Manually update Discourse and Docker image to latest

: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 and newest libraries.

These updates are not picked up in admin/upgrade, 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/upgrade).

  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

This will also keep Docker up to date via the standard docker-ce packages.

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.

Last edited by @SaraDev 2024-11-21T21:25:01Z

Check documentPerform check on document:
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
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?
Issues upgrading from 1.6.0.Beta10+9 to 2.3.0.beta6
Upgrade V2.1 Beta 2 to Beta 4 Require ./launcher rebuild app Twice
Update error, website unavailable, possibly plugin related?
Why do I need a block storage?
How to optimize storage?
Digital Ocean hosting: Do I need a system admin?
Will not load, no access to installation, aufs not installed - my fix
Upgrade link no longer works
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?
Some trouble updating (many bugs)
What makes a successful volunteer Discourse sysadmin?
Searching locks up the server for a while
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?
Switching between Discourse release channels / versions
My website is always down
Insert Date Timezone is always UTC ; my Timezone is ignored
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
Failed Upgrade Discourse and Plugins
What do you want to do about modified configuration file grub?
Visiting /admin/upgrade may lead to a server error
Updating I get a "Configuring openssh-server" message about the "sshd_config" file
ERROR: You are running an old version of the Discourse image
Update Not Completing
Site fails to load with js errors
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?
Docker update to latest version
Problem with category style = box under firefox
Selectable avatars upload broken (Missing required UppyUpload config: id)
Discourse broken after failed upgrade
How to tell whether to upgrade via web or console?
Upgrade button is 500-ing for me
Oops The software powering this discussion forum encountered an unexpected problem
Failed to bootstrap 1.6.0.beta 8 with out of date docker
Determining whether my VPS needs any upgrades (generally)
Kernel Panic after droplet reboot... What now?
Cannot rebuild following site failure: "postgres already running"
Problem with Upgrade [error 137]
Link-image not shown
Problem with api version when updating docker manager
Service not available | Update Error due to broken plugin
Site down after UI update
Upgrade from v2.0.0.beta10 +37 to 2.1.0.beta1 does fail
PNG's a no show
Your Docker installation is not working correctly - no space left on device - safe to use ./launcher cleanup?
Add path to cookie
How do you ensure a stable update?
1.4.3 Upgrade Oddity?

가이드는 비교적 자주 검토되고 업데이트됩니다(이 가이드는 2월에 약간 수정된 것으로 보입니다). :+1:

그중 제가 개인적으로 잘 모르는 것은 Docker 관련 가이드뿐입니다:

나머지 가이드의 정확성은 보증할 수 있습니다. :slight_smile:

3개의 좋아요

저는 테스트 사이트에서 도커 업데이트를 포함한 모든 명령어를 실행해 보았으며, 아무 문제 없이 잘 작동했습니다.

5개의 좋아요

이 스크립트를 실행할 때 문제가 발생한다는 보고를 받았습니다. DO 테스트 사이트를 운영한 지 2년 가까이 되었지만, 저는 직접 사용해 본 적이 없는 것 같습니다.

최근에 이 스크립트를 사용해 본 경험이 있는 분이 계신가요? 여전히 유효한 조언인지, 아니면 더 이상 필요하지 않은지 알려주시면 감사하겠습니다.


삭제된 게시물들을 살펴보다가, 가이드의 해당 부분이 이전에 언급되었던 게시물을 몇 개 찾았습니다 [1]. @MarkDoerr 님이 아무 문제 없이 실행한 것으로 보입니다.

다만, 언제/어떤 상황에서 이 스크립트를 실행해야 하는지 여전히 명확하지 않습니다. Docker Manager에 대해 너무 많은 신뢰를 하고 있는 건 아닌가요?


  1. 삭제된 상태를 해제했습니다 ↩︎

2개의 좋아요

게시물 2개가 새 주제로 분리되었습니다: 두 개의 컨테이너 구성에서 데이터 컨테이너를 업데이트하는 시기는?

게시글이 새 주제로 분리되었습니다: 알 수 없는 로컬 변경 사항이 있는 v2.2.0.beta4 포럼 업그레이드

해당 명령어(wget -qO- https://get.docker.com/ | sh)를 방금 실행해 보았지만 다음과 같은 메시지가 표시됩니다:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Docker 업데이트에 실패한 것 같습니다.

또한 이로 인해 사이트 전체가 다운된 것으로 보이며, 앱을 다시 빌드하려고 하면 다음과 같은 오류가 발생합니다:

Cannot connect to the docker daemon - verify it is running and you have access

서버를 재부팅한 후 사이트가 다시 온라인 상태가 되었습니다.

그러면 업그레이드는 수행되었지만 Docker 재시작에 실패한 것일 수 있습니다. 다음 명령어로 확인할 수 있습니다.

docker --version

결국 제 노트북에는 오래된 Docker 버전이 설치되어 있었고, 권장 명령어를 실행한 후 재부팅 없이도 정상적으로 작동했습니다. 버전 확인 결과는 다음과 같습니다.

$ docker --version
Docker version 26.1.4, build 5650f9b
1개의 좋아요

동일한 Docker 버전을 사용 중입니다:

Docker version 26.1.4, build 5650f9b
1개의 좋아요

그러면 최신 상태로 잘 유지되고 있는 것입니다!

3개의 좋아요

Discourse 업데이트 주기를 다루는 이 문서를 전에 본 기억이 났지만, Documentation 채널의 “Using Docker” 섹션 안에 "Manually update Docker."라는 제목으로 올라와 있어 다시 찾기가 힘들었습니다.

Discourse와 Ubuntu 업데이트를 다루는 내용이라면, 메뉴에 다른 곳에도 하나 더 노출할 수 있을까요?

1개의 좋아요

Discourse가 이미지를 업데이트하도록 권장할 때(UI에서 업그레이드할 수 없는 경우), 다음과 같이 안내합니다:

    cd /var/discourse
    git pull
    ./launcher rebuild app

이 추가적인 git pull은 무엇이며, 왜 매뉴얼에서 이를 권장하지 않나요?

3개의 좋아요

이것은 더 이상 필요 없는 오래된 유물입니다. Rebuild가 그 역할을 대신합니다.

2개의 좋아요

PR을 올려야 하나요?

3개의 좋아요
6개의 좋아요

병합했습니다. @tvavrda 감사합니다!

6개의 좋아요