Anzeige
Anzeige

Más contenido relacionado

Presentaciones para ti(20)

Similar a Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker and Kubernetes(20)

Anzeige

Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker and Kubernetes

  1. Continuous Integration and Delivery: from Zero to Hero with TeamCity, Docker and Kubernetes
  2. Dev Marche
  3. Outline Agenda 1. Who we are 2. Introduction 3. Level Zero: Everything Manual 4. Level Intermediate: introducing a CI Tool 5. Level Hero: Docker + Kubernetes
  4. L’azienda Dati Generali Azienda • Sede centrale a Basilea, Svizzera • Development center ad Ancona • Circa 20 professionisti motivati (Int&Est) • Oracle Partner per Agile PLM
  5. Il Team Lean IT: Team ✓ Team 20 Persone (Int & Est) ✓ > 75 % Assunti a tempo Indeterminato ✓ > 90 % Laureati in Informatica o Ingegneria Informatica ✓ > 80% Laureati Specialistici ✓ Turnover delle risorse < 7% ultimi 3 anni ✓ >70% del Team ha tra 5 - 10 Anni o oltre i 10 Anni di esperienza di Sviluppo Software ✓ Di questi il 60% ha più di 10 anni di esperienza di Sviluppo Software <2 Anni 2<>5 Anni 5<>10 Anni >10 Team: Anni Esperienza Sviluppo Software <2 Anni 2<>5 Anni 5<>10 Anni >10
  6. I Nostri Servizi Lean IT: I Nostri Servizi • IT Consulting • System integration • Sviluppo Software • PLM Consulting • Implementazione e Configurazione • System integration • Helpdesk e supporto • Sviluppo moduli Custom • Consulenza per i processi di Business
  7. PLM Application For Product Lifecycle Management
  8. Tecnologie
  9. Metodologie Metodologie Waterfall vs Agile
  10. Metodologie Scrum Framework ✓ Lean IT: ✓ Sprint Weeks: 2 ✓ Every 2 Weeks: Grooming (normally) on Friday ✓ Every 2 Weeks: Planning (normally) on Monday ✓ Retrospective: Once Months
  11. La Nostra Sede
  12. Opportunità ✓ Talenti Mandateci un CV a: recruiting@leanitconsulting.it Esempio al desk all’ingresso ✓ Partner Commerciali / Strategici Contattatemi a: grizzo@leanitconsulting.it
  13. Grazie ITALY Lean IT Consulting IT Giulio Rizzo grizzo@leanitconsulting.it Via I Maggio 25/b – 60131 Ancona +39 071 9256426 +39 328 8141675 BUON TECH BAR ☺
  14. Disclaimer We are NOT • DevOps/CI/CD GURUs • Affiliated with any of the brands we cite Feel free to interrupt us in case you feel we are saying something really wrong Today we present our journey in the CI/CD world
  15. Introduction Setting the Stage • We have a quite long journey to share • We outlined a path to guide us through • Questions are welcome but please do not focus too much in low-level details... • … we don't want to leave at dawn! • Help us to adjust our presentation: how much of a DevOps expert are you?
  16. Continuous Integration Continuous Integration is a software development practice where members of a team integrate their work frequently ... leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Introduction Martin Fowler https://martinfowler.com/articles/continuousIntegration.html
  17. Continuous Delivery Continuous Delivery is the ability to get changes of all types ... into production ... safely and quickly in a sustainable way. We achieve all this by ensuring our code is always in a deployable state … completely eliminate the integration, testing phases that traditionally followed “dev complete”, as well as code freezes. Introduction Jez Humble https://continuousdelivery.com/
  18. Introduction Demo Scenario receiversender orders_queue
  19. Talk is cheap Show me the code
  20. Level Zero How we Deliver Our Application in PROD? How would you do it?
  21. Level Zero Everything manual! • Testing • Building and packaging • Deployment We all started from here With a bit of attention it works… • … until the number of projects is really small
  22. Level Zero Manual Build $ mvn clean package -U sender.war receiver.war JAR WAR WAR demo-utility-lib.jar
  23. Level Zero Manual Deploy RDP SERVER sender.war receiver.warDeveloper WAR WAR
  24. Level Zero Deployment Pipeline sender.war (v4) receiver.war (v4) sender.war (v3) receiver.war (v3) sender.war (v2) receiver.war (v2) sender.war (v1) receiver.war (v1) LOCAL DEV TEST PROD sender.war (v2) receiver.war (v2) sender.war (v3) receiver.war (v3) sender.war (v4) receiver.war (v4) • Manual deploy of artifacts thought the pipeline • Internal rules to ensure that each environment receives the artifact of the previous one • Conventions on where to store artifacts
  25. Level Zero Application Demo
  26. Zero Level: Considerations Boring … repetitive … dummy ... work • No added value after the first time you do it! • What if you have DEV/TEST/STAGING/PROD envs? Highly subject to human error No versioning of deploy history • What I deployed in DEV? What in TEST? • How to ensure that what has been tested in TEST goes in PROD? Level Zero
  27. Level Intermediate
  28. Introducing a Continuous Integration Tool There are as many CI tools as the stars: Jenkins, TeamCity, Travis CI, Go CD, Bamboo, GitLab CI, CircleCI, Codeship... We are currently – and happily – using Teamcity Objective: automatize the development pipeline Intermediate
  29. TeamCity • Developed by JetBrains • Full support for Java and .NET • Professional license free with some limitation • 100 builds max • 3 build agents Intermediate
  30. Intermediate Continuous Integration with TeamCity
  31. Intermediate TeamCity Concepts Project Sub-project Build Build
  32. Intermediate TeamCity Build Dependencies
  33. Intermediate Deployment Pipeline with TeamCity sender.war (v4) receiver.war (v4) sender.war (v3) receiver.war (v3) sender.war (v2) receiver.war (v2) sender.war (v1) receiver.war (v1) LOCAL DEV TEST PROD sender.war (v2) receiver.war (v2) sender.war (v3) receiver.war (v3) sender.war (v4) receiver.war (v4) • TC deploys artifacts thought the pipeline • TC build dependencies to implement the pipeline you need • TC will store artifacts for you
  34. Intermediate Intermediate Level: Pro and Cons • Good level of automation • Faster coding and quick feedbacks on breaking changes • Config of app environments is manual • Installation on a new server is manual • No isolation of micro-services
  35. Next Level: Hero • Docker – Container Platform • Kubernetes – Orchestrator • Google Cloud Platform – Cloud Provider
  36. Level Hero What is Docker? Container • Share the same kernel, isolation is done in user space • Lower resource usage • Fast start time Virtual Machine • Each VM runs a full copy of the operating system • High resource usage • Slow start time
  37. Hero What is Docker? • Containers are built from layers • Images can be pushed and pulled to/from a shared repository (public or private) • A standardized unit of software
  38. Hero Why Docker? • High isolation level (better security) • Reduce friction between developers and operations • Runs everywhere and reduce the risk of "works on my PC" • Fast to stop and start • Containers are easy to scale, deploy and upgrade • Leader in container industry
  39. Hero Dockerfile $ docker build –t leanitrepo/ci-demo-receiver:latest . FROM openjdk:8-jdk-alpine COPY ./target/ci-demo-receiver.jar /usr/src/ci-demo-receiver.jar WORKDIR /usr/src/ EXPOSE 8091 CMD ["java", "-jar", "ci-demo-receiver.jar"]
  40. Can be easily integrated in Teamcity Commands can be added as build steps Hero
  41. Containers grows rapidly How can we manage an infrastructure that scales? Hero
  42. Kubernetes • An open source container orchestrator • Based on Borg, a project run by Google Hero
  43. Kubernetes • Automates deployment and scaling • Manage failures • Binpacking based on resource requirements • Run on-premise or on the cloud Hero
  44. Kubernetes Concepts Nodes • A physical or virtual machine • Manage workloads of containers • Master: coordinates the activity of the cluster Hero
  45. Kubernetes Concepts Management • Master node exposes an API • kubectl: command line tool • Many dashboards are available • Can be easily integrated in Team City Hero kubectl
  46. Hero Scenario receiversender orders_queue
  47. Hero Scenario orders_queuesender receiver
  48. Hero Scenario
  49. Hero Google Cloud Platform • Easy to setup and manage • Resources can be allocated dinamically • Can be managed with CLI for task automation $ gcloud container clusters resize kube-demo --size=3
  50. Hero Google Cloud Console
  51. Hero Google Cloud Console
  52. Hero Deploy to Kubernetes with Team City
  53. Hero Scaling Pods $ kubectl scale deployment receiver-deployment --replicas=5
  54. Hero Deploy Updated Version $ kubectl set image deployment/receiver-deployment receiver=leanitrepo/ci-demo-receiver:100msec
  55. Hero Downscaling Pods $ kubectl scale deployment receiver-deployment --replicas=3 docker@docker:~/dev-marche-demo$ kubectl describe deployment receiver-deployment Name: receiver-deployment Namespace: default CreationTimestamp: Fri, 16 Nov 2018 09:59:32 +0100 Labels: app=dev-marche-demo component=receiver Annotations: deployment.kubernetes.io/revision=2 Selector: component=receiver Replicas: 5 desired | 5 updated | 5 total | 5 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge
  56. Hero Monitoring logs with kubectl or Stackdriver docker@docker:~/dev-marche-demo$ kubectl logs receiver-deployment-784c5df8cf-l675g --tail=10 2018-11-16 11:35:33,662 [http-nio-8091-exec-7] INFO com.leanit.ci.demo.cidemoreceiver.controllers.StatusController - /status/check endpoint called 2018-11-16 11:35:34,561 [pool-2-thread-3] INFO com.leanit.ci.demo.cidemoreceiver.config.OrdersReceiver - Consumed Order d80fc7a2-2871-4166- a59e-b82fbdc280e6 created at 2018-11-16T11:35:24.263Z[GMT] 2018-11-16 11:35:35,563 [pool-2-thread-4] INFO com.leanit.ci.demo.cidemoreceiver.config.OrdersReceiver - Consumed Order e4866ef8-85ff-4e72- 9866-d2ed6cedfb24 created at 2018-11-16T11:35:25.021Z[GMT] 2018-11-16 11:35:36,566 [pool-2-thread-3] INFO com.leanit.ci.demo.cidemoreceiver.config.OrdersReceiver - Consumed Order 9ed744f2-3034-45e6- a5e5-01805d2ec3c5 created at 2018-11-16T11:35:25.869Z[GMT] 2018-11-16 11:35:37,568 [pool-2-thread-4] INFO com.leanit.ci.demo.cidemoreceiver.config.OrdersReceiver - Consumed Order 1a0d599f-e243-43c9- 9a4e-8e33db2d386c created at 2018-11-16T11:35:26.505Z[GMT]
  57. References • https://bitbucket.org/account/user/leanitdevs/projects/ZTH • www.jetbrains.com/teamcity • https://www.docker.com/ • https://kubernetes.io/ • Continuous Delivery - Jez Humble and David Farley • Continuous Integration – Paul Duval, Stephen M. Matyas and Andrew Glover
  58. Questions 1. Hero Level
  59. Kubernetes Concepts Pods • A set of containers • Has a unique cluster IP address • Volumes can be attached • Can be scaled Hero
  60. Kubernetes Concepts Deployments • Describe how pods can be scaled • Different strategies can be configured: Recreate, RollingUpd ate, Canary Hero
  61. Kubernetes Concepts Services • Exposes a tcp port inside or outside the cluster • Balances the load of multiple pods • Matches multiple pods with label selectors Hero
  62. Kubernetes Concepts Scaling Hero
Anzeige