官方文档配置gitlab.rb,结果报错:
Recipe: gitlab::default
* directory[/etc/gitlab] action create (up to date)
================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `[]=‘ for nil:NilClass
Cookbook Trace:
---------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:35:in `from_file‘
Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:
28: group "root"
29: mode "0775"
30: action :nothing
31: end.run_action(:create)
32:
33: Gitlab[:node] = node
34: if File.exists?("/etc/gitlab/gitlab.rb")
35>> Gitlab.from_file("/etc/gitlab/gitlab.rb")
36: end
37: node.consume_attributes(Gitlab.generate_config(node[‘fqdn‘]))
38:
39: if File.exists?("/var/opt/gitlab/bootstrapped")
40: node.set[‘gitlab‘][‘bootstrap‘][‘enable‘] = false
41: end
42:
43: directory "/var/opt/gitlab" do
44: owner "root"
Running handlers:
[2016-08-08T13:25:18+08:00] ERROR: Running exception handlers
Running handlers complete
[2016-08-08T13:25:18+08:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2016-08-08T13:25:18+08:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/chef-stacktrace.out
[2016-08-08T13:25:18+08:00] ERROR: undefined method `[]=‘ for nil:NilClass
[2016-08-08T13:25:19+08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
原因:
gitlab版本太低!!不支持container registry。
gitlab-ce从8.8开始支持container registry:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4040
查看gitlab版本:
https://gityu.com/help
升级gitlab-ce:
sudo yum install gitlab-ce
使用yum info gitlab-ce查看版本,如果依然低于最新版本;
更新cache:
yum makecache fast
参照https://packages.gitlab.com/gitlab/gitlab-ce/install 使用rpm下面的
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
更新reposiroty
此时yum info gitlab-ce查看到版本已更新:
最后
sudo yum install gitlab-ce
安装最新版本。