In this configuration, Drone is unable to access the repository: Could not resolve host: git.my-domain
My domain is only used in my local network, and I thought it will be fine with only Docker network’s aliases to redirect to the service. Is there a way to achieve the redirection without running a complete DNS server in my local network? (I use the web app on a single computer right now so editing /etc/hosts is not a problem)
I think you might be looking for DRONE_RUNNER_NETWORKS. You can search this forum and find people with a similar setup (Drone+Gitea on a single machine) that are using this setting to solve the same issue.
Failed to connect to git.my-domain port 80: Connection refused
drone is executing a standard git clone, from inside an alpine container [1]. It uses a netrc file for authentication so make sure gitea has git+http(s) cloning enabled. If a standard git clone fails, unfortunately, I am not sure there is much assistance I can offer you since this is happening outside the scope of the Drone codebase.
I would also recommend searching this forum for Connection refused clone errors. In my quick search it seems in all cases the reverse proxy is causing networking traffic to fail, or the source code management system disabled http cloning. I also recommend reserching other gitea posts with clone issues such at this.
Everything works fine, i can also push my commit without problems.
I have finally set up a DNS server in my local network, and add it in the docker-compose file on all my services instead of using network aliases. So each request with “my-domain” are handled by the reverse proxy, even requests made inside containers.
Even with the DNS server, the git command from the runner fails.
fatal: unable to access 'http://git.my-domain/someuser/somerepo.git/': Could not resolve host: git.my-domain
You can clearly see the unresolved name issue is back, so my guess is, the runner doesn’t use the same dns properties as the server (which can be normal for certain setup, but at least we need to have the option to use custom DNS servers).
the runner doesn’t use the same dns properties as the server
I think perhaps we are getting confused on terminology because the runner and server are the same thing. The server creates a user-defined network for every pipeline using docker network create and attaches this network to every container that it launches, including the clone container. It also attached networks that you provide via DRONE_RUNNER_NETWORKS.
I will admit that Drone was not created with this particular setup in mind, where it is co-located on the same machine as the version control system with custom networking and local DNS. It was built under the assumption that you are connecting to a central version control system (e.g. GitHub or GitHub enterprise) which is running on a separate server and accessible using a more traditional DNS configuration. People certainly find a way to hack everything to run on a single machine, however, this is not a configuration that I can personally support and help you triage because I lack the expertise. You may want to connect with other Gitea users in this forum that are running everything on the same machine and perhaps share notes.
I understood the server will attach “containers created by itself” (this is what i called “runner”) to DRONE_RUNNER_NETWORKS value. This is not enough to pass DNS properties unfortunately (you only get DNS made by Docker, which resolves docker service name with the right container).
I will try to find what’s going on in Drone source code and maybe make a PR.
Thank you for your support
EDIT : I have finally created a file at /etc/docker/daemon.json and place my dns server into it
Everything is working fine now, the Docker daemon gives automatically theses DNS servers to any created containers, so now “runners” are able to reach others containers by passing through Traefik.