【问题标题】:External URL must include a FQDN外部 URL 必须包含 FQDN
【发布时间】:2014-12-26 21:53:56
【问题描述】:

我为 Gitlab 的 CE 设置了全新的 CentOS 6.6 安装并使用了 Omniubus 安装程序。

运行 gitlab-ctl reconfigure 时出现以下错误:

================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb
================================================================================


RuntimeError
------------
External URL must include a FQDN


Cookbook Trace:
---------------
  /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:95:in `parse_external_url'
  /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:191:in `generate_config'
  /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb:34:in `from_file'


Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:

 88:  
 89:      def parse_external_url
 90:        return unless external_url
 91:  
 92:        uri = URI(external_url.to_s)
 93:  
 94:        unless uri.host
 95>>         raise "External URL must include a FQDN"
 96:        end
 97:        Gitlab['user']['git_user_email'] ||= "gitlab@#{uri.host}"
 98:        Gitlab['gitlab_rails']['gitlab_host'] = uri.host
 99:        Gitlab['gitlab_rails']['gitlab_email_from'] ||= "gitlab@#{uri.host}"
100:  
101:        case uri.scheme
102:        when "http"
103:          Gitlab['gitlab_rails']['gitlab_https'] = false
104:        when "https"

服务器的 FQDN 设置正确,我有一个外部 IP。 DNS 配置为 FQDN 指向我的外部 IP。

这是我的 /etc/gitlab/gitlab.rb 的内容,如果有用的话:

# Check and change the external_url to the address your users will type in their browser
external_url 'gitlab.thefallenphoenix.net'
gitlab_rails['gitlab_email_from'] = 'gitlab@thefallenphoenix.net'

【问题讨论】:

  • 10 月发布,现在 12 月中旬,bug 仍然存在。我不明白他们如何发布甚至无法安装的软件
  • 这个错误也出现在 Ubuntu 16.04 上 Digital Ocean 的 GitLab“一键安装”应用程序 Droplet 选项的默认安装中

标签: gitlab


【解决方案1】:

编辑: 现在通过将http://https:// 添加到.rb 文件中的域来解决此问题。使用 Gitlab EE 在 Debian 9 上测试。


gitlab.rb 中添加 = 符号。

应该是:

external_url = 'gitlab.thefallenphoenix.net'
gitlab_rails['gitlab_email_from'] = 'gitlab@thefallenphoenix.net'

之后它应该可以正常安装。至少它在 CentOS 6.6 上对我有用。

【讨论】:

  • 奇怪的是我需要添加它,因为除了第 2 行文件是默认文件!
  • @kemra102 如果是这种情况,请考虑在上游提出问题。
  • 刚遇到同样的问题,没有注意到缺少的等号!绝对是综合的问题,有更多知情人士可以通知上游吗?
  • 这个解决方案对我有用!我也有同样的问题(我也在使用综合,默认的 gitlab.rb 没有改变),除了我使用的是 CentOS 7 而不是 6.6
  • 其实这只是为了让脚本闭嘴。该脚本只是忽略了这一点 - 只要您想更改 url 中的任何内容,它就不起作用。请参阅 JusticeO 对真正解决方案的回答
【解决方案2】:

在 gitlab.rb 中添加等号 (=) 只能暂时解决您的问题!这不是一个错误。 使用“http://example.com”而不是“example.com”实际上解决了这个问题。 *如果 gitlab 安装良好但无法通过浏览器访问,请在 url 中添加一个端口,如“http://example.com:10080”,您应该会在浏览器中看到网站http://example.com:10080

【讨论】:

  • 这是一个长期的解决方案,它对我有用,因为其他接受的答案没有。谢谢!
  • 在哪里以及如何更改?
  • 转到 /etc/gitlab/gitlab.rb (omnibus gitlab)
  • 如果我在 docker 容器中运行 gitlab,我该怎么做?容器在我登录之前失败了...
【解决方案3】:

我从 6.6.9 升级到最新的 gitlab_7.4.3-omnibus.5.1.0.ci-1_amd64.deb

只要跟着升级前的instruction就可以了

gitlab-ctl reconfigure 

vim /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb

 99     def parse_external_url
100       return unless external_url
101
102       uri = URI("http://whatever.example.com")
          //just change external_url line here 
103
104       unless uri.host
105         raise "External URL must include a FQDN"
106       end
107       Gitlab['user']['git_user_email'] ||= "gitlab@#{uri.host}"
108       Gitlab['gitlab_rails']['gitlab_host'] = uri.host
109       Gitlab['gitlab_rails']['gitlab_email_from'] ||= "gitlab@#{uri.host}"
110
111       case uri.scheme
112       when "http"
113         Gitlab['gitlab_rails']['gitlab_https'] = false
114       when "https"
115         Gitlab['gitlab_rails']['gitlab_https'] = true
116         Gitlab['nginx']['ssl_certificate'] ||= "/etc/gitlab/ssl/#{uri.host}.crt"
117         Gitlab['nginx']['ssl_certificate_key'] ||= "/etc/gitlab/ssl/#{uri.host}.key"
118       else
119         raise "Unsupported external URL scheme: #{uri.scheme}"
120       end
121
122       unless ["", "/"].include?(uri.path)
123         raise "Unsupported external URL path: #{uri.path}"
124       end
125
126       Gitlab['gitlab_rails']['gitlab_port'] = uri.port
127     end

然后做

gitlab-ctr reconfigure

一切正常!

【讨论】:

  • 外部 url 可在 /etc/gitlab/gitlab.rb 进行配置所以只需打开 /etc/gitlab/gitlab.rb 并在 external_url 变量中添加 http:// 即可。
  • 我不赞成这个选项,因为如果可以通过配置文件进行编辑,不建议更改代码。
猜你喜欢
  • 2011-12-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多