Giter Site home page Giter Site logo

gitlab-jobs's Introduction

GITLAB JOBS

Background

In Microservice Architecture, we have many small services as repositories and the released time is very short. It's very high-load if we do all thing manually.

The jobs including:

  • autotag a repo when there are new code in the master branch
  • docker auto push image with new version
  • deploy the service in ec2 using docker

How to use

  1. add .gitlab-ci.yaml in a service's repo
  2. add code
stages:
  - tag
  - build
  - deploy
  
include:
  - remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.tag.yml
  - remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.docker.yml
  - remote: https://github.com/nvhoc/gitlab-jobs/releases/download/v1.0.0/default.gitlab-ci.ec2-deploy.yml

  1. define CI&CD variables:

3.1. to include .gitlab-ci.tag.yml:

  • generate a pair of key ssh by ssh-keygen => private_key && public_key
  • set SSH_PRIVATE_KEY=${private_key} (text)
  • add public key in "Deploy Keys" at "CI&CD settings"
  • set GITHUB_EMAIL=${your bot email}
  • set GITHUB_USER=${your username}

3.2. to include .gitlab-ci.docker.yml:

  • set DOCKER_USER_NAME=${your bot username in your docker registry}
  • set DOCKER_PASSWORD=${your bot password in your docker registry}

3.3. to include .gitlab-ci.ec2-deploy.yml:

  • note: the file support for simple deployment with docker-compose. I will add new file for k8s later.
  • set EC2_PEM_KEY=${content of pem file}
  • set EC2_USER=${ec2 username}
  • set EC2_HOST=${ec2 public address}
  • set EC2_DEPLOY_PATH=${ec2 path store docker-compose deployment} find a example at ./example/docker-compose

3.4. to include .gitlab-ci.yarn-build.yml:

  • set BUILD_PATH=${path of folder from building process}

3.5. to include .gitlab-ci.s3-sync.yml:

  • set BUILD_PATH=${path of folder that you want to sync to s3}
  • set S3_DEPLOY_BUCKET=${s3 bucket}
  • set AWS_ACCESS_KEY_ID=${aws access key}
  • set AWS_SECRET_ACCESS_KEY=${aws secret key}

gitlab-jobs's People

Contributors

nvhoc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.