Git Product home page Git Product logo

fargate-gitlab-runner's Introduction

Docker image for ECS task for Fargate GitLab runner managers, using GitLab custom executor driver for AWS Fargate.

This repo is part of a set of repos for the complete setup of ECS Service for managers and workers:

Features

  • Use environment variables for dynamic runtime setup
  • Support multiple manager configurations, each has its own runner tag list, worker's docker image, network and security setting. For example:
{
  "w1": {
    "manager_name": "w1",
    "tag_list": "a,b,c",
    "limit": 10,
    "worker_ecs_cluster_arn": "ecs_cluster_arn_1",
    "worker_aws_region": "region-1",
    "worker_subnet_id": "subnet-123",
    "worker_security_group_id": "sg-321",
    "worker_task_definition_arn": "task_definition_arn_1",
    "worker_ssh_user": "user_1"
  },
  "w2": {
    "manager_name": "w2",
    "tag_list": "d,e",
    "limit": 20,
    "worker_ecs_cluster_arn": "ecs_cluster_arn_2",
    "worker_aws_region": "region-2",
    "worker_subnet_id": "subnet-456",
    "worker_security_group_id": "sg-654",
    "worker_task_definition_arn": "task_definition_arn_2",
    "worker_ssh_user": "user_2"
  }
}

Architecture

ECS Fargate GitLab runner Architecture

Build the image

  • Set IMAGE_NAME and IMAGE_TAG variables as desired.
  • Use docker-compose build to build the image. Alternatively run: docker build -t ${IMAGE_NAME}:${IMAGE_TAG}.

Note: If you use podman instead of docker, install podman-compose to work with docker-compose.yml.

Local test

  • Set RUNNER_NAME_PREFIX, GITLAB_REGISTRATION_TOKEN, GITLAB_URL and MANAGERS_CONFIGS variables. MANAGERS_CONFIGS can be set using the sample config: export MANAGERS_CONFIGS=$(cat samples/managers_configs.json).
  • To test the image, use docker-compose down >/dev/null 2>&1; docker-compose up or docker run --rm -e GITLAB_URL -e GITLAB_REGISTRATION_TOKEN -e RUNNER_NAME_PREFIX -e MANAGERS_CONFIGS ${IMAGE_NAME}:${IMAGE_TAG}.

Publish to ECR

  • Set AWS_ACCOUNT_ID and AWS_REGION variables as desired.
  • Login to ECR aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
  • Publish to ECR using docker-compose push or docker push ${IMAGE_NAME}:${IMAGE_TAG} where ${IMAGE_NAME} starts with the ecr domain ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com

Known limitation:

Credits:

fargate-gitlab-runner's People

Contributors

qtangs avatar

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.