首页 文章

Gitlab Runner在单独的服务器上

提问于
浏览
0

我想在一个单独的服务器上安装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

如果我从POSTMAN创建POST请求我可以创建运行器,但是当我从gitlab-ci尝试时我不能 . 你知道什么是错的吗?我们的Gitlab在另一台服务器上,我想分离Gitlab和Gitlab-ci . 我希望Gitlab-CI位于一个单独的服务器上,而不是Gitlab所在的同一服务器上 . 怎么做,你知道吗?

2 回答

  • 0

    您的问题有两种可能的原因:

    • Version mismatch :您的跑步者可能与您的GitLab版本不兼容,如消息中所述: ERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1 . 检查您的GitLab实例版本,并确保您的跑步者版本与之兼容 .

    Runners 9.0及以上版本使用新的v4 API,需要最少的GitLab 9.0 .

    • Network problem :由于某些网络限制或某些阻止,您的Gitlab Runner无法访问GitLab服务器 . 发生这种情况时,会显示与上面相同的错误消息 . 尝试从GitLab Runner服务器卷曲 <url>/api/v4/runners/verify 以了解这是否是问题所在 .
  • 0

    是的,我解决了我的问题 . 问题是什么:我创建了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
    

    但是,当我尝试连接gitlab和gitlab ci时,我在这一行中看到了: Please enter the gitlab-ci description for this runner: [<url>]: <description> 我收到 [<url>] ,但我必须收到随机令牌vs url . 然后我决定删除 hostname: domain 并再次启动该过程 . 一切顺利 . 所以我的新 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
    

    现在一切顺利 .

相关问题