[SLOVED]How run agent with multi machines

My drone version is 0.8.2 and deploy with docker-compose. I run server and one agent at ci.xxx.com host and I want to run another agent at B host. I set config like Multiple build machines said. But drone output some error message like:

drone-agent_1  | INFO: 2017/12/08 01:43:55 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: address ws://ci.xxx.com:9000/ws/broker: too many colons in address"; Reconnecting to {ws://ci.xxx.com:9000/ws/broker <nil>}

and I also tried set DRONE_SERVER in drone-agent service config like ci.xxx.com or ci.xxx.com:9000, that all output same error. So what’s the correct config should I set?

ws://ci.xxx.com:9000/ws/broker

The root cause of the error is an invalid server address. 0.7 uses websockets and 0.8 uses grpc. You can see an example of the correct configuration here http://docs.drone.io/installation/

that all output same error.
“too many colons in address”

I feel like they must have had different errors … ci.xxx.com does not contain colons, which is what your error indicates. Please configure the server address using the format specified in the official documentation (also shows below) and then report back your results.

DRONE_SERVER=ci.xxx.com:9000

If you do get an error, it will most certainly be network related. So please check your firewall settings to make sure the ports are correctly exposed in your docker container and on your host machine.

Thank you for your rely. Yes as you said, when I set DRONE_SERVER=ci.xxx.com:9000 it tips:

drone-agent_1  | INFO: 2017/12/08 02:04:44 transport: http2Client.notifyError got notified that the client transport was broken unexpected EOF.

My ci.xxx.com config is:

version: '2'

services:
  drone-server:
    image: drone/drone:0.8.2

    ports:
      - 3781:8000
      - 9000
    volumes:
      - /var/www/ci.xxx.com:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST=http://ci.xxx.com
      - DRONE_GOGS=true
      - DRONE_GOGS_URL=http://git.xxx.com
      - DRONE_SECRET=xxx

  drone-agent:
    image: drone/agent:0.8.2

    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=xxx

and my new drone agent in B host config is:

version: '2'
services:
  drone-agent:
    image: drone/agent:0.8.2
    command: agent
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=ci.xxx.com:9000
      - DRONE_SECRET=xxx

This indicates some sort of networking error. Either your server is not accepting the connection or something is breaking the connection. Your drone configurations is fine. It is likely an issue with your host machine or your network topology, not with Drone or with your Drone configuration.

The most common issue we see is people trying to route their connection through a reverse proxy or load balancer that does not support http2. The agent and server communicate using grpc, which uses http2.

Hi,

To me the issue is located here

If you setup an agent locally, i’ll be good.
But when you add a remote agent, the port 9000 will not be reachable, since docker will assign a random port.
You need to change the port settings to :

 ports:
      - 3781:8000
      - 9000:9000

2 Likes

Yes, you are right. I modified it and then it works! Thank you very much!