理由が見つからないまま、本日 ./launcher rebuild app コマンドを実行したところ、このエラーが発生しました(また、これは app.yml ファイル内のすべてのプラグインを無効にした後です)… この件について、どのようなご協力でもいただけると幸いです!
error-log_2024-10-31_1.txt (44.1 KB)
…で終わっています。
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 2096 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP **
「いいね!」 1
david
(David Taylor)
2024 年 10 月 31 日午後 5:13
2
ログの関連部分は次のとおりです。
undefined method `+' for nil
/var/www/discourse/db/migrate/20241025045928_add_invites_link_to_sidebar.rb:44:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4.2/lib/active_record/migration.rb:989:in `public_send'
したがって、これは FEATURE: Add invite link to the sidebar (#29448) · discourse/discourse@19672fa · GitHub (cc @osama ) に関連しているようです。
「いいね!」 4
どうもありがとうございます(説明も)。私もそれを見て、それが原因かと思いました!
「いいね!」 1
Osama
2024 年 10 月 31 日午後 6:02
4
@denvergeeks 移行を修正しますが、あなたのサイトがこの状態になった経緯について少し興味があります。あなたのサイトではサイドバーはどのように見えますか?データベースからデフォルトのサイドバーのリンクをすべて削除しましたか?
はい。サイドバーやサイトのスクリーンショットはありませんが、[more…] にいくつかの基本的なメニュー項目を追加した以外は何も変更されていません。
これは(非公開の)個人研究用 Discourse インスタンスの 1 つなので、コマンドラインで何をすればよいか教えていただければデバッグにご協力できます。(必要であれば、専用サーバーを持っています。)
「いいね!」 1
Osama
2024 年 10 月 31 日午後 6:37
6
データベースで以下のクエリが出力するものを教えていただけますか?
SELECT id FROM sidebar_sections WHERE section_type = 0;
SELECT linkable_type, linkable_id, position FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0);
SELECT id, segment FROM sidebar_urls WHERE id IN (SELECT linkable_id FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0));
はい、もちろんです。プロンプト(または開始点)からのコマンドを教えていただけますか?(私はrootユーザーです)
「いいね!」 1
Osama
2024 年 10 月 31 日午後 6:54
8
正確なコマンドはすぐには分かりませんが、Meta内で調べたところ、以下のコマンドが機能するはずです。
./launcher enter app
su postgres
psql
psql コマンドの後、クエリを貼り付けて実行し、結果を確認できるはずです。コマンドが機能しない場合はお知らせください。
root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
x86_64 arch detected.
Error response from daemon: container 8ee36bdfa85b786ea149e6714f65048e136091fe31be2f5425be5fe04a852729 is not running
su: user postgres does not exist or the user entry does not contain all the required fields
Command 'psql' not found, but can be installed with:
apt install postgresql-client-common
Osama
2024 年 10 月 31 日午後 7:08
10
コンテナが実行されていないようです。サイトは現在ダウンしていますか?以下をお試しください。
./launcher start app101
root@JEN /var/discourse # ./launcher start app101
x86_64 arch detected.
starting up existing container
+ /usr/bin/docker start app101
app101
root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
x86_64 arch detected.
root@JEN-app101:/var/www/discourse# SELECT id FROM sidebar_sections WHERE section_type = 0;
bash: SELECT: command not found
root@JEN-app101:/var/www/discourse#
サイトが開始され、サイドバーと…その他の項目が表示されます。
「いいね!」 1
Osama
2024 年 10 月 31 日午後 7:18
13
これで納得できました。マイグレーションは ... more の外部に少なくとも1つのリンクがあることを期待していますが、 none なのでエラーが発生します。このケースに対応するようにマイグレーションを更新します。
「いいね!」 2
他のサイトでも同じエラー(コンテナ停止)が発生しました。(ただし、一部のサイトでは発生しませんでした。)
編集: はい、同じ動作が見られた別のサイトでも、「続きを読む」以外のリンクがありませんでした。
Osama
2024 年 10 月 31 日午後 10:28
16
申し訳ありません、@denvergeeks さん、急用のため数時間離席していました。修正済みのPRを用意しました。
main ← fix/invite-sidebar-link-migration
opened 10:27PM - 31 Oct 24 UTC
Meta topic: https://meta.discourse.org/t/stumped-about-launcher-rebuild-app-erro… r-process-pid-2096/333876?u=osama.
Follow up to https://github.com/discourse/discourse/pull/29448.
The migration that adds the invite link to the sidebar determines the position of the link by looking up the max position that a primary link has and inserts the invite link at the max position plus 1. This approach works fine for most sites, however, sites that have deleted all primary links from the sidebar will fail because the max position will be `nil` which blows up the migration.
This PR addresses this edge case by falling back to looking up the min position of secondary links, or to zero if there're also no secondary links, and then inserts the invite link at the min position minus 1.
マージされてテストを通過したらお知らせします。
「いいね!」 3
Osama
2024 年 11 月 1 日午前 7:50
17
@denvergeeks 、修正はtests-passedブランチにマージされました。今すぐ再度ビルドすれば成功するはずです。
「いいね!」 3
system
(system)
クローズされました:
2024 年 12 月 1 日午前 7:50
18
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.