03 Continuous Integration and Deployment/Infrastructure - The Road to DevOps

02 Continuous Integration and Deployment/Infrastructure - The Road to DevOps

Article Github address, welcome start: https://github.com/li-keli/DevOps-WiKi

There are two options for continuous integration and deployment of services:

  • Gitlab Runner
  • Jenkins

Gitlab Runner

Gitlab Runner is used here CI/CD.

cicd_pipeline_infograph

Official documentation: https://about.gitlab.com/features/gitlab-ci-cd/

To install Gitlab Runner on the node02 node, first download the Runner program. This program is developed by go, so the deployment is very convenient, just a binary executable program.

Download address: https://docs.gitlab.com/runner/install/bleeding-edge.html

2018-04-08_150317

Select the binary executable program to download according to the architecture version of your server.

The final shell script is as follows:

run by normal user

wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/master/binaries/gitlab-runner-linux-amd64 && \
chmod +x gitlab-runner && \
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash && \
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner && \
gitlab-runner start

run as root user

wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/master/binaries/gitlab-runner-linux-amd64 && \
chmod +x gitlab-runner && \
mkdir /home/gitlab-runner && \
gitlab-runner install --user=root --working-directory=/home/gitlab-runner && \
gitlab-runner start

Then the Runner deployment is complete, and then configure the Runner:

existGitlab > 项目 > settings > CI/CD > Runners settings

There is a detailed Runner introduction on this page

2018-04-08_152128

Follow the instructions to configure, here is a shell script:

Shell build

gitlab-runner register \
  --url "http://git.examlpe.com" \
  --registration-token "PROJECT_REGISTRATION_TOKEN" \
  --description "this is a runner" \
  --tag-list "build" \
  --executor "shell"

After the above configuration is completed, you can see the running Runner in the gitlab project setting.

注:此处最后异步选择执行方式为shell,选择shell是为了方便初次使用CI部署,了解配置脚本,后期会使用docker执行执行

In addition, due to the limited knowledge of the author himself, he is all groping, so not all practices are correct, or some practices will have better solutions. I hope readers will correct me. If you have any questions, please leave issues .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324977506&siteId=291194637