Slide 1

Slide 1 text

Drone CI/CD Platform Drone is a Continuous Delivery platform built on Docker, written in Go 2018/11/03

Slide 2

Slide 2 text

Agenda • Why I don’t choose Jenkins or GitLab CI? • What is Drone CI? • Drone Infrastructure • How to install Drone in five minutes? • Integrate your project • Create your Drone plugin • Try drone cli without drone server

Slide 3

Slide 3 text

About Me appleboy @ appleboy @

Slide 4

Slide 4 text

Jenkins Drone Travis Gitlab ci

Slide 5

Slide 5 text

Why I leave Jenkins

Slide 6

Slide 6 text

Why? • Complicated project setting • Write the plugin (Java language) • Maintenance? • Learning Curve? • Grow your team?

Slide 7

Slide 7 text

Try the GitLab CI

Slide 8

Slide 8 text

.gitlab-ci.yml config

Slide 9

Slide 9 text

But Why I leave GitLab CI ?

Slide 10

Slide 10 text

Why? 1. GitLab Only 2. Not extensible

Slide 11

Slide 11 text

SSH Tunnel

Slide 12

Slide 12 text

How to use SSH command

Slide 13

Slide 13 text

https://florianbrinkmann.com/en/3473/deployment-gitlab-ci/

Slide 14

Slide 14 text

Try drone-ssh tool https://github.com/appleboy/drone-ssh

Slide 15

Slide 15 text

pipeline: ssh: image: appleboy/drone-ssh host: foo.com username: root password: 1234 port: 22 script: - echo hello - echo world proxy_host: 10.130.33.145 proxy_user: ubuntu proxy_port: 22 proxy_password: 1234 custom key

Slide 16

Slide 16 text

What is Drone?

Slide 17

Slide 17 text

Drone CI • Container native CI/CD platform • Easy to install & maintain • Isolate builds • Simple YAML Configuration • Integrates with several VCS Providers • Rich set of official plugins (any container can be a plugin) • Execute locally with simple command (drone exec) • open source (https://github.com/drone/drone)

Slide 18

Slide 18 text

Everything is a Docker Container

Slide 19

Slide 19 text

Project CI/CD Flow git clone testing deploy notify

Slide 20

Slide 20 text

Project List and Status

Slide 21

Slide 21 text

Job detail and logs

Slide 22

Slide 22 text

.drone.yml

Slide 23

Slide 23 text

Isolate build

Slide 24

Slide 24 text

Support Git Host

Slide 25

Slide 25 text

Drone CI Infrastructure Agent Server Step 1 git clone Step 2 make build Step 3 deploy app work space extra service Agent

Slide 26

Slide 26 text

Support Platform https://blog.drone.io/drone-cloud-native-ci-cd-windows-containers/ https://blog.drone.io/drone-announces-official-support-for-arm/

Slide 27

Slide 27 text

services: drone-server: image: drone/drone:0.8 ports: - 8080:8000 volumes: - ./:/var/lib/drone/ restart: always environment: - DRONE_HOST=${HOST} - DRONE_OPEN=true - DRONE_SECRET=drone-workshop - DRONE_ADMIN=appleboy # GitHub Config - DRONE_GITHUB=true - DRONE_GITHUB_CLIENT=${CLIENT} - DRONE_GITHUB_SECRET=${SECRET} SQLite DB

Slide 28

Slide 28 text

drone-agent: image: drone/agent:0.8 restart: always depends_on: - drone-server volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - DRONE_SERVER=drone-server:9000 - DRONE_SECRET=drone-workshop - DRONE_MAX_PROCS=3 drone agent count

Slide 29

Slide 29 text

Auto scale drone agent https://github.com/appleboy/drone-on-kubernetes

Slide 30

Slide 30 text

Agent Server Agent Agent Agent autoscaler https://github.com/drone/autoscaler

Slide 31

Slide 31 text

Task - Agent drone_server=server:9000 Task - Server port: 80/9000 ECS - Fargate ECS - Service Target Group Port: 80 Route 53 Service Discovery ALB / SSL Cloud Watch https://github.com/appleboy/drone-terraform-in-aws

Slide 32

Slide 32 text

Deploy Flow in Golang Release Test Git Docker Notify

Slide 33

Slide 33 text

Pipeline in Golang • Go Testing • Verify Quality • Build Binary • Deploy Binary • Build Image • Deploy Container • Send Notification

Slide 34

Slide 34 text

workspace: base: /go/src path: github.com/go-ggz/ggz clone: git: image: plugins/git depth: 50 tags: true

Slide 35

Slide 35 text

Testing && Verify Quality

Slide 36

Slide 36 text

pipeline: backend: image: golang:1.11 pull: true commands: - cp .env.example .env - make embedmd - make fmt-check - make misspell-check

Slide 37

Slide 37 text

Parallel processing

Slide 38

Slide 38 text

build_linux_i386: image: golang:1.11 pull: true group: build environment: TAGS: sqlite commands: - SERVICE=ggz-server make build_linux_i386 - SERVICE=ggz-redirect make build_linux_i386 build_linux_arm64: image: golang:1.11 pull: true group: build environment: TAGS: sqlite commands: - SERVICE=ggz-server make build_linux_arm64 - SERVICE=ggz-redirect make build_linux_arm64

Slide 39

Slide 39 text

Build Docker

Slide 40

Slide 40 text

publish_linux_amd64: image: plugins/docker group: release pull: true repo: goggz/ggz-server dockerfile: dockerfile/server/Dockerfile secrets: [ docker_username, docker_password ] default_tags: true when: event: [ push, tag ] local: false Docker plugin for Drone CI/CD

Slide 41

Slide 41 text

Secret Security

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Notification Plugin

Slide 44

Slide 44 text

Write Drone Plugin Whether you prefer language PHP, Ruby, Bash, Go, Python

Slide 45

Slide 45 text

Three Steps •Program with your language •Build Docker Image and Testing •Upload to Docker Hub

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Prefix PLUGIN_

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

Testing in Local

Slide 50

Slide 50 text

Try Drone without Server drone exec

Slide 51

Slide 51 text

https://www.udemy.com/devops-oneday/?couponCode=DRONE-DEVOPS

Slide 52

Slide 52 text

Any Question?