DiscourseとDockerイメージを手動で最新にアップデートする

: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.

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

Check documentPerform check on document:
「いいね!」 177

ガイドはかなり頻繁に見直され、更新されます(これは2月に少し調整されたようです)。:+1:

私が個人的に詳しくないのは、dockerに関するものだけです。

しかし、残りのものの正確さについては保証できます。:slight_smile:

「いいね!」 3

これらのコマンド全体をテストサイトで実行し、dockerのアップデートも含めましたが、問題なく動作しました。

「いいね!」 5

これを実行すると問題が発生するという報告を受けました。DO のテストサイトを数年間使用してきましたが、自分でこれを使用したことはないと思います。

最近これを使用した経験がある方で、まだ関連性のあるアドバイスかどうか教えていただけますか?


削除された投稿をいくつか確認したところ、ガイドのその部分が以前に提起された投稿がいくつか見つかりました [1]@MarkDoerr は問題なく実行したようです。

ただし、いつ、どのような状況で実行する必要があるのかについては、まだ不明です。Docker Manager に期待しすぎているでしょうか?Discourse Docker Manager


  1. 削除を解除しました ↩︎

「いいね!」 2

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

それは古い遺物であり、もう必要ありません。再構築で対応できます。

「いいね!」 2

プルリクエストを出しますか?

「いいね!」 3
「いいね!」 6

マージしました。@tvavrdaさん、ありがとうございます!

「いいね!」 6