Slide 1

Slide 1 text

CI and CD Nette Camp 27.8.2016

Slide 2

Slide 2 text

Key concepts 4 Continuous Delivery (CD) 4 Continuous Integration (CI) 4 Continuous Deployment

Slide 3

Slide 3 text

Continuous Integration

Slide 4

Slide 4 text

Continuous Integration (CI) 4 is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

Slide 5

Slide 5 text

Continuous Delivery

Slide 6

Slide 6 text

Continuous Delivery 4 is a software development discipline where you build software in such a way that the software can be released to production at any time.

Slide 7

Slide 7 text

Continuous Deployment

Slide 8

Slide 8 text

Continuous Deployment 4 means that every change goes through the pipeline and automatically gets put into production, resulting in many production deployments every day.

Slide 9

Slide 9 text

How we do Continuous Delivery in Apiary

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Continuous Integration Engines

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Key features from CIE 4 job definitions in repository 4 autoscaling on traffic with lowest possible price 4 pipelines 4 caching for installations (apt, npm, gem, composer, docker) 4 docker support (registry, caching layers) 4 matrix builds (OSS)

Slide 16

Slide 16 text

Job definitions in repository

Slide 17

Slide 17 text

sudo: "required" dist: "trusty" language: "node_js" node_js: - "0.10" - "0.12" - "4" - "6" env: global: # GH_TOKEN and NPM_TOKEN encrypted by 'travis encrypt' utility - secure: "<<>>" cache: directories: - "node_modules" before_install: - "npm -g install npm@latest" - "gem install travis" - "curl -Lo travis_after_all.py https://raw.githubusercontent.com/dmakhno/travis_after_all/master/travis_after_all.py" before_script: - "npm run lint" script: - "npm test" - "npm run test:hooks-handlers" after_success: # travis_after_all.py is needed due to travis-ci/travis-ci#1548 & travis-ci/travis-ci#929 - "npm run coveralls" - "python travis_after_all.py" - "export $(cat .to_export_back)" - "npm run semantic-release || true"

Slide 18

Slide 18 text

node('node') { currentBuild.result = "SUCCESS" try { stage 'Checkout' checkout scm stage 'Test' env.NODE_ENV = "test" print "Environment will be : ${env.NODE_ENV}" sh 'node -v' sh 'npm prune' sh 'npm install' sh 'npm test' stage 'Build Docker' sh './dockerBuild.sh' stage 'Deploy' echo 'Push to Repo' sh './dockerPushToRepo.sh' echo 'ssh to web server and tell it to pull new image' sh 'ssh [email protected] running/xxxxxxx/dockerRun.sh' stage 'Cleanup' echo 'prune and cleanup' sh 'npm prune' sh 'rm node_modules -rf' mail body: 'project build successful', from: '[email protected]', replyTo: '[email protected]', subject: 'project build successful', to: '[email protected]' } catch (err) { currentBuild.result = "FAILURE" mail body: "project build error: ${err}" , from: '[email protected]', replyTo: '[email protected]', subject: 'project build failed', to: '[email protected]' throw err } }

Slide 19

Slide 19 text

Autoscaling

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Pipelines

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Caching

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Docker support

Slide 26

Slide 26 text

machine: services: - docker dependencies: override: - docker info - docker build -t circleci/elasticsearch . test: override: - docker run -d -p 9200:9200 circleci/elasticsearch; sleep 10 - curl --retry 10 --retry-delay 5 -v http://localhost:9200 deployment: hub: branch: master commands: - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - docker push circleci/elasticsearch

Slide 27

Slide 27 text

Matrix builds

Slide 28

Slide 28 text

matrix: GO_VERSION: - 1.4 - 1.3 REDIS_VERSION: - 2.6 - 2.8 - 3.0

Slide 29

Slide 29 text

Distributed job across multiple nodes

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Q & A Ladislav Prskavec [email protected] @abtris