Drone

How to set up an agent on remote server

Hi, I want to construct drone on multi servers.
For example, master drone container is on FOO server and agent drone container is on BAR server.
FOO and BAR server is located in the same network and they have only private IP address.

When we access drone UI, we go there with LB in front of master drone container.

But I don’t understand how to set up the architecture.
After trying set-up with drone documentation multi server mode and agent , I tried to build a job,
drone run the job on the FOO server. ( I expected BAR server to process the job… )
What is wrong?

I’m glad if you teach me why.

===
here is docker command.

master ( the command is run on FOO server)

docker run \
  --volume=/var/run/docker.sock:/var/run/docker.sock   \
  --volume=/var/lib/drone:/data   \
  --env=DRONE_GITHUB_SERVER=${GITHUB_URL}   \
  --env=DRONE_GITHUB_CLIENT_ID=${CLIENT_ID}  \
  --env=DRONE_GITHUB_CLIENT_SECRET=${SECRETKEY}   \
  --env=DRONE_REPOSITORY_FILTER=${PRODUCT_NAME}   \
  --env=DRONE_RUNNER_CAPACITY=2  \
  --env=DRONE_SERVER_HOST=${MASTER_SERVER_LB_PUBLIC_IP}   \
  --env=DRONE_SERVER_PROTO=http   \
  --env=DRONE_TLS_AUTOCERT=false   \
  --env=DRONE_LOGS_DEBUG=true   \
  --env=DRONE_GIT_ALWAYS_AUTH=true  \
  --env=DRONE_AGENTS_ENABLED=true  \
  --env=DRONE_RPC_SECRET=ZZZZZZZZZZZZZZZZZZ  \
  --publish=80:80   \
  --publish=443:443  \
  --restart=always   \
  --detach=true   \
  --name=drone   \
drone/drone:1.0.0-rc.6

agent ( the command is run on BAR server)

docker run \
  --volume=/var/run/docker.sock:/var/run/docker.sock \
  --env=DRONE_RPC_SERVER=${MASTER_SERVER_PRIVATE_IP} \
  --env=DRONE_RPC_SECRET=ZZZZZZZZZZZZZZZZZZ \
  --env=DRONE_RUNNER_CAPACITY=2 \
  --env=DRONE_RUNNER_NAME=agent1 \
  --env=DRONE_LOGS_DEBUG=true \
  --restart=always \
  --detach=true \
  --name=agent \
  drone/agent:1.0.0-rc.6

As an aside, you should probably be using 1.2.0, the latest stable release, instead of 1.0.0-rc.6 which is a release candidate and is no longer being supported.

1 Like

@bradrydzewski
Thanks for comment.
I updated drone image version to 1.2.0

#master
docker ps
CONTAINER ID        IMAGE               COMMAND               CREATED             STATUS              PORTS                                      NAMES
44fde753136c        drone/drone:1.2.0   "/bin/drone-server"   2 minutes ago       Up 2 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   drone

#agent
docker ps
CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS               NAMES
6b49d6ae732e        drone/agent:1.2.0   "/bin/drone-agent"   2 minutes ago       Up 2 minutes                            agent

But, there is no change…
I guess that DRONE_RPC_SERVER option which is on agent server is wrong.
Now I wrote MASTER_SERVER_PRIVATE_IP.
Is it AGENT_SERVER_PRIVATE_IP by change?