rubyバージョンの不一致によりビルドが失敗する

数日間、問題なく ./launcher bootstrap web_only && ./launcher destroy web_only && ./launcher start web_only を使用した後、./launcher enter web_only の後に rails c を使用して Rails コンソールで SiteSetting.can_permanently_delete = true を設定しようとしたところ、問題が発生しました。

質問: 分離コンテナモードでは Rails コンソールのアクセス方法が異なりますか?

再構築とブートストラップの成功に失敗した後、AI関連のものを実装する前の数日前にサーバーをロールバックしました。しかし、改善しませんでした!
ブートストラップ メソッドは次のように失敗します。

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3' failed with return #<Process::Status: pid 465 exit 18>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.4.0/lib/pups/exec_command.rb:138:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'", "su discourse -c 'bundle clean'", "su discourse -c 'find /var/www/discourse/vendor/bundle -name cache -not -path \\\"*/gems/*\\\" -type d -exec rm -rf {} +'", "su discourse -c 'find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +'"]}
bootstrap failed with exit code 18
** 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.
aee0f5c110bf8ce78f05c138a78712b4a0116fe6662c998b2f29800715036091

./launcher rebuild web_only も同様にエラーになります。

docker: Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint web_only (06b7b1f7f6b476adac20a11a55de776d7350e837407a6c7a6ba582c917f6dd73): Bind for 0.0.0.0:80

管理画面から Docker Manager を更新すると、次のように表示されます。

You are running an old version of the Discourse image
Updates via the web UI are disabled until you run the latest image. To do so log in to your server using SSH and run:

  cd /var/discourse
  ./launcher rebuild app

質問: 何が起こっているか、何かアイデアはありますか?

ビルドを失敗させるエラーは次のとおりです。

[2026-02-17T16:51:13.376629 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
Your Ruby version is 3.3.8, but your Gemfile specified ~= 3.4

エラーを見つけるには上にスクロールする必要があります。

「いいね!」 3

はい、それは試しましたが、役に立つものは何も表示されません。
これが最新のものです。
exitcode18.txt (43.5 KB)

エラーは次のとおりです。

[2026-02-17T16:51:13.376629 #1]  INFO -- : \u003e cd /var/www/discourse \u0026\u0026 su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
Rubyのバージョンは3.3.8ですが、Gemfileでは~\u003e 3.4が指定されています

Discourse Dockerが古いバージョンに固定されていますか?あるいは、バグの可能性もありますが、そのようなバグがビルドテストを通過するとは考えにくいです。

ジェイさん、ありがとうございます。それも見ましたが、正常にビルドが完了しても奇妙なメッセージが出ることがあるのは珍しくありません。

いいえ、言及したように OP に従いました。

@pfaffman 移動ありがとうございます!

「いいね!」 1

/var/discourse をプルできますか?再構築はベースイメージ 2.0.20260209-1300 を使用して行う必要があります。

「いいね!」 1

@supermathie さん、ご協力ありがとうございます。

2.0.20260209-1300 が、新規の ./launcher rebuild web_only から使用されています。

Status: Downloaded newer image for discourse/base:2.0.20260209-1300
docker.io/discourse/base:2.0.20260209-1300
Ensuring launcher is up to date
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 web_only
web_only
2.0.20260209-1300: Pulling from discourse/base
Digest: sha256:50d2dae489a9c9916c3d50d880f7f1282fcbe179339b60a8947ab135c1f1f9bf
Status: Image is up to date for discourse/base:2.0.20260209-1300
docker.io/discourse/base:2.0.20260209-1300

end of build

docker: Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint web_only (9e391a36bdc1a80a6b993a466ffdba25337ce70f1fe74f2b5d8aaca75585322b): Bind for 0.0.0.0:80 failed: port is already allocated

failed to set up container networking.txt (74.3 KB)

編集
根本的な原因は、2コンテナへの移行から始まったと考えています。

サーバー上の何かがすでにポート80を使用しており、それを停止する必要があります

しかし、あなたはそれが機能していて、数回再構築したと言っていましたね。

サーバー上にあるのはDiscourseだけです

しましたし、今もしています :grinning_face:

元の投稿には3つの再構築オプションがあります。私が言及しているものは一度も機能したことがありません。つまり、失敗を引き起こします。

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1310/docker-proxy
tcp6       0      0 :::80                   :::*                    LISTEN      1316/docker-proxy

別のコンテナで実行されている他の2つのインスタンスを確認しています… @pfaffman が指摘したメッセージ

./launcher bootstrap web_only && ./launcher destroy web_only && ./launcher start web_only でも同じ結果

Already up to date
╭ Warning ─────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Ignored build scripts: @swc/core@1.15.7, core-js@2.6.12, core-js@3.47.0,   │
│   esbuild@0.25.12, esbuild@0.27.1, lefthook@2.1.0.                           │
│   Run "pnpm approve-builds" to pick which dependencies should be allowed     │
│   to run scripts.                                                            │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
I, [2026-02-17T21:07:23.811289 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
Your Ruby version is 3.3.8, but your Gemfile specified ~= 3.4

ええ。それはうまくいきません。今までうまくいったことはありません。誰がそれがうまくいくと提案したのか、私にはわかりません。誰かがそれがうまくいくと提案したことに私が気づかなかったのか、私にはわかりません。そして、2コンテナ設定のポイントは、データはほとんどアップグレードしないということです。

データをアップグレードする必要がある場合は、webのみをシャットダウンし、次にデータを再構築してからweb_onlyにする必要があります。OPを更新しました。

ポート競合エラーが発生する場合、それはDockerが再起動したときに、最初に古いアプリコンテナを再起動し、それがポートを取得している可能性があるためです。次のコマンドで確認できます。

docker ps

そして、appが実行されているかどうかを確認します。ポートの問題を説明してくれるので、実行されていることを望んでいます。

おそらく次のことを行う必要があります。

docker stop app; docker rm app
「いいね!」 2