操作
バグ #59
未完了unicornワーカープロセスがrootのまま(redmineユーザーへ切り替えエラー)
ステータス:
解決
優先度:
通常
担当者:
-
カテゴリ:
-
対象バージョン:
-
開始日:
2016/06/22
期日:
進捗率:
80%
予定工数:
重要度:
説明
Cent OS 6上でRedmine 3.3.0にアップデートする際、合わせてruby 2.3.1に変更したことによりgemを新規インストールした。
unicornを起動すると、ワーカープロセスのユーザー権限がredmineになるはずがrootとなっており、ログにはエラーが吐かれていた。
/var/lib/redmine/log/unicorn.stderr.log
Could not change user, oh well E, [2016-06-22T11:42:32.718849 #12896] ERROR -- : undefined method `tmp' for #<Unicorn::Worker:0x00000004068ca0> Did you mean? tap (NoMethodError) config/unicorn.rb:65:in `block in reload' /var/lib/redmine-3.3.0/vendor/bundler/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/ http_server.rb:611:in `init_worker_process' :
調べると、Unicorn 5.0以上では、メソッドtmpが無くなったとのこと。
https://github.com/rubber/rubber/issues/570
高橋 徹 さんがほぼ8年前に更新
- ステータス を 新規 から 解決 に変更
- 進捗率 を 0 から 80 に変更
tmpを呼ぶ行は削除してもよさそう
--- ../redmine-3.0.0/config/unicorn.rb 2015-02-21 22:43:07.885002910 +0900
+++ config/unicorn.rb 2016-06-22 11:59:47.208999978 +0900
@@ -62,17 +62,16 @@
ENV["HOME"] = "/home/redmine"
target_uid = Etc.getpwnam(user).uid
target_gid = Etc.getgrnam(group).gid
- worker.tmp.chown(target_uid, target_gid)
if uid != target_uid or gid != target.gid
Process.initgroups(user, target_gid)
Process::GID.change_privilege(target_gid)
Process::UID.change_privilege(target_uid)
end
- rescue
- if RAILS_ENV = "development"
+ rescue => e
+ if ENV['RAILS_ENV'] == 'development'
STDERR.puts "could not change user, oh well"
else
STDERR.puts "could not change user, oh well"
ついでに、エラー処理(rescue)を直しています。if RAILS_ENV = "development"
では、代入になってしまっていますね。
操作