【发布时间】:2014-09-20 14:57:52
【问题描述】:
我已经设法在带有 Apache、Git、PHP、PostGreSQL 和 MySQL 的 Linux CentOS 服务器上部分设置了Gitlab。我正在运行Chef Cookbook version。我从here 获得了 rpm。我想用它来更好、更直观地管理我的 Git 存储库,这似乎是一个不错的选择。但现在我遇到了让它工作的问题。
为了让它真正工作并更新所有文件,我决定使用gitlab-ctl reconfigure 重新运行配置。第二次运行确实有效:
Chef Client finished, 4 resources updated
gitlab Reconfigured!
主办方已经将 NGINX 放在 8080 上,而不是与运行在端口 80 上的 Apache 争论,我们有一个 LAMP 项目正在运行。但是现在 Ruby 的 Unicorn Web Server 似乎和 NGINX 发生了冲突。我曾与 NGINX 合作过一点点,不多,这是我在 Gitlab 的第一次尝试。无论如何,这是我在主人的帮助下想出来的。
当我登录 testserver.domain.net 并通过以下命令时:
netstat -ln |grep 8080我明白了
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN
所以有些东西在 8080 上运行 根据我的主持人的说法,它应该在 0.0.0.0:8080 上运行。当我们检查该端口上正在运行的内容时,我们会看到
netstat -tupln |grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 21627/unicorn maste
当我们检查进程 id 21627 时,我们看到
cat /proc/21627/cmdline
unicorn master -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
这是一个 Ruby 进程,而不是 NGINX 进程。
所以NGINX似乎和Unicorn发生了冲突。
当我们检查 nginx 的日志时,我们发现 nginx 无法正常运行:
tail -f /var/log/gitlab/nginx/error.log
2014/07/28 09:43:10 [emerg] 23122#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:10 [emerg] 23122#0: still could not bind()
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014/07/28 09:43:12 [emerg] 23123#0: still could not bind()
我搜索了 Unicorn.rb 并找到了这个 link。我还读到:
Unicorn 是用于 Rack 应用程序的 HTTP 服务器,旨在仅提供服务 低延迟、高带宽连接上的快速客户端,并采取 Unix/类 Unix 内核中的功能优势。慢客户端应该 只能通过放置能够完全缓冲的反向代理来提供服务 Unicorn 和慢速客户端之间的请求和响应。
当我检查文件 /var/opt/gitlab/gitlab-rails/etc/unicorn.rb 时,我确实看到它使用 8080。问题是 Unicorn 似乎应该与 NGINX 一起工作,所以也许我不应该更改端口。
我应该采取什么步骤才能使 Gitlab 正常工作? Gitlab 可以在没有独角兽的情况下工作吗?我认为不会。然后我应该为它选择另一个端口还是为 NGINX 选择另一个端口?
【问题讨论】:
-
当我在
/var/opt/gitlab/nginx/etc/gitlab-http.conf中更改为端口 8888 并使用gitlab-ctl restart重新启动时,我得到:ok: run: nginx: (pid 3211) 0s ok: run: postgresql: (pid 3217) 0s ok: run: redis: (pid 3226) 1s ok: run: sidekiq: (pid 3232) 1s timeout: run: unicorn: (pid 21627) 94720s, got TERM所以仍然是小问题,但我可以访问 domain.com:8888 上的站点。
标签: ruby git nginx centos gitlab