Giter Club home page Giter Club logo

terraform-google-gitlab-runner's Introduction

Overview

This module creates a managed instance group of VM instances running gitlab-runner instances. Container Optimized OS images are used to simplify updates and management of the Docker host. gitlab-runner is installed into the VM host (not as a container) and registered to gitlab via cloud-init.

Features

  1. Automatic gitlab-runner registration to gitlab.com
  2. Instances are preemptible by default, reducing cost by 70 to 80%.
  3. Automatically unregister on [preemption][preemption], reboot, shutdown to clean up.
  4. Managed instance group automatically restarts preempted instances.
  5. Health checking against the gitlab-runner Prometheus metrics endpoint.
  6. Unhealthy instances are terminated and re-created.

Example Usage

variable "project" {
  description = "The instance group project"
}

variable "registration_token" {
  description = "The Gitlab registration token used to register this runner, found via /settings/ci_cd in the GitLab Web UI"
}

module gitlab-runner-public {
  name                  = "gitlab-runner-public"
  source                = "git::https://gitlab.com/openinfrastructure/code/terraform-google-gitlab-runner.git?ref=v0.1.0"
  project               = var.project
  registration_token    = var.registration_token
  tag-list              = ["docker", "gcp", "public"]
  service_account_email = "gitlab-runner-public@${var.project}.iam.gserviceaccount.com"
  machine_type          = "f1-micro"
}

module gitlab-runner-private {
  name                  = "gitlab-runner-private"
  source                = "git::https://gitlab.com/openinfrastructure/code/terraform-google-gitlab-runner.git?ref=v0.1.0"
  project               = var.project
  registration_token    = var.registration_token
  tag-list              = ["docker", "gcp", "private"]
  service_account_email = "gitlab-runner-private@${var.project}.iam.gserviceaccount.com"
  machine_type          = "f1-micro"
}

Operational Playbook

Update instances

Run terraform apply to update the instance template, then replace the instances with new ones using:

gcloud compute instance-groups managed rolling-action replace gitlab-runner

Logs

cloud-init Logs

Container Optimizes OS uses systemd-journal for all logs. Log into an instance and run sudo journalctl to view system boot logs including cloud-init execution steps.

terraform-google-gitlab-runner's People

Contributors

jeffmccune avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vedit

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.