Running Drone CI on Synology NAS

Hello! I am trying to run Drone CI server and runner on the Synology NAS using Docker. I have a public IP associated with my NAS server. The Drone CI is not accessible from outside when I run the Drone CI server in Docker on host network. The Gitea is also running on the same instance in the same network and I can access it from my public IP + port 3000.

If I run runner then I have the following error:
time=“2023-04-27T21:38:48Z” level=error msg=“cannot ping the remote server” error=“Post "public-ip:3001/rpc/v2/ping": dial tcp public-ip:3001: connect: connection refused”.

I replaced my actual public IP address with a placeholder in the example.

Here is my docker command for Drone CI server:
docker run
–volume=/var/lib/drone:/data
–env=DRONE_GITEA_SERVER=public-ip:3000/
–env=DRONE_GITEA_CLIENT_ID=client_id
–env=DRONE_GITEA_CLIENT_SECRET=client_secret
–env=DRONE_RPC_SECRET=secret
–env=DRONE_SERVER_HOST=public-ip:3001
–env=DRONE_SERVER_PORT=3001
–env=DRONE_SERVER_PROTO=http
–env=DRONE_TLS_AUTOCERT=false
–restart=always
–detach=true
–name=drone
–network=host
drone/drone:2

And runner command:

docker run --detach
–volume=/var/run/docker.sock:/var/run/docker.sock
–env=DRONE_RPC_PROTO=http
–env=DRONE_RPC_HOST=public-ip:3001
–env=DRONE_RPC_SECRET=secret
–env=DRONE_RUNNER_CAPACITY=2
–env=DRONE_RUNNER_NAME=drone-runner-1
–restart=always
–name=runner
–network=host
drone/drone-runner-docker:1

Output from Drone CI server:

{“acme”:false,“host”:“public-ip:3001”,“level”:“info”,“msg”:“starting the http server”,“port”:“:80”,“proto”:“http”,“time”:“2023-04-27T21:33:48Z”,“url”:“public-ip:3001”}
{“interval”:“30m0s”,“level”:“info”,“msg”:“starting the cron scheduler”,“time”:“2023-04-27T21:33:48Z”}
{“interval”:“24h0m0s”,“level”:“info”,“msg”:“starting the zombie build reaper”,“time”:“2023-04-27T21:33:48Z”}

Tried to execute curl command from the host and there was “connection refused”. If I run the Dron CI server with host of server’s private IP address then curl works.

What should be changed or added to access Drone CI from outside? There are no firewall rules set that block 3001 port and no other services use this port.

I removed http:// because it did not allow me to post the topic with links :blush:

Do you forward port 3001 to your NAS?

Yes. Also I found that Drone CI is not accessible from host machine (using host network, the same network as Gitea). And the same issue appears when I provide DRONE_SERVER_PORT env variable for Drone. Also checked that on my Windows machine.

I found the reason behind port forwarding, I need to add port mapping for my router as it is blocking all ports. But the question about custom DRONE_SERVER_PORT and host network remains. If I run it on host network and port mapping is ignored from docker options, then how do I know which port Drone CI uses? And how can I reconfigure it? Thanks.

Ah I see. If you use the host network, it will bind to port 80 and 443. Try those.

If you use host network, I am not sure if you can modify the ports easily without building your own docker image. The DRONE_SERVER_PORT is only used for URL generation I think.

Why do you use the host network in the first place?