无法 运行 无人机 CI 使用我的本地 gitea 服务器,在验证时出错

Can't run drone CI with my local gitea server, getting error while authenitcating

我想在本地 machine 上玩无人机 CI。

我已经通过 brew 在 mac 上安装了 gitea。我可以使用 root 登录 http://0.0.0.0:3000/ 并且一切正常

然后我就这样启动无人机服务器:

version: '2'

services:
  drone-server:
    image: drone/drone:0.8.1
    ports:
      - 8001:8000
    volumes:
      - /Users/aleksandr/ci/drone_gitea/data:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST=0.0.0.0
      - DRONE_GITEA=true
      - DRONE_GITEA_URL=http://0.0.0.0:3000/
      - DRONE_SECRET=123123

之后,我想用gitea授权无人机,所以我去0.0.0.0:8001,输入登录名和密码但是无人机服务器returns出错:

drone-server_1  | time="2017-10-07T10:11:50Z" level=error msg="cannot authenticate user. Post http://0.0.0.0:3000/api/v1/users/root/tokens: dial tcp 0.0.0.0:3000: getsockopt: connection refused"

问题是 0.0.0.0 指的是内部容器网络。除非 gitea 和 drone 运行 在同一个网络和同一个容器中,否则这是行不通的。

相反,您应该向 drone 提供 Gitea 主机名(例如 http://gitea.company.com)或 Gitea public IP 地址。