Discourseフォーラムのアップデート時に問題が発生


皆さん、こんにちは!

管理パネルに掲載されていたリンクから Discourse フォーラムを更新しようとしたところ、このエラーが発生しました。フォーラム全体が消えてしまいました。アップデートをリセットするにはどうすればよいですか? 誰か助けていただけると大変助かります。 :sob:

「いいね!」 1

実際には、フォーラムが更新されていることを意味します。更新が完了する前に中断しない限り。

フォーラム https://yoursite.com/latest.json を訪問してみてください。何か返ってきたら、10分待って問題が自己解決するかどうか確認してください。

「いいね!」 1

返信ありがとうございます。教えていただいた方法を試しましたが、502 Bad Gateway nginx というエラーが返ってきました。

./launcher rebuild app を実行する必要があるようです

./launcher rebuild app を試したところ、以下のエラーメッセージが表示されました。

FAILED

--------------------

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development' failed with return #<Process::Status: pid 340 exit 5>

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development'"]}

6e9e60bd6b6113cdcb001127fd2a24fe86f2a1658bf24500e5e2b720fd793510

** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

./discourse-doctor may help diagnose the problem.

上にスクロールして、いくつかのエラーログを見つけました。

1)200:M 25 Jun 2023 16:00:16.252 # Failed listening on port 6379 (TCP), aborting.

2)[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'test development'`, and stop using this flag

3)Bundler::PathError: The path `/var/www/discourse/vendor/bundle/ruby/2.7.0/bundler/gems/sprockets-f4d3dae71ef2` does not exist.

4)Bundler::InstallError: sass-embedded-1.63.6-x86_64-linux requires rubygems version >= 3.3.22, which is incompatible with the current version, 3.2.18

最近、同様の問題に遭遇した人がいました。参考になれば幸いです。

ご返信ありがとうございます。しかし、問題は同じではないと思います。私のサーバーはドイツにあります。サーバーにはディスコースのDockerイメージを使用しています。./launcher rebuild app が機能しない場合はどうすればよいですか?

「いいね!」 1

似ているのは
Rebuild failed due to ruby gem incompatibility

「いいね!」 1

ご協力ありがとうございます。似ているように見えますし、試してみました。

my server:/var/discourse**$ git pull

fatal: Not a git repository: ../.git/modules/discourse_docker

git pull を実行する前に何かする必要がありますか?サーバーの /var/discourse で実行していました。

標準的なインストールでしょうか?特殊な設定のようですね。

「いいね!」 1

前のプログラマーのドキュメントを読んでみたのですが、ウェブの多くのものが nginx の背後で実行されており、Discourse も nginx の背後でホストする必要があるとのことです。標準のインストールでは私の状況には対応できません。

そして、ドキュメントには以下のように書かれており、その通りに実行しました。

Discourse は Docker コンテナで実行されます。ただし、docker-compose.yml や .conf ファイル経由ではなく、特別な設定が必要です。

**config と docker イメージのビルドに必要な discourse-project/ の GitHub リポジトリはこちら**で見つけることができます。彼らが提供する便利な「discourse-setup」プログラムは無視してください。今回は自分でアプリを設定する必要があります。

  1. discourse_docker を /var/discourse にクローンします: git clone https://github.com/discourse/discourse_docker.git /var/discourse
  2. フォルダに移動し、提供されているサンプル設定を使用します: cd /var/discourse && cp samples/standalone.yml containers/app.yml
  3. 次に、containers/app.yml ファイルを編集します(例: sudo nanoを使用)。
  • ホスティングセクション、メールの SMTP 設定、そして - 重要 - 外部に公開されるのは未使用のポートのみになるように expose セクションに変更が加えられました。
  • Discourse を “/forum” のようなパスで実行するには、こちらで説明されているように、さらに変更が必要でした。
  • メール認証でもいくつかの問題が発生します。
    • メールを送信するサーバーは「サーバーのメール」にあります。しかし、Discourse はメールがホストと同じドメイン、つまり「サーバーのメール」であることを期待しています。
      • 解決策はこちらで説明されています。
    • また、環境オプションとして「DISCOURSE_SMTP_AUTHENTICATION: login」も使用してください。なぜいつもこうなるのか。。。
  1. 次に、/var/discourse ディレクトリから sudo ./launcher bootstrap app でアプリをビルドします。これにはかなりの時間がかかります。
  2. その後、sudo ./launcher start app で Discourse コンテナを開始できるはずです。
「いいね!」 1

それは良いメモですね。

git pull;./launcher rebuild app で機能するはずです。

どのバージョンからアップデートしていますか?

OSは最新ですか? (cat /etc/issue)

ディスクは満杯ですか? (df - h)

「いいね!」 1

返信ありがとうございます!アップデート元のバージョンは 2.8.0.beta6 で、最終アップデートは 2021/09/28 です。

cat /etc/issue を実行したところ、以下が表示されました。
Debian GNU/Linux 9 \\n \\l

以下は ./discourse-doctor による情報です。

==================== MEMORY INFORMATION ====================
RAM (MB): 4050

              total        used        free      shared  buff/cache   available
Mem:           3955         427        1152          63        2375        3182
Swap:             0           0           0

==================== DISK SPACE CHECK ====================
---------- OS Disk Space ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        63G   27G   34G  45% /

==================== DISK INFORMATION ====================
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc0b6220c

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1        2048 134217727 134215680  64G 83 Linux

スワップを追加することもできます。

また、PostgreSQL 13 アップデートも参照してください。

複数回再構築しましたか?

Debian | endoflife.date も参照してください。

サポートされているオペレーティングシステムを備えた新しいVMにすべて移行する必要があります。そのため、実行中の他のものもすべてアップグレードする必要があります。

「いいね!」 1

こんにちは、ジャミーさん。何度もインストールに失敗した後、原因はサーバーのメモリ制限とネットワークにあることがわかりました。4GBのメモリを備え、GitHubとRubyに正常にアクセスできるサーバーを使用することをお勧めします。

このエラーが気になります。まだ表示されていますか? Dockerコンテナは現在3.2.0で実行されているはずです。

しかし、もし /var/discourse がgitディレクトリでない場合、指示とは異なる何かが行われています。これによりアップデートが妨げられ、Rubyのバージョン不一致が発生します。私の場合:

/var/discourse# git status
On branch main
Your branch is up to date with 'origin/main'.

また、.git ディレクトリも確認できます:

# ls -a /var/discourse/
.     .github     README.md  cids              discourse-setup  launcher     scripts    tests
..    .gitignore  bin        containers        image            rebuild.log  shared
.git  LICENSE     c          discourse-doctor  index.html       samples      templates

編集:ただし、OSが古すぎる場合は、ディスコースを新しいOSにインストールしてバックアップを復旧し、特定の状況に必要な追加作業を行う必要があるのは事実です。

サーバーがディスコースの実行以外にも多くのことを行っている場合、それはさらなる複雑さをもたらします。ローカルの専門知識が必要になる場合があります。

「いいね!」 3

同様の失敗が Ruby Gems などでも発生しています。
新しいサーバーにクリーンインストールしました。

ご協力いただきありがとうございます。提案された解決策を一つずつ試して問題を修正します。フィードバック(良い点も悪い点も)があれば、フォーラムに投稿します。改めて感謝いたします!

「いいね!」 1

新しいバージョンの Discourse を正常にインストールしました。上記のドキュメントの指示に従ったところ、うまくいきました。しかし、バックアップからの復元に問題があります。

コマンドラインからバックアップを復元するを試しましたが、以下のエラーが発生しました。

root@my_server:/var/www/discourse# discourse restore my_server-2023-06-20-033008-v20210922064213.tar.gz
Starting restore: my_server-2023-06-20-033008-v20210922064213.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-06-29-113408 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
EXCEPTION: /var/www/discourse/lib/discourse.rb:137:in `exec': Failed to decompress archive.

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/var/www/discourse/lib/discourse.rb:171:in `execute_command'
/var/www/discourse/lib/discourse.rb:137:in `exec'
/var/www/discourse/lib/discourse.rb:33:in `execute_command'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:78:in `decompress_archive'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:23:in `decompress'
/var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-06-29-113408' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

どうすればよいでしょうか?

バックアップファイルに問題があるようです。切り取られている可能性があります。

「いいね!」 1