Closed metal3d closed 8 years ago
OK ! Seeing #4 issue I understand that the data volume was not erased and the whole modification I made was not refreshed.
The solution is way simple. I needed to add a extra_host. This is what I set:
go-runner:
image: sameersbn/gitlab-ci-multi-runner:1.1.3-1
volumes:
- ./data:/home/gitlab_ci_multi_runner/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CI_SERVER_URL=https://git.develipsum.com/ci
- RUNNER_TOKEN=XXXXXXXXXX
- RUNNER_DESCRIPTION=Golang CI runner
- RUNNER_EXECUTOR=docker
- DOCKER_IMAGE=metal3d/go:1.6
restart: always
extra_hosts:
- "git.develipsum.com:195.154.76.142"
That way: git.develipsum.com is resolved by /etc/hosts correspondance
But... now... the runner cannot access my gitlab instance saying:
couldn't execute POST against https://git.develipsum.com/ci/api/v1/runners/register.json: Post https://git.develipsum.com/ci/api/v1/runners/register.json: dial tcp 195.154.76.142:443: getsockopt: no route to host
Note that if I add again "external_link" to "gitlab", my extra_host is not used because (inside the runner container) "/etc/hosts" has got 2 entries:
And so, the local one is used by default, so git.develipsum.com is resolved to 172.17.1.2 that is not ok.
To be precise: the problem is that the runner takes the "public" repository url that cannot be resovled inside the docker network.
I just find the problem and I open another issue closing this one
@metal3d Did you find a valuable solution for this issue?
Hi, yes. Sorry to not have explained this sooner.
Ok my problem is that "git.develipsum.com" is served by an external container (nginx), and local docker network cannot hit my nginx by using "git.develipsum.com" so I did a "trick". See the "links" section and CI_SERVER_URL also:
go-runner:
image: sameersbn/gitlab-ci-multi-runner:1.1.3-1
volumes:
- ./data:/home/gitlab_ci_multi_runner/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CI_SERVER_URL=http://gitlab/ci
- RUNNER_TOKEN=XXXXXXXXXX
- RUNNER_DESCRIPTION=Golang CI runner
- RUNNER_EXECUTOR=docker
- DOCKER_IMAGE=metal3d/go:1.6
restart: always
links:
- nginx_nginx_1:git.develipsum.com
- gitlab
That way, "git.develipsum.com" is resolved using "internal docker ip" and hits nginx. CI_RUNNER is using "gitlab" container name to contact.
But runners jobs want to hit "git.develipsum.com" to "git pull" the project. So ! After runner is up, I changed toml file to add links the same way:
links = ["nginx_nginx_1:git.develipsum.com"]
That way docker runner jobs can resolve "git.develipsum.com" hitting "nginx" with the docker local ip and not the public one.
That means that runner dockerfile should probably allows to create "links" that are inserted inside the toml file without the need to change it manually...
@sameersbn ? you're ok with the idea ? Maybe I can provide a PR (if I find the time)
Hi, and first thanks a lot for your docker gitlab images. I run them since 14 month without to have to complain :)
I've got a problem to run ci-multi-runner on the same host. I've got this output
Actually git.develipsum.com is served by a reverse proxy. I can access it outside and on my host. But not inside the "runner" container.
This is my docker-compose that runs:
"gitlab" link is my gitlab 8.6.7 (your image) and the runner is correctly registered.
Note that:
As you can see, actually, runner takes the private network address and not the public one. It resolves the name to "gitlab" that is my container name. So I imagine that the runner tries to connect to 172.17.0.1:443 that is not served by nginx reverse proxy (wich uses validated certificate)
The connection is refused.