next-l / enju_leaf

Next-L Enju Leaf 統合図書館管理システム / integrated library system https://enju.next-l.jp/
https://www.next-l.jp
MIT License
118 stars 24 forks source link

「システム全体の設定」画面に入れない #1911

Closed siraisi368 closed 1 month ago

siraisi368 commented 1 month ago

手順通り正しくインストールを行ったが ログインし設定画面に入ろうとしても image このようになり入ることができない。

ログには

web-1  | I, [2024-08-26T14:57:09.553029 #1]  INFO -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e] Processing by LibraryGroupsController#show as HTML
web-1  | I, [2024-08-26T14:57:09.553171 #1]  INFO -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e]   Parameters: {"id"=>"1"}
web-1  | I, [2024-08-26T14:57:09.576243 #1]  INFO -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e]   Rendered library_groups/show.html.erb within layouts/application (Duration: 4.7ms | Allocations: 906)
web-1  | I, [2024-08-26T14:57:09.576461 #1]  INFO -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e]   Rendered layout layouts/application.html.erb (Duration: 5.0ms | Allocations: 932)
web-1  | I, [2024-08-26T14:57:09.576955 #1]  INFO -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e] Completed 500 Internal Server Error in 24ms (ActiveRecord: 2.7ms | Allocations: 2927)
web-1  | F, [2024-08-26T14:57:09.579873 #1] FATAL -- : [483333e3-05fa-40e1-9cfc-712c6f8b004e]
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e] ActionView::Template::Error (undefined method `email' for nil:NilClass):
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     18:   <br />
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     19:   <%= image_tag(library_group_path(@library_group, format: :download), size: @library_group.header_logo.image_size(:medium)) if @library_group.header_logo.exists? -%>
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     20: </p>
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     21:
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     22: <p>
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     23:   <strong><%= t('activerecord.attributes.library_group.email') -%>:</strong>
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]     24:   <%= @library_group.user.email -%>
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e]
web-1  | [483333e3-05fa-40e1-9cfc-712c6f8b004e] app/views/library_groups/show.html.erb:21

と残されていた。

環境: Docker 27.1.2, build d01f264 Miracle Linux 9 (RHEL9クローン) Enju_leaf Version 1.4

nabeta commented 1 month ago

@siraisi368 以下のコマンドは実行していますでしょうか。

docker compose run --rm web bin/rake db:seed
siraisi368 commented 1 month ago

はい。実行済みです。 Administrator account created.と表示されたのを確認しています。

nabeta commented 1 month ago

@siraisi368 以下を実行して、最後の行にメールアドレスのような文字列が表示されますでしょうか。

docker compose run --rm web bin/rails r 'puts LibraryGroup.find(1).user.email'

もしエラーになる場合、なんらかの理由で初期データの投入がうまくいっていない可能性があります。

siraisi368 commented 1 month ago

undefined method `email' for nil:NilClassと出力されるので うまく行ってなさそうです。

初期設定時のログインユーザについてですが、rootで行うと不具合が出やすい等ありますか?

nabeta commented 1 month ago

@siraisi368 初期ユーザの作成はbin/rake db:seedの以下の行で、コンテナ内で実行されるので、関係はないはずです。 https://github.com/next-l/enju_leaf/blob/v1.4.8/db/seeds.rb#L31

ただ、初期データが足りないのなら、この行でコマンドが失敗するはずなのですよね…。新規インストールであれば、データベースのボリュームを一度削除し、もう一度データベースの作成を行ってみていただけますか。

docker compose down
docker volume rm enju_leaf_postgres # ボリュームの削除
docker compose up -d
docker compose run --rm web bin/rake db:create
docker compose run --rm web bin/rake db:migrate
docker compose run --rm web bin/rake db:seed
siraisi368 commented 1 month ago

ボリューム削除ののち、もう一度データベースの作成をやり直したらうまく表示されるようになりました。 ありがとうございます

nabeta commented 1 month ago

@siraisi368 よかったです。Solrの再インデックスも行っておいてください。

docker compose run --rm web bin/rake sunspot:reindex
siraisi368 commented 1 month ago

わかりました、ありがとうございます