nginx - 如果设置了 external_url,Gitlab docker 将无法工作

标签 nginx docker gitlab gitlab-omnibus

我一直在为一个我仍然无法解决的问题而苦苦挣扎。帮助将不胜感激!
我做了什么:
1) 在我的服务器中的 Ubuntu 16.04.1 LTS 虚拟机上使用 docker 镜像 (8.9.6-ce.0) 安装 Gitlab-CE,遵循 http://docs.gitlab.com/omnibus/docker/README.html
2)在本地设置一个用户并为同一局域网中的机器推送一些项目>>一切正常
3)添加一个新的映射到我的防火墙来映射 gitlab-machine-ip:80 > example.org:8138 这样我就可以通过 http 访问 gitlab

我现在可以访问 Web 界面 http://example.org:8138并使用它
现在的问题:克隆项目的 URL 显示不正确,因为它们错过了 :8138 端口(它们从传递给 docker 容器的 --host 设置中获取 example.org 部分)。
如果我手动将自定义端口添加到 URL 中,则克隆工作正常

我想解决这个问题,所以尝试了 gitlab.rb 中的 external_url 设置,将其设置为:
external_url ' http://example.org:8138 '
并重新启动(也尝试手动调用 gitlab-ctl configure)

状态是我无法再访问 Web 界面 http://example.org:8138在我的浏览器中收到 ERR_CONNECTION_REFUSED
如果我只是注释掉 external_url 设置,一切都会恢复正常(显然,除了 URL 中缺少的端口)

我已经阅读了一堆问题报告,但没有一个有助于解决问题:
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/244 >>(我没有使用外部 NGINX)
在我读到这个后也尝试更新到 8.11:https://gitlab.com/gitlab-org/gitlab-ce/issues/20131但它没有帮助

真的不知道这里发生了什么。
gitlab-rake gitlab:env:info 和 gitlab-rake gitlab:check 的输出如下

System information
System: 
Current User:   git
Using RVM:  no
Ruby Version:   2.3.1p112
Gem Version:    2.6.6
Bundler Version:2.3.0
Rake Version:   10.5.0
Sidekiq Version:4.1.4

GitLab information
Version:    8.11.3
Revision:   6cd4edb
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL:    http://example.org:8138
HTTP Clone URL: http://example.org:8138/some-group/some-project.git
SSH Clone URL:  git@example.org:some-group/some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    3.4.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks:  /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:    /opt/gitlab/embedded/bin/git
Checking GitLab Shell ...

GitLab Shell version >= 3.4.0 ? ... OK (3.4.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
telemed / banca ... ok
telemed / calcolatrice ... ok
telemed / chat ... ok
telemed / collections ... ok
telemed / interfacce ... ok
telemed / partite ... ok
telemed / polimorfismo ... ok
telemed / ristoranti ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... 
telemed / banca ... yes
telemed / calcolatrice ... yes
telemed / chat ... yes
telemed / collections ... yes
telemed / interfacce ... yes
telemed / partite ... yes
telemed / polimorfismo ... yes
telemed / ristoranti ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 4

Checking GitLab ... Finished

最佳答案

好的,我能够自己找出问题所在。
显然,当您更改 gitlab.rb 中的 external_url 参数时,会产生副作用(如果您问我,在文档中不会很清楚地解释!)nginx 现在将在您放入 http://example.org 的端口上运行。 : 8138

由于我通过防火墙将端口 80 映射到外部 URL 上,因此无法再访问 gitlab 网站。我建议在文档中明确说明更改 external_url(如果包含端口号)会导致 nginx 和网站在与标准 80 不同的端口上运行 http!!!!

希望这可以帮助其他一些与我有类似问题的人:slight_smile:

关于nginx - 如果设置了 external_url,Gitlab docker 将无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39351563/

相关文章:

ruby-on-rails - 有子文件夹显示index.html - Rails/nginx

docker - 无法在 screen 内获取交互式 Docker shell

docker - 另一个卷中的卷使用www-data而不是root

bundler - Sidekiq 未在 GitLab 6.0.0 安装上运行

node.js - 如何为套接字传递 nginx 代理 url

ruby-on-rails - 产生大量 Rack 应用程序的乘客

sockets - nginx、fastcgi 和开放套接字

postgresql - docker stop && docker rm 并没有真正摆脱我的容器

Jenkins - Gitlab 集成问题

git - SVN 到 GIT 迁移给出错误:No refs in common