Hey all,
I’m following this guide to implement the autoscaling with AWS EC2
I configure all the parameters needed to create an EC2 instance via docker-machine.
Here is my config.toml
concurrent = 10
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab-runner-manager"
url = "****"
id = ****
token = "****"
token_obtained_at = ****
token_expires_at = ****
executor = "docker+machine"
limit = 20
[runners.cache]
Type = "s3"
Shared = true
[runners.cache.s3]
ServerAddress = "s3.amazonaws.com"
AccessKey = "****"
SecretKey = "****"
BucketName = "****"
BucketLocation = "us-east-1"
[runners.docker]
image = "alpine:latest"
privileged = true
disable_cache = true
[runners.machine]
IdleCount = 1
IdleTime = 1800
MaxBuilds = 100
MachineDriver = "amazonec2"
MachineName = "gitalb-runner-%s"
MachineOptions = [
"amazonec2-access-key=****",
"amazonec2-secret-key=****",
"amazonec2-region=us-east-1",
"amazonec2-vpc-id=vpc-****",
"amazonec2-subnet-id=subnet-****",
"amazonec2-zone=a",
"amazonec2-iam-instance-profile=****",
"amazonec2-security-group=****",
"amazonec2-use-private-address",
"amazonec2-private-address-only",
"amazonec2-ami=ami-053b0d53c279acc9"
]
[[runners.machine.autoscaling]]
Periods = ["* * 9-17 * * mon-fri *"]
IdleCount = 2
IdleTime = 3600
Timezone = "UTC"
[[runners.machine.autoscaling]]
Periods = ["* * * * * sat,sun *"]
IdleCount = 1
IdleTime = 60
Timezone = "UTC"
I created an IAM user with EC2, S3, IAM fullaccess to test and run the following command.
docker-machine create -d amazonec2 --amazonec2-access-key **** --amazonec2-secret-key **** --amazonec2-region us-east-1 --amazonec2-vpc-id vpc-**** --amazonec2-subnet-id subnet-**** --amazonec2-zone a --amazonec2-iam-instance-profile **** --amazonec2-security-group **** --amazonec2-use-private-address --amazonec2-private-address-only --amazonec2-ami ami-053b0d53c279acc90 gitlab-runner-testing-machine
All is good with this command (ec2 is created), but the Gitlab Runner Manager can’t create the machines with the same parameters. It looks like a “loop” error, where it tried to create and then connect to docker, but the docker is not installed yet. That state triggers a delete action (I guess)… it seems to need some time to do a “recheck” or something like this.
Can someone give me a hand plz?