Code Monkey home page Code Monkey logo

hetzner-gitlab-runner's Introduction

Auto-scale CI jobs with Gitlab Runner and the Hetzner Docker Machine driver

With this patched GitLab Runner image, you can auto-scale your CI jobs on Hetzner Cloud. The patch installs the Hetzner Docker Machine driver and is available on Docker Hub.

You can follow the official GitLab docs for configuring the GitLab Runner with docker machine, just use this image as a drop in replacement for gitlab/gitlab-runner.

See the example config.toml and docker-compose.yaml below for the hetzner specific docker machine options.

Usage

Use this image instead of the gitlab/gitlab-runner image and set MachineDriver to hetzner in your runner configuration.

Example config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "docker-machine"
  url = "https://gitlab.com"
  token = "your-token"
  executor = "docker+machine"
  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 536870912
  [runners.cache]
  [runners.machine]
    IdleCount = 0
    IdleTime = 1800
    MaxBuilds = 10
    MachineDriver = "hetzner"
    MachineName = "runner-%s"
    MachineOptions = [
      "hetzner-api-token=hetzner-api-token",
      "hetzner-image=ubuntu-18.04",
      "hetzner-server-type=cx31",
    ]

Example docker-compose.yaml:

version: "3.8"

services:
  hetzner-runner:
    image: mawalu/hetzner-gitlab-runner:latest
    volumes:
      - "./hetzner_config:/etc/gitlab-runner"

Docker Errors

If you face docker problems at runtime (such as the one below), you can specify a Docker version in the MachineOptions.

 MachineOptions = [
      "engine-install-url=https://releases.rancher.com/install-docker/19.03.9.sh",
    ]

Possible error that is caused by Docker:

ERROR: Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded  driver=hetzner name=runner-xxx-xxx operation=create

See this issue for more information.

Versions

Currently this image is build using the gitlab/gitlab-runner:latest image and the latest docker-machine hetzner plugin. If you need builds for another version feel free to open an PR.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.