Skip to content

Commit 9a967f6

Browse files
committed
add example in usage.md
1 parent 81af301 commit 9a967f6

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

Diff for: docs/usage.md

+73
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,79 @@ module "runner" {
144144
}
145145
```
146146

147+
### Scenario: Use of Docker autoscaler
148+
149+
As docker machine is no longer maintained by docker, gitlab recently developed docker_autoscaler to replace docker machine (still in beta). An option is available to test it out. It reuses the arguments int he docker-machine block arguments and create an autoscaling groupthat will be supplied to docker-autoscaler.
150+
151+
Tested with amazon-linux-2-x86 as runner manager and ubuntu-server-22-lts-x86 for runner worker. The following commands have been added to the original AMI for the runner worker for the docker-autoscaler to work correctly:
152+
153+
```
154+
# Install docker
155+
# Add Docker's official GPG key:
156+
apt-get update
157+
apt-get install -y ca-certificates curl
158+
install -m 0755 -d /etc/apt/keyrings
159+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
160+
chmod a+r /etc/apt/keyrings/docker.asc
161+
162+
# Add the repository to Apt sources:
163+
echo \
164+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
165+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
166+
tee /etc/apt/sources.list.d/docker.list > /dev/null
167+
apt-get update
168+
169+
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
170+
usermod -aG docker ubuntu
171+
```
172+
173+
#### Configuration example
174+
175+
```hcl
176+
module "runner" {
177+
# https://registry.terraform.io/modules/cattle-ops/gitlab-runner/aws/
178+
source = "cattle-ops/gitlab-runner/aws"
179+
180+
vpc_id = module.vpc.vpc_id
181+
subnet_id = element(module.vpc.private_subnets, 0)
182+
183+
runner_gitlab = {
184+
tag_list = "runner_worker"
185+
type = "instance"
186+
url = "https://gitlab.com"
187+
188+
preregistered_runner_token_ssm_parameter_name = "my-gitlab-runner-token-ssm-parameter-name"
189+
}
190+
191+
runner_manager = {
192+
maximum_concurrent_jobs = 5
193+
}
194+
195+
runner_worker = {
196+
max_jobs = 5
197+
request_concurrency = 5
198+
type = "docker_autoscaler"
199+
}
200+
201+
runner_worker_docker_autoscaler_asg = {
202+
on_demand_percentage_above_base_capacity = 0
203+
enable_mixed_instances_policy = true
204+
}
205+
206+
runner_worker_docker_autoscaler = {
207+
connector_config_user = "ubuntu"
208+
}
209+
210+
runner_worker_docker_machine_instance = {
211+
idle_time = 600
212+
subnet_ids = vpc.private_subnets_ids
213+
types = ["t3a.medium", "t3.medium"]
214+
volume_type = "gp3"
215+
}
216+
217+
}
218+
```
219+
147220
## Examples
148221

149222
A few [examples](https://github.com/cattle-ops/terraform-aws-gitlab-runner/tree/main/examples/) are provided. Use the

0 commit comments

Comments
 (0)