Gogs and Drone environment build

foreword

CI/CD is one of the indispensable processes in DevOps. In the early stage of project formation, based on past experience, the combination of gitlab+jenkins was selected. These two tools have a relatively long history and very complete functions. They are a very recommended tool combination.

  • gitlab

Developed based on the ROR framework, gitlab has been iterated to 10 major versions, and is one of the more mature git tools on the market. Due to its long history, its functions are quite complete, not only limited to code management, but now it has developed into a complete project cycle management platform that integrates very cutting-edge tools such as git, ci, and scrum.

  • jenkins

Java language development, plug-in system is very complete, supports almost all platforms and languages, powerful functions, is a relatively mainstream CI/CD platform.

Why choose gogs+drone

  • Gitlab is written in ruby, jenkins is written in java, and the projects are relatively large, so the hardware requirements are relatively high, gitlab requires at least 4G of memory in the system, and jenkins at least 2G, so if you want to install these two on a server, Prepare at least 8G of system memory.
  • Recently, I have been more interested in golang. The language is more balanced between performance and overhead, which is more suitable for people like me who are stingy about hardware.
  • Force high, can be used to show off skills.

Install

  • Installed through docker-compose, the corresponding docker-compose.ymlfile content is as follows:
version: '2'

services:
  gogs:
    image: gogs/gogs:latest
    ports:
      - "10022:22"
      - 3000:3000
    volumes:
      - /vagrant/gogs-data:/data
    restart: always
  mysql:
    image: mysql:latest
    ports:
      - 3306:3306
    volumes:
      - /vagrant/mysql-data:/var/lib/mysql
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=${your_password}
      - MYSQL_DATABASE=gogs
  drone-server:
    image: drone/drone:latest
    ports:
      - 8000:8000
      - 9000:9000
    volumes:
      - /var/lib/drone:/var/lib/drone
    restart: always
    environment:
      # 开启注册,此配置允许任何人自注册和登录系统
      - DRONE_OPEN=true
      #直接配置172.17.32.212:9000 会报错
      - DRONE_HOST=http://172.17.32.212:9000
      # 设置管理员用户
      - DRONE_ADMIN=admin
      # 开启Gogs驱动
      - DRONE_GOGS=true
      # Gogs服务器地址
      - DRONE_GOGS_URL=http://172.17.32.212:3000
      # 此SECRET为任意值
      - DRONE_SECRET=YeNmPSFyl090RMy4
  drone-agent:
    image: drone/agent:latest
    command: agent
    restart: always
    depends_on: 
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      # Drone Server 地址,无需加http://
      - DRONE_SERVER=172.17.32.212:9000
      # 与Drone Server一致即可
      - DRONE_SECRET=YeNmPSFyl090RMy4
  • Deploy the docker-compose service
$ docker-compose up -d

This completes the deployment of the tool

Guess you like

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