terraform-aws-gitlab-runner
terraform-aws-gitlab-runner copied to clipboard
Support for multiple docker machines within a single runner instance
I'm currently doing small research in order to migrate my current GitLab runner setup (done with CloudFormation, modified and updated by hand via SSH) to Terraform. I'm currently using a setup with configuration like this:
concurrent = 20
check_interval = 0
[session_server]
session_timeout = 3600
[[runners]]
name = "team-a-runner"
url = "https://gitlab.(redacted)/"
token = "(team-a token redacted)"
executor = "docker+machine"
[runners.docker]
tls_verify = false
image = "alpine:latest"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = true
volumes = ["/certs/client", "/cache"]
shm_size = 0
[runners.cache]
Type = "s3"
Shared = true
[runners.cache.s3]
ServerAddress = "s3.amazonaws.com"
BucketName = "(redacted)"
BucketLocation = "eu-central-1"
[runners.machine]
IdleCount = 0
IdleTime = 1200
MaxBuilds = 100
MachineDriver = "amazonec2"
MachineName = "gitlab-docker-machine-%s"
MachineOptions = ["engine-storage-driver=overlay2", "amazonec2-instance-type=m5.large", "amazonec2-region=eu-central-1", "amazonec2-vpc-id=(redacted)", "amazonec2-security-group=(redacted)", "amazonec2-use-private-address=true", "amazonec2-iam-instance-profile=(redacted)"]
OffPeakPeriods = ["* * 0-9,17-23 * * mon-fri *", "* * * * * sat,sun *"]
OffPeakTimezone = "Etc/UTC"
OffPeakIdleCount = 0
OffPeakIdleTime = 300
[[runners]]
name = "team-b-runner"
url = "https://gitlab.(redacted)/"
token = "(team-b token redacted)"
executor = "docker+machine"
(same as above)
[[runners]]
name = "team-c-runner"
url = "https://gitlab.(redacted)/"
token = "(team-c token redacted)"
executor = "docker+machine"
(same as above)
[[runners]]
name = "team-d-runner"
url = "https://gitlab.(redacted)/"
token = "(team-d token redacted)"
executor = "docker+machine"
(same as above)
[[runners]]
name = "team-e-runner"
url = "https://gitlab.(redacted)/"
token = "(team-e token redacted)"
executor = "docker+machine"
(same as above)
I defined multiple [[runners]]
section in order to register separate runners for each Gitlab group (I can't register global runner in our company). A lot of improvements can be made to this setup, yet it's a few times cheaper than defining each runner group separately. So I have a question regarding registering more than one group of docker-machine
instances inside a single GL runner, as above. Is it a bad practice to register multiple runners?
I know it's doable within Terraform, as we may simply loop over instance types and generate more [[runners]]
sections. If not, why not define 12 different groups that are configured with 12 different EC2 instance types and create our own "spot fleet" within a single runner?
In my opinion it is not a bad practice at all to have multiple runners, we have as well. We have deployed the module a few times. To match different use cases, some of them ar dedicated to a team.
With Terrafomr 13 it should also be possible to loop over modules, so would it be an option to deploy the module one time for each time, the overad is in that case that you have 1 small ec2 instances for the agent running per team.
@npalm To try to avoid such cost overhead mentioned by you, I created proposal PR which should enable some cool stuff, like adding multiple different docker-machine configurations that run on spot. I'll check it tomorrow in practice on my side, please take a look and tell me what you think 😉
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
Hi ✋,
Sorry to re-open that, but i don't find how to use multiple runners config within a single instance. Has a solution been found ?
Thanks for your help.
Wasn't closed 😄
Started to work on krzysztof-miemiec PR. But it's not that easy. But this feature is definitely wanted.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
This issue was closed because it has been stalled for 15 days with no activity.