Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Continuous Integration: SaaS vs Jenkins in Cloud

11,365 views

Published on

Dopo la diffusione del Cloud Computing e di Docker, è ancora preferibile
adottare i classici SaaS di Continuous Integration rispetto ad un
sistema Jenkins in cloud?

L'intervento ha l’obiettivo di mostrare un caso d'uso applicato in
Ideato di migrazione da un SaaS quale Travis ad un sistema Jenkins in
cloud, sfruttando funzionalità di on demand tramite il cloud di Amazon
Web Services e di containerizzazione tramite Docker.

Tenendo in considerazione gli aspetti tecnici legati all’implementazione
e quelli che potrebbero impattare sul fronte economico come la mancanza
di automatizzazione e i tempi di setup, verranno mostrati pregi e
difetti di questo sistema e come può essere applicato ad una serie di
progetti. Infine verranno elencati una serie di prodotti recentemente
rilasciati e in grado di far evolvere ulteriormente l'attuale sistema.

Published in: Technology

Continuous Integration: SaaS vs Jenkins in Cloud

  1. 1. Continuous Integration SaaS vs Jenkins in cloud
  2. 2. GLUTEN FREE Alessandro Mazzoli alendmazz am@ideato.it Who am I? sysadmin@ideato AWS solution architect
  3. 3. Why I should prefer on premise Jenkins vs SaaS like Travis or CircleCI?
  4. 4. What is Jenkins?
  5. 5. Jenkins is a famous cross-platform, continuous integration and continuous delivery application
  6. 6. cross platform support SCM tools released under MIT license Java based (war file)
  7. 7. job execution monitoring reports, notifications rich of plugins(Docker, Github, Slack, Build Pipeline) hooks, triggers, conditionals
  8. 8. Let’s talk about $$$ 170 US$ 130 US$ Travis Startup AWS c4.xlarge costs estimated on demand c4.xlarge up for 24h/day
  9. 9. I have also to configure and maintain Jenkins…
  10. 10. switch on/off every day???!!
  11. 11. Waste Boring Stressful
  12. 12. AWS CLI + CRONJOBS
  13. 13. !/bin/bash EC2_ID=i-abcdefgh EIP=52.*.*.*. IAM=ideato_jenkins
 aws ec2 start-instances --instance-ids ${EC2_ID} profile ${IAM} aws ec2 associate-address --instance-id ${EC2_ID} --public-ip ${EIP} --profile ${IAM} 
 exit 0 jenkins_on.sh
  14. 14. !/bin/bash EC2_ID=i-abcdefgh IAM=ideato_jenkins
 aws ec2 stop-instances --instance-ids ${EC2_ID} —profile ${IAM} exit 0 jenkins_off.sh
  15. 15. Let’s talk again about $$$ 54 US$ 130 US$ Travis Startup AWS c4.xlarge costs estimated on demand c4.xlarge up for 8h/day
  16. 16. Save more money?
  17. 17. Put your Jenkins on Reserved Instances
  18. 18. Reserved Instances capacity reservation for one or three years inside an AZ help AWS on capacity planning hourly billing rate lower
  19. 19. Reserved Instances switch AZ within the same region Change the instance size within the same instance type not just EC2 billing mechanism
  20. 20. Reserved Instances reservation cannot be refundable applied to a single instance types restricted inside a region
  21. 21. Reserved Instances all upfront 3y save up 70% all upfront 1y save up 30%
  22. 22. Let’s talk again about $$$ 34 US$ 130 US$ Travis Startup AWS c4.xlarge costs estimated on reserved 1y upfront c4.xlarge up for 8h/day
  23. 23. Ok but….
  24. 24. different stacks?! • OS (Debian vs RedHat) • PHP(5.x), Java, Python • Elasticsearch(0.9->1.7) • Mongo • MySQL,PostgreSQL
  25. 25. On Travis I just have to edit
 .travis.yaml
  26. 26. ~= Python virtualenv
  27. 27. not suited for CI system one virtualenv active at once
  28. 28. Containers history 1979 - chroot unix syscall to change root directory of a process to a new location only visible by that process
  29. 29. Containers history 2007 - cgroups used for limiting, isolating and accounting defining CPU, RAM, I/O
  30. 30. Containers history 2008 - LXC first implementation of Linux containers with several features: cgroups, namespace, CAP, API bindings on Ruby,Python..
  31. 31. Containers history 2013 - Docker
  32. 32. it’s a container technology
  33. 33. was LXC
  34. 34. isolation
  35. 35. encapsulation
  36. 36. portability
  37. 37. was LXC now runc (Open Container Initiative)
  38. 38. difference between VM & Docker??
  39. 39. Containers vs VMs
  40. 40. AUFS Advanced Unification FileSystem Layered FS Copy on Write enable Docker Image layers
  41. 41. Docker Images read only layer used to be containers composed by layers
  42. 42. Our Docker Images
  43. 43. Our Docker Images FROM ubuntu:trusty RUN apt-get install -yq software-properties-common python-software-properties git vim wget curl
  44. 44. Our Docker Images
  45. 45. Our Docker Images FROM ideato/trusty ENV DEBIAN_FRONTEND noninteractive RUN add-apt-repository -y ppa:ondrej/php5 RUN apt-get install -yq --no-install-recommends php5 php5-cli php5-common php5-dev php5-gd php5-curl php5-mcrypt libapache2-mod-php5
  46. 46. Our Docker Images
  47. 47. Our Docker Images FROM ideato/trusty_php:5.5 RUN apt-get install -yq mysql-server-5.5 RUN wget https://phar.phpunit.de/ phpunit.phar RUN chmod +x phpunit.phar RUN mv phpunit.phar /usr/local/bin/phpunit
  48. 48. Workflow… projects should have their Dockerfile
  49. 49. Workflow.. these Dockerfiles should be built on top of CI Images
  50. 50. Our Docker Images
  51. 51. Example Project FROM ideato/trusty_php_CI:5.5 ENV DB default RUN apt-get install -yq npm openjdk-7-jre openjdk-7-jdk nodejs RUN wget https://download.elastic.co/elasticsearch/ elasticsearch/elasticsearch-1.7.3.deb RUN dpkg -i elasticsearch-1.7.3.deb ADD bin/run_tests / ENTRYPOINT [“./bin/run_tests”]
  52. 52. Example Project #!/bin/bash cd /exampleproj/workspace service mysql start service elasticsearch start bin/idx build
  53. 53. Our Jenkins web hook
  54. 54. Our Jenkins web hook docker build -q -t ideato:exampleproj -f Dockerfile .
  55. 55. Our Jenkins web hook docker build -q -t ideato:exampleproj - f Dockerfile . docker run --rm=true -v $WORKSPACE:/example_project -t ideato:exampleproj
  56. 56. Our Jenkins web hook docker build -q -t ideato:exampleproj - f Dockerfile . docker run --rm=true -v $WORKSPACE:/example_project -t ideato:exampleproj channel notification

  57. 57. Resuming…. 1 day for Jenkins setup ~ 280$ (one time cost) + AWS c4.xlarge 34$ x 12 ~ 600$ vs TravisCI Startup Plan 130€ x 12 = 1560$
  58. 58. oh wait… ~ 1/3 build time than Travis
  59. 59. in the next few months…
  60. 60. built in support for delivery pipelines
  61. 61. pipeline as code
  62. 62. Jenkinsfile!!!
  63. 63. better UX on pipeline
  64. 64. finally batteries included
  65. 65. fully backward compatible
  66. 66. try it ! docker pull jenkinsci/ jenkins:2.0-alpha-3
  67. 67. what else?
  68. 68. on dev we are using OSX + Vagrant + Ansible and no Docker atm
  69. 69. why?
  70. 70. Add more complexity to FE devs

  71. 71. customers won’t pay to migrate old projects
  72. 72. no native support until now…
  73. 73. https://blog.docker.com/2016/03/ docker-for-mac-windows-beta/
  74. 74. no more VirtualBox, native hypervisor support Mac -> xhyve Windows -> HyperV
  75. 75. on Mac, Docker Engine will run inside a Alpine Linux on top of xhyve
  76. 76. native Windows/Mac app
  77. 77. on OSX….
  78. 78. volume mounting for code/data with auto update on file changes (GIT, Sublime,PhpStorm)
  79. 79. tools integrated inside Docker Toolbox Docker Engine, Docker Compose, Kitematic
  80. 80. Links JenkinsCI Jenkins 2.0 AWS Reserved Instances Docker Docker on OSX & Windows
  81. 81. Thanks!
  82. 82. Questions ??

×