Register Multiple Runners on Same Host

Correct me if I’m wrong but as far as I see there is no best practice given of how to best setup multiple runners on the same VM and I think logically that is a commonly considered use case.

Could you please give examples for Mac or Linux of how to setup multiple hosts on the same machine without sharing the same config.toml? Mostly interested in Linux setup, as for Windows there was a hint on stackoverflow.

Why can’t I run more than one instance of Runner? You can, but not sharing the same config.toml file.

Running multiple instances of Runner using the same configuration file can cause unexpected and hard-to-debug behavior. In GitLab Runner 12.2, only a single instance of Runner can use a specific config.toml file at one time.

Source: https://docs.gitlab.com/runner/faq/

Will be very thankful if you could share a solution that doesn’t violate the point described above,

Me :slight_smile:

Sorry, what exactly do you want to achieve ?

On 1 VM (or normal host), create multiple runners, and register them on Gitlab. Do this, without violating the quoted rule above which comes directly from the Gitlab documentation.

Uhm, you don’t have to run multiple runners, instead you should run multiple executors. Imagine the runner as the hypervisor and the executor being the thread that’s actually executing your CI job(s).

Now all you have to do is;

  • install the GL CI runner on your VM
  • register the first executor
    • executor: docker, image: alpine:latest, tags: docker
  • register another runner
    • executor: docker, image: alpine:latest, tags: docker
  • then another one
    • executor: docker, image: alpine:latest, tags: docker
  • and so on, and so on…

There’s no need to have multiple runner services installed on the same system (at least I don’t see anything you can “gain” with such setup)

Kind regards,
~ Aljaz

Thank you for your answer! Apparently, I’ve had my terminology wrong. Now it makes sense. Executors is what I need and I guess now letting them share the same config.yaml is safe. Thanks :slight_smile: