Cost effective implementation Gitlab Runners Autoscale on Exoscale
Gitlab impresses with its features over the time. I recently learned that gitlab-runner does a surprising task which I underlooked and been bugging me for a long time.
When Gitlab tweeted about a pool to support of AWS infrastructure, I was wondering it’s going to develop a module in gitlab-ce. To my surprise gitlab-runner already
supports load balancer kind of support.
Hope that you have the minimum knowledge about the runners in gitlab. So, I focussed on implementaion of runners or instances at Exoscale.
Know more about the Git-Lab runners here
What is Exoscale?
Exoscale is an Swiss Cloud Provider. It provides everything for cloud native applications with high performance and cost effective. The best part is it provides autoscaling instances on demand and managing them smartly.
Runner Configuration
The following configuration can be used as a template or pattern to configure your runner. Don’t forget to add your sensitive authentication details like tokens and keys provided by Exoscale.
concurrent = 5
check_interval = 0[[runners]]
name = "runner"
url = ""
token = ""
executor = "docker+machine"
[runners.docker]
image = "alpine:latest"
volumes = ["/cache"]
[runners.cache]
Type = "s3"
ServerAddress = "sos-ch-dk-2.exo.io"
AccessKey = ""
SecretKey = ""
BucketName = "runners-cache"
[runners.machine]
IdleCount = 0
IdleTime = 600
MaxBuilds = 100
MachineName = "auto-scale-%s"
MachineDriver = "exoscale"
MachineOptions = [
"exoscale-api-key=",
"exoscale-api-secret-key=",
"exoscale-availability-zone=ch-dk-2",
"exoscale-disk-size=10",
"exoscale-image=ubuntu-16.04",
"exoscale-instance-profile=micro"
]
[runners.machine]
IdleCount = 0
IdleTime = 3600
MaxBuilds = 100
MachineName = "gitlab-runner-%s"
MachineDriver = "exoscale"
MachineOptions = [
"exoscale-api-key=",
"exoscale-api-secret-key=",
"exoscale-availability-zone=ch-dk-2",
"exoscale-disk-size=10",
"exoscale-image=ubuntu-16.04",
"exoscale-instance-profile=micro"
]
If you observe the configuration, The Idle Time
is 3600
seconds which is 1 hour. The exoscale providers has hourly billing
I am using micro
instance with 512MB
RAM and 1 CPU Core
which is sufficient to me.
Exoscale has 4 zones till now, there are 2 reasons to choose ch-dk-2
- Hosted in Swiss
- Exoscale object storage is stored in
ch-dk-2
Once the GitLab runner is activated, instances are created on demand in similar manner. The following screenshot resembles the live instances
Instance Deletion
The runner instance is deleted after the time-out of IdleTime
as mentioned in the runner config file.
Exoscale Dashboard
The Exoscale Dashboard comprises of clean user interface with vivid information. Check the following screenshot
Autoscale Downsides
- Initialing Docker every time.
- Installing from the scratch.
Positives AutoScale
- GitOps made easy
- Financially cheaper to the exisitng model.
Postivies ExoScale
- Decent Hardware
- Robust Privacy Policy
- Relatively Cheaper to AWS (Depends on usage)
- In-House S3 storage (NO Billing for API Calls)
Usage Costs
Downsides
- Procooked ISO/ Snapshots are not yet available
- ExoScale snapshots are limited to instances.
I belive that they are planning to implement this in future as mentioned in their blog post.
If precooked images are available, we can save the build time.