我一直在设置GitLab一些乐趣,经过一段时间的黑客攻击,我已经相对习惯于设置它,现在已经在两台机器上完成了这项工作,第二次使用更多比原来容易...
但是,我在两台机器上都遇到了一个相当大的问题:我的CI管道坏了。不知何故,在某个地方,我的设置在构建完成后提供了403个工件,这意味着技术上成功的每一项工作都将注定要失败......
我一直在寻找互联网以寻找答案,但我找不到太多有用的东西。
我将GitLab CE升级到10.1.4分钟前,以及GitLab-runner升级到10.1.0,这两个机器中更重要的两个机器上运行的最新软件包,运行新版本的Ubuntu而不是其他 - 17.04对“野兽”感兴趣,而“q2”为16.10 yakkety。 两个gitlab-runner注册都使用shell来执行。
CI工作的相关输出如下:
Cloning repository...
Cloning into '/[clonepath]'...
Checking out 8319d586 as master...
Skipping Git submodules setup
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
$ mvn -B install
[INFO] Scanning for projects...
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.204 s
[INFO] Finished at: 2017-11-18T05:45:08+01:00
[INFO] Final Memory: 27M/640M
[INFO] ------------------------------------------------------------------------
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
Uploading artifacts...
target/*.jar: found 1 matching files
ERROR: Uploading artifacts to coordinator... forbidden id=35 responseStatus=403
Forbidden status=403 Forbidden token=sP9oHykF
FATAL: permission denied
ERROR: Job failed: exit status 1
我在Apache2 Vhost子域下运行GitLab,主要是为了审美和省略主机之后的端口,即8080用于独角兽,因为在Apache上运行其他站点。
这些是我的gitlab.rb中配置的选项:
gitlab_rails['trusted_proxies'] = [ '127.0.0.1' ]
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
nginx['enable'] = false
设置以下任一选项/值中的值
web_server['username'] = 'www-data'
web_server['group'] = 'www-data'
在重新配置时产生错误:
Starting Chef Client, version 12.12.15
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
- package (0.1.0)
- registry (0.1.0)
- consul (0.0.0)
- gitlab (0.0.1)
- runit (0.14.2)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: gitlab::default
* directory[/etc/gitlab] action create (up to date)
Converging 408 resources
* directory[/etc/gitlab] action create (up to date)
* directory[Create /var/opt/gitlab] action create (up to date)
* directory[/opt/gitlab/embedded/etc] action create (up to date)
* template[/opt/gitlab/embedded/etc/gitconfig] action create (up to date)
Recipe: gitlab::web-server
* group[Webserver user and group] action create (up to date)
* user[Webserver user and group] action create
================================================================================
Error executing action `create` on resource 'user[Webserver user and group]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '8'
---- Begin output of ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "www-data"] ----
STDOUT:
STDERR: usermod: user www-data is currently used by process 2656
---- End output of ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "www-data"] ----
Ran ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "www-data"] returned 8
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/definitions/account.rb
38: user params[:name] do
39: username username
40: shell params[:shell]
41: home params[:home]
42: uid params[:uid]
43: gid params[:ugid]
44: system params[:system]
45: supports params[:user_supports]
46: action params[:action]
47: end
48: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/definitions/account.rb:38 :in `block in from_file'
user("Webserver user and group") do
params {:action=>nil, :username=>"www-data", :uid=>nil, :ugid=>"www-data", :groupname=>"www-data", :gid=>nil, :shell=>"/bin/false", :home=>"/var/opt/gitlab/nginx", :system=>true, :append_to_group=>true, :group_members=>["www-data"], :user_supports=>{:manage_home=>false}, :manage=>true, :name=>"Webserver user and group"}
action [:create]
supports {:manage_home=>false}
retries 0
retry_delay 2
default_guard_interpreter :default
username "www-data"
gid 33
home "/var/opt/gitlab/nginx"
shell "/bin/false"
system true
iterations 27855
declared_type :user
cookbook_name "gitlab"
recipe_name "web-server"
end
Platform:
---------
x86_64-linux
Running handlers:
Running handlers complete
Chef Client failed. 0 resources updated in 04 seconds
至于Apache,这里是支持SSL的Vhost:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName [host]
ServerAdmin [email]
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location />
Order deny,allow
Allow from all
Require all granted
ProxyPassReverse http://127.0.0.1:8181/
ProxyPassReverse http://[host]/
RequestHeader set X-Forwarded-Ssl 'on'
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
SSLCertificateFile /etc/letsencrypt/live/[host]/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/[host]/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
知道发生了什么事吗?我还没有挖掘Apache日志信息,因为它可能不会是Apache,因为请求直接转到gitlab-worker(8181)。如有必要,我应该检查哪些日志?
谢谢你的时间。
答案 0 :(得分:0)
这不是一个特别有用的答案,因为该解决方案对其工作原理几乎没有解释。
我的配置与上面的配置保持一致,但是我安装的跑步者,我删除了rm /etc/gitlab-runner/config.toml
的配置,然后继续从机器中删除包apt purge gitlab-runner
。 (gitlab-ci-multi-runner是另一个可用但似乎与GitLab 10不同的软件包 - 返回404而不是连接到节点)。
我重新安装了跑步者apt install gitlab-runner
,然后注册了它 - gitlab-runner register
。这里需要注意的关键是,在注册过程中,我使用了我的FQDN,如https://git.example.com而不是http://localhost:8080或http://localhost:8181(分别是unicorn,gitlab-workhorse)等本地地址。是的,我在我的本地机器上运行我的跑步者。危险,但我对我的团队非常信任。这可能是我们的垮台,无知的系统管理是成功的关键。