Gitlab

502 GitLab 在更改使用者名後沒有響應

  • April 16, 2015

在文件中/etc/gitlab/gitlab.rb我更改(需要)

user['username'] = "gitlab"
user['group'] = "gitlab"

user['username'] = "git"
user['group'] = "git"

sudo gitlab-ctl reconfigure

在這個 nginx 輸出之後:502 GitLab is not responding

$ gitlab-ctl tail
find: `/var/log/gitlab/postgresql': Permission denied
find: `/var/log/gitlab/nginx': Permission denied
find: `/var/log/gitlab/redis': Permission denied
find: `/var/log/gitlab/logrotate': Permission denied
==> /var/log/gitlab/unicorn/unicorn_stderr.log.15.gz <==
....
7
==> /var/log/gitlab/gitlab-rails/production.log.19.gz <==
,▒UPuTTYPuTTYPuTTY
==> /var/log/gitlab/unicorn/current <==
2015-04-15_03:12:45.26369 starting new unicorn master
PuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTY2015-04-15_03:12:45.90614 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:45.90634       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:45.90639       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:45.90644       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:45.90650       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:45.90655       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:45.90660       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:45.90665       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:45.90670       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:45.90675       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:45.90679       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:45.90684       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:45.91888 master failed to start, check stderr log for details
2015-04-15_03:12:46.92327 failed to start a new unicorn master
2015-04-15_03:12:46.92788 starting new unicorn master
2015-04-15_03:12:47.65414 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:47.65671       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:47.65677       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:47.65682       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:47.65687       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:47.65695       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:47.65700       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:47.65705       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:47.65710       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:47.65715       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:47.65719       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:47.65724       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:47.67322 master failed to start, check stderr log for details
2015-04-15_03:12:48.67926 failed to start a new unicorn master
2015-04-15_03:12:48.68379 starting new unicorn master
2015-04-15_03:12:49.35816 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:49.35835       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:49.35841       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:49.35846       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:49.35851       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:49.35856       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:49.35860       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:49.35865       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:49.35870       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:49.35875       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:49.35880       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:49.35884       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:49.37041 master failed to start, check stderr log for details
2015-04-15_03:12:50.37502 failed to start a new unicorn master
2015-04-15_03:12:50.37905 starting new unicorn master

您的錯誤消息顯示更改後 gitlab-ctl 沒有訪問儲存庫的適當權限。

您可以採取一些替代措施來解決此問題。選擇一個,明智地選擇…

  1. 您只能更改使用者名,但保留舊組。如果該組具有必要的權限,則您無需更改任何其他內容。
  2. 您可以更改以前擁有的所有文件的所有權,github以便它們現在被擁有git。你可以通過執行很容易地做到這一點
查找 /var/log/gitlab -user github -exec chown git:git {} \;
  1. 您可以保留相同的舊 UID/GID 而不是更改所有所有權,但只需將名稱更改gitgithub. 您可以通過編輯來做到這一點/etc/passwd
  2. 您可以使兩個使用者名具有相同的 UID 和主目錄路徑等。這樣使用者登錄時使用的使用者名就無關緊要了。但是,這會造成一個相當混亂的系統,所以如果任何其他方法都有效,我不會推薦它。

引用自:https://serverfault.com/questions/683196