[英]Gitlab Runner on separate server
I want to install GitLab Runner on a separate server, but when I try to connect to GitLab, I received: 我想在单独的服务器上安装GitLab Runner,但是当我尝试连接到GitLab时,我收到了:
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
<URL>
Please enter the gitlab-ci token for this runner:
<TOKEN>
Please enter the gitlab-ci description for this runner:
[<url>]: <description>
Please enter the gitlab-ci tags for this runner (comma separated):
Whether to lock Runner to current project [true/false]:
[false]:
ERROR: Registering runner... failed runner=<runner-token> status=couldn't execute POST against <url>/api/v4/runners: Post <url>/api/v4/runners: dial tcp 172.17.0.2:80: getsockopt: connection refused
ERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1 runner=<runner-token> statusText=couldn't execute POST against <url>/api/v4/runners/verify: Post <url>/api/v4/runners/verify: dial tcp 172.17.0.2:80: getsockopt: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems
If I create POST request from POSTMAN I can create runner, but when I try from gitlab-ci I can't. 如果我从POSTMAN创建POST请求,则可以创建运行器,但是从gitlab-ci尝试时,则不能。 Do you know what is wrong ?
你知道错在哪里吗? Our Gitlab is on another server, and I want to separate Gitlab and Gitlab-ci.
我们的Gitlab在另一台服务器上,我想将Gitlab和Gitlab-ci分开。 I want Gitlab-CI to be on a separate server, not in the same server where is Gitlab.
我希望Gitlab-CI在单独的服务器上,而不是在Gitlab所在的同一服务器上。 How to do that, do you know ?
你怎么知道的?
There are two possible causes for your issue: 您的问题有两种可能的原因:
Version mismatch : Probably your runner is not compatible with your GitLab version as described in the message: ERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1
. 版本不匹配 :如消息中所述,您的运行程序可能与GitLab版本不兼容:
ERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1
。 Check your GitLab instance version and make sure your runner version is compatible with it. 检查您的GitLab实例版本,并确保您的运行程序版本与其兼容。
Runners version 9.0 and above utilize the new v4 API, requiring a minimum of GitLab 9.0.
9.0版及更高版本的Runners使用新的v4 API,要求最低版本的GitLab 9.0。
Network problem : Your Gitlab Runner is not able to reach the GitLab server due to some network limitation or due to some block. 网络问题 :由于某些网络限制或某些阻止,您的Gitlab Runner无法访问GitLab服务器。 When this happen, the same error message from above is shown.
发生这种情况时,将显示上面的相同错误消息。 Try to curl
<url>/api/v4/runners/verify
from the GitLab Runner server to know if this is the problem. 尝试从GitLab Runner服务器卷曲
<url>/api/v4/runners/verify
,以了解这是否是问题所在。
Yep I fixed my problem. 是的,我解决了我的问题。 What was the problem: I've created docker-compose.yml file and it looks like this:
问题出在哪里:我已经创建了docker-compose.yml文件,它看起来像这样:
web:
image: 'gitlab/gitlab-runner:latest'
restart: always
hostname: domain
container_name: gitlab-runner
volumes:
- '/storage/gitlab-runner/gitlab-runner/config:/etc/gitlab-runner'
- '/var/run/docker.sock:/var/run/docker.sock
but, when I tried to connect gitlab and gitlab ci, I saw that in this line: Please enter the gitlab-ci description for this runner: [<url>]: <description>
I received [<url>]
, but I have to receive random token vs url. 但是,当我尝试连接gitlab和gitlab ci时,在以下行中看到了这一点:
Please enter the gitlab-ci description for this runner: [<url>]: <description>
我收到了[<url>]
,但是我有接收随机令牌与网址。 Then I decide to remove hostname: domain
and started the process again. 然后,我决定删除
hostname: domain
然后再次开始该过程。 Then all works well. 然后一切正常。 So my new
docker-compose.yml
file looks like: 所以我的新
docker-compose.yml
文件如下所示:
web:
image: 'gitlab/gitlab-runner:latest'
restart: always
container_name: gitlab-runner
volumes:
- '/storage/gitlab-runner/gitlab-runner/config:/etc/gitlab-runner'
- '/var/run/docker.sock:/var/run/docker.sock
And now all works well. 现在一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.