Sign inSign up

wikiwi/gitlab-autoscale-runner

By wikiwi

Updated about 10 years ago

gitlab-autoscale-runner creates an autoscale runner for gitlab.

Image
1

3.3K

wikiwi/gitlab-autoscale-runner repository overview

gitlab-autoscale-runner

Warning: This is an early alpha version without commitment for backwards compatibility.

gitlab-autoscale-runner is a docker container specialized in creating an autoscale runner for gitlab. The default settings are geared towards creating a runner that allows building docker images. The first runner is automatically created and registered to the gitlab server.

Code Climate Widget MicroBadger Image Widget

Environment Variables

Here are some of the relevant Environment Variables.

NameDefaultDescription
CONFIG_FILE/etc/gitlab-runner/config.tomlPath to config file
CI_SERVER_URLhttps://gitlab.com/ciThe CI endpoint of gitlab
CONCURRENT20Hard limit of maximum number of machines running concurrently
REGISTRATION_TOKEN-The Runners Registration Token
RUNNER_NAMEAutoscale RunnerName of Runner
RUNNER_LIMIT1Maximum number of machines fors this Runner
MACHINE_NAMEgitlab-autoscale-%sNaming scheme for the VMs
MACHINE_MAX_BUILDS100Maximum builds until a machine is delete
MACHINE_IDLE_COUNT0Number of permanent idling hosts
MACHINE_IDLE_TIME600Seconds after which an idling host is deleted
MACHINE_DRIVER-Docker Machine driver e.g: 'digitalocean', 'google', 'aws', ...
DOCKER_IMAGEdocker:latestDefault image to run builds
DOCKER_PULL_POLICYalwaysImage Pull Policy
DOCKER_PRIVILEGEDtruePrivileged is required to run docker builds. Attention: Only allow trusted builds to run on this runner when this is true
CACHE_TYPE-Currently only s3 is supported for caching
S3_SERVER_ADDRESSs3.amazonaws.comAddress of S3-compactible endpoint
S3_ACCESS_KEY-S3 Credentials
S3_SECRET_KEY-S3 Credentials
S3_BUCKET_NAME-Name of Bucket in S3
S3_BUCKET_LOCATION-Region of Bucket in S3
S3_CACHE_INSECUREfalseIf true use http instead of https
DIGITALOCEAN_ACCESS_TOKEN-Access Token for creating VMs on DigitalOcean
DIGITALOCEAN_REGIONnyc3Region to run Droplets in
DIGITALOCEAN_SIZE512mbSize of Droplets
DIGITALOCEAN_IMAGEcoreos-betaDisk image of Droplets
DIGITALOCEAN_SSH_USERcoreSSH user to connect to Droplets
GOOGLE_APPLICATION_CREDENTIALS-If set docker machine will look for credentials at specified path, otherwise it will use credentials from metadata. Read more here.
GOOGLE_PROJECT-Google Project ID
GOOGLE_ZONEus-central1-aZone to provision the VM
GOOGLE_MACHINE_TYPEf1-microType of machine to provision
GOOGLE_MACHINE_IMAGEprojects/coreos-cloud/global/images/family/coreos-betaMachine Image ID
GOOGLE_SCOPEShttps://www.googleapis.com/auth/logging.writeScopes of provisioned machines
GOOGLE_DISK_SIZE10Size of Disk in GB
GOOGLE_DISK_TYPEpd-standardDisk type of ephermal disk
GOOGLE_USERNAMEcoreUsername to connect to the VM
GOOGLE_USE_INTERNAL_IPfalseUse internal IP when connecting to VM
GOOGLE_TAGSgitlab-autoscaleTags to be attached to the VMs
GOOGLE_PREEMPTIBLEfalseUse preemtible VMs

Persistance

For persistance you need to put the config file in a persistant volume. The config file if run as root is specified using the CONFIG_FILE Environment Variable otherwise it is saved to ~/.gitlab-runner/config.toml.

Examples

Start runner using GCE
docker run -e CI_SERVER_URL=https://gitlab.example.io/ci \
           -e REGISTRATION_TOKEN=Xz5waDAF4sgfADEXAMPLE \
           -e MACHINE_DRIVER=google \
           -e GOOGLE_PROJECT=my-project \
           -e GOOGLE_APPLICATION_CREDENTIALS=/etc/credentials.json \
           -v $(pwd)/credentials.json:/etc/credentials.json \
           wikiwi/gitlab-autoscale-runner
Start runner using DigitalOcean
docker run -e CI_SERVER_URL=https://gitlab.example.io/ci \
           -e REGISTRATION_TOKEN=Xz5waDAF4sgfADEXAMPLE \
           -e MACHINE_DRIVER=digitalocean \
           -e DIGITALOCEAN_ACCESS_TOKEN=2SBxEFaAWDe3AAWDEXAMPLE
           wikiwi/gitlab-autoscale-runner
Update Config
# When running as non-root
docker exec -it CONTAINER vi /home/gitlab-runner/.gitlab-runner/config.toml

# When running as root
docker exec -it CONTAINER vi /etc/gitlab-runner/config.toml
Add additional Runner
docker exec CONTAINER /bin/bash -c "RUNNER_NAME='My Runner' RUNNER_LIMIT=1 register.sh"

Docker Hub

Automated build is available at the Docker Hub.

TODO

  • Integrate and document AWS driver.

Tag summary

Content type

Image

Digest

Size

56.2 MB

Last updated

about 10 years ago

docker pull wikiwi/gitlab-autoscale-runner