我已经设置并运行了一个带有公网IP的gitlab实例。然而,尝试添加gitlab-runner失败了,因为对runner的反向查找似乎没有按预期工作。在注册运行器时,我可以在gitlab实例的nginx上看到一个HTTP状态为200的传入POST请求
1.2.3.4 - - [09/Oct/2021:21:41:51 +0200] "POST /api/v4/runners HTTP/1.1" 200 179 "-" "gitlab-runner 14.3.2 (14-3-stable; go1.13.8; linux/amd64)"但是runner注册失败。
sudo gitlab-runner --debug register --non-interactive --url https://gitlab.example.org/ --registration-token asdasdasdasd --executor shell --tag-list shared --run-untagged=true --locked=false --access-level=not_protected
Runtime platform arch=amd64 os=linux pid=2488 revision=e0218c92 version=14.3.2
Checking runtime mode GOOS=linux uid=0
Running in system-mode.
Dialing: tcp gitlab.example.org:443 ...
ERROR: Registering runner... failed runner=LQ_-Gq-k status=200 OK
PANIC: Failed to register the runner. You may be having network problems. 这个信息有点误导..。
如何显示建立连接后gitlab中发生的情况?我的意思是HTTP的官方响应是200。
runner在NAT后面运行,没有公网IP,但gitlab实例有公网IP。路由和DNS设置正在工作,以便能够解析runner。
发布于 2021-10-12 11:00:29
Gitlab在Nginx反向代理后面运行,但该代理不受gitlab-ctl控制。由于这是一个全新安装,我检查了我的vhost定义,并认为可能是这种情况,因为传入的注册请求似乎被nginx以某种方式吃掉了。gitlab-ctl tail甚至没有记录注册runner的传入请求。
基于这个假设,我在gitlab.rb中启用了gitlab附带的nginx
nginx['enable'] = true然后运行gitlab-ctl reconfigure来禁用gitlab.rb中的nginx
nginx['enable'] = false然后再次运行gitlab-ctl reconfigure。
在该过程之后,nginx配置在/var/opt/gitlab/nginx/conf/中。我用gitlab-http.conf替换了我的vhost定义,并对其进行了进一步调整。
现在一切都像预期的那样工作了。我的vhost模板完全过时了。
https://stackoverflow.com/questions/69506891
复制相似问题