GithubHelp home page GithubHelp logo

guoyu07 / ci-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from khs1994-docker/ci

0.0 0.0 0.0 19 KB

Gogs( GitHub )+Drone+Docker Registry | 私有化的 CI/CD & DevOps 解决方案

Home Page: https://drone.khs1994.com

Shell 84.77% PHP 1.61% JavaScript 13.62%

ci-1's Introduction

私有化 CI/CD 解决方案

GitHub stars star

如何工作

1. 本地制作 Docker 镜像推送到私有仓库(Docker Registry)

2. 本地开发项目,项目根目录编写 .drone.yml 文件,推送到 git (例如,GitHub,Gogs ...)

3 Drone 自动拉取代码完成编译,部署 (Drone 本质就是在指定的容器中运行指定的命令,通过项目根目录中的 .drone.yml 文件指定)。

4 支持哪些编程语言?理论上支持所有的编程语言!

TLS

本教程通过 IP + 不同端口 来提供不同的服务,如果你想要通过域名(With TLS)来提供不同的服务,请查看 README.TLS.md

准备

  • 有公网 IP 的云服务器(推荐,但不是必须)

  • Docker CE v18.03 Stable +

  • docker-compose v1.20.1 +

  • 知道如何注册 GitHub App (GitHub only)

  • brew install gnu-sed (macOS only)

快速开始

安装

$ git clone https://github.com/khs1994-docker/ci.git ~/ci

$ cd ci

修改配置

执行以下命令完成初始化,然后修改配置。

$ ./ci.sh

修改 .env 中的 CI_HOST 变量值为 你自己的 IP(例如 云服务器公网 IP路由器分配给电脑的 IP)

MySQL 密码

修改 secrets/mysql.env 中的 MYSQL_ROOT_PASSWORD 变量值为 MySQL 密码。

启用软件

修改 .env 中的 CI_INCLUDE 变量。

使用外部服务?

编辑 .env 文件,编辑 CI_INCLUDE 变量,去掉内置的软件名,之后填写外部服务的相关配置

# CI_INCLUDE="drone-server drone-agent gogs registry mysql redis"

CI_INCLUDE="drone-server drone-agent gogs registry"

CI_EXTERNAL_MYSQL_HOST=
CI_EXTERNAL_MYSQL_PORT=
CI_EXTERNAL_MYSQL_USERNAME=
CI_EXTERNAL_MYSQL_PASSWORD=
CI_EXTERNAL_MYSQL_DATABASE=

CI_EXTERNAL_REDIS_HOST=

选择 Git 服务商

编辑 docker-compose.override.yml 文件最下方

默认使用 Gogs ,如需使用 GitHub 按如下内容修改

...

services:
  drone-server:
    # << : *gogs
    << : *github
    # << : *coding
    # << : *khs1994

启动

$ ./ci.sh up [-d] [--reset]

访问服务

能不开放端口尽量不开放(例如数据库、缓存)。

  • git HTTP 3000

  • git SSH 8022

  • drone 8000

  • registry 5000

启用构建

Drone 页面登录账号,在项目列表的右边打开开关,将项目推送到 Git,可以看到 Drone 开始构建项目。

使用示例

最佳实践

https://www.khs1994.com/categories/CI/Drone/

More Information

ci-1's People

Contributors

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