CI/CD with Drone/Docker Justin Phelps onitato.com @Linuturk - - PowerPoint PPT Presentation

ci cd with drone docker
SMART_READER_LITE
LIVE PREVIEW

CI/CD with Drone/Docker Justin Phelps onitato.com @Linuturk - - PowerPoint PPT Presentation

CI/CD with Drone/Docker Justin Phelps onitato.com @Linuturk Terminology Lets discuss some terminology: CI CD Docker Drone CI Continuous Integration - test your code all the time for all the things, automatically. CD


slide-1
SLIDE 1

CI/CD with Drone/Docker

Justin Phelps onitato.com @Linuturk

slide-2
SLIDE 2

Terminology

Let’s discuss some terminology:

  • CI
  • CD
  • Docker
  • Drone
slide-3
SLIDE 3

CI

Continuous Integration - test your code all the time for all the things, automatically.

slide-4
SLIDE 4

CD

Continuous Delivery - deliver new code to environments as it is tested, automatically.

slide-5
SLIDE 5

Docker

  • New Hotness!
  • Isolated, self contained environment.
  • Minimum resource overhead.
  • Great for testing, with some exceptions.
slide-6
SLIDE 6

Docker

slide-7
SLIDE 7

Drone

  • Written in Go
  • Integrates with Github/Bitbucket
  • Open Source and “as a service”

https://github.com/drone/drone

slide-8
SLIDE 8

.drone.yml

Configuration sections:

  • image
  • env
  • script
  • services
  • notify
  • deploy / publish
slide-9
SLIDE 9

.drone.yml - image

The image option defines which Docker Image to use for testing.

  • python
  • ruby
  • node
  • dart
  • java
  • php
  • etc
slide-10
SLIDE 10

drone.yml - env

env is used to set environment variables. I like to use this to add another layer to my Secret Parameters. env:

  • RAXUSER={{rackspace_username}}
slide-11
SLIDE 11

.drone.yml - script

script defines your build commands for your

  • application. Include things like:
  • syntax checks and linting
  • unit tests
  • functional tests

Build fails if any command exits != 0

slide-12
SLIDE 12

.drone.yml - services

Define any services your app tests against. Some options include:

  • redis
  • couchdb
  • mysql
  • postgres
  • rabbitmq
  • mongo
  • etc
slide-13
SLIDE 13

.drone.yml - notify

Notify based on the results of your build.

  • email
  • webhook
  • hipchat
  • started
  • success
  • failure
slide-14
SLIDE 14

.drone.yml - deploy/publish

You can deploy and/or publish your app once a build completes.

  • heroku
  • git
  • ssh
  • bash
  • Swift
  • PyPi
  • S3
slide-15
SLIDE 15

Demo

  • 1. Install Drone: Install Docs

$ wget http://downloads.drone.io/latest/drone.deb $ sudo dpkg -i drone.deb

  • 2. Setup Github: Setup Docs
  • 3. Add a repository.
  • 4. Commit a .drone.yml file.
slide-16
SLIDE 16

Installing Drone

Make sure Docker and docker-py are installed.

wget http://downloads.drone.io/latest/drone.deb sudo dpkg -i drone.deb

Drone should now be listening on port 80. http://<your IP>/install

slide-17
SLIDE 17

Installing Drone

slide-18
SLIDE 18

Setup Github

https://github.com/settings/applications

slide-19
SLIDE 19

Setup Github

slide-20
SLIDE 20
slide-21
SLIDE 21
slide-22
SLIDE 22

Add Repository

slide-23
SLIDE 23

Add Repository

slide-24
SLIDE 24

Add Repository

slide-25
SLIDE 25

Add Repository

slide-26
SLIDE 26

Commit a .drone.yml File

image: linuturk/pelican script:

  • whoami
  • make -C $DRONE_BUILD_DIR html

publish: swift: username: {{rax_username}} password: {{rax_apikey}} auth_url: https://identity.api.rackspacecloud.com/v2.0 region: ORD container: www.onitato.com source: $DRONE_BUILD_DIR/output branch: master

slide-27
SLIDE 27

Watch Build

slide-28
SLIDE 28

Watch Build

slide-29
SLIDE 29
slide-30
SLIDE 30

Questions?

Justin Phelps @Linuturk