![502 更改用户名后 GitLab 没有响应](https://linux22.com/image/656305/502%20%E6%9B%B4%E6%94%B9%E7%94%A8%E6%88%B7%E5%90%8D%E5%90%8E%20GitLab%20%E6%B2%A1%E6%9C%89%E5%93%8D%E5%BA%94.png)
在文件中/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
答案1
您的错误消息表明,更改后,gitlab-ctl 没有访问存储库的适当权限。
有几种方法可以解决这个问题。请明智地选择其中一种...
您可以只更改用户名,但保留旧组。如果该组具有必要的权限,则您无需更改任何其他内容。
您可以更改所有文件的所有权,
github
使其现在归属于git
。您可以非常轻松地通过运行
查找 /var/log/gitlab -user github -exec chown git:git {} \;
您不必更改所有所有权,只需保留相同的旧 UID/GID,但将名称更改为
git
而不是 即可github
。您可以通过编辑 来执行此操作/etc/passwd
。您可以让两个用户名具有相同的 UID 和主目录路径等。这样,用户使用哪个用户名登录就无关紧要了。不过,这会使系统相当混乱,所以如果其他方法有效,我不推荐这样做。
答案2
我不知道为什么,但是当我将权限更改为/var/log/gitlab/unicorn
并且 gitlab 工作时:
sudo chown -R git:git /var/log/gitlab/unicorn