SlideShare une entreprise Scribd logo
1  sur  39
Télécharger pour lire hors ligne
CI/CD with Jenkins
and Docker
Hello!
Teerapat Khunpech
@engineerball
https://github.com/engineerball
https://engineerball.com
2
DevOps keys
http://web.premsco.com/wp-content/uploads/2014/09/Premsco-industrial-automation.jpg
What is Continuous integration
▷ A development methodology
▷ Verified by builds
○ Unit test
○ Functional test
○ Integration test
▷ Every commit trigger a build
What is Continuous delivery
▷ Continuous delivery/deployment
▷ Every commit that passed a build
could be deploy to production
▷ Automation deploy
What is Jenkins?
▷ CI/CD application
▷ Easy installation
▷ Rich plugin
▷ Distributed build
Jenkins Workflow
What is Docker?
Open Source
engine for
containers
Build, ship, run
your application
within
containers
Docker enables
separation of
concerns
How can you use Jenkins & Docker
together?
Run Jenkins Master & Slave in Docker Build, Test & Deploy Docker Image from Jenkins
Example
CI/CD with Docker
CI/CD Workflow
Tools
▷ SCM: Github
▷ CI/CD: Jenkins 2.0
▷ Platform: docker
▷ Container Orchestration: docker swarm
▷ Service Discovery Tool: Consul
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Setup
Node0 set up
▷ Start the Consul container
$ docker run -d -p 8500:8500 -h consul --name consul progrium/consul
-server -bootstrap
Unable to find image 'progrium/consul:latest' locally
latest: Pulling from progrium/consul
3b4d28ce80e4: Pull complete
e5ab901dcf2d: Pull complete
<snip>
Node1-3 set up
▷ Edit DOCKER_OPTS daemon
(/etc/default/docker)
DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
--cluster-store=consul://10.128.0.2:8500/network --cluster-advertise=ens4:2375"
Install Docker Swarm Cluster
▷ Node0: Create Swarm Master
# Create Swarm Master
$ export TOKEN=$(docker run --rm swarm create)
$ docker run -d -p 3375:2375 swarm manage token://$TOKEN
# Join Swarm Node
$ docker run -d swarm join --addr=10.128.0.3:2375 token://$TOKEN
$ docker run -d swarm join --addr=10.128.0.4:2375 token://$TOKEN
$ docker run -d swarm join --addr=10.128.0.5:2375 token://$TOKEN
Jenkins Setup
▷ Build Docker image inside a docker
container
▷ SSH Node with access to docker
engine
Jenkins Setup
▷ Node0: Install Jenkins Master
$ docker -H unix:///var/run/docker.sock run -d -p 8080:8080 jenkins
Jenkins Setup
▷ Node0: Configure Jenkins Master
○ Configure Global Security
○ Install plugins
■ Github plugin
■ CloudBees Docker Build and Publish
○ Create Jenkins Slave node (node1)
Example Voting App
▷ A Python webapp which lets you vote between two options
▷ A Redis queue which collects new votes
▷ A Java worker which consumes votes and stores them in…
▷ A Postgres database backed by a Docker volume
▷ A Node.js webapp which shows the results of the voting in real time
Voting App
Dockerfile
# Using official python runtime base image
FROM python:2.7
# Set the application directory
WORKDIR /app
# Install our requirements.txt
ADD requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
# Copy our code from the current folder to /app inside the container
ADD . /app
# Make port 5000 available for links and/or publish
EXPOSE 80
# Define our command to be run when launching the container
CMD ["python", "app.py"]
Result App
Dockerfile
FROM node:0.10
RUN mkdir /app
WORKDIR /app
ADD package.json /app/package.json
RUN npm install && npm ls
RUN mv /app/node_modules /node_modules
ADD . /app
ENV PORT 80
EXPOSE 80
CMD ["node", "server.js"]
Worker
Dockerfile
FROM java:7
RUN apt-get update -qq && apt-get install -y maven && apt-get clean
WORKDIR /code
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]
# Adding source, compile and package into a fat jar
ADD src /code/src
RUN ["mvn", "package"]
CMD ["/usr/lib/jvm/java-7-openjdk-amd64/bin/java", "-jar", "target/worker-jar-with-dependencies.jar"]
Github Webhook Setup
▷ Automatically build job when
pushes are made to Github
The Build Jobs
▷ Create 3 Jenkins jobs
○ build-voting-app
○ build-worker
○ build-result-app
The Build Jobs
The Build Jobs
The Build Jobs
The Deploy Job
▷ Create a Jenkins jobs
○ Build section, Execute shell
export DOCKER_HOST=10.128.0.4:2375
export DTR="https://registry.hub.docker.com/u"
docker-compose -f vote-apps/docker-compose.yml stop voting-app result-app worker
docker-compose -f vote-apps/docker-compose.yml rm -f
docker-compose -f vote-apps/docker-compose.yml pull voting-app result-app worker
docker-compose -f vote-apps/docker-compose.yml up -d
The Deploy Job
docker-compose.yml
version: "2"
services:
voting-app:
build: ./voting-app/.
networks:
- front-tier
- back-tier
result-app:
build: ./result-app/.
networks:
- front-tier
- back-tier
worker:
image: manomarks/worker
networks:
- back-tier
redis:
image: redis:alpine
container_name: redis
networks:
- back-tier
db:
image: postgres:9.4
container_name: db
volumes:
- "db-data:/var/lib/postgresql/data"
networks:
- back-tier
volumes:
db-data:
networks:
front-tier:
back-tier:
Deploying The App
▷ Clone SCM, edit README.md and
push to SCM
Deploying The App
root@node2:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
0100cf6b0c14 engineerball/result-app:47d362f35a115f2098c80a11e161eef626e1dbcb "node server.js" 2 hours ago
Up 2 hours 0.0.0.0:5001->80/tcp voteapps_result-app_1
296eee196e4e engineerball/voting-app:47d362f35a115f2098c80a11e161eef626e1dbcb "python app.py" 2 hours ago
Up 2 hours 0.0.0.0:5000->80/tcp voteapps_voting-app_1
40f8d8aec4ca engineerball/worker:47d362f35a115f2098c80a11e161eef626e1dbcb "/usr/lib/jvm/java-7-" 2 hours ago
Up 2 hours voteapps_worker_1
44da08df3d5c postgres:9.4 "/docker-entrypoint.s" 2 hours ago
Up 2 hours 5432/tcp voteapps_db_1
fa10362631cb redis "docker-entrypoint.sh" 2 hours ago
Up 2 hours 6379/tcp voteapps_redis_1
The Voting App
The Voting Result
DEMO
In Conclusion
In Conclusion
▷ Automate is the key
▷ Docker simplifies environment problems
▷ Jenkins is ready for Docker and CD
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand

Contenu connexe

Tendances

Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins IntroductionPavan Gupta
 
CI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and TutumCI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and TutumSreenivas Makam
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with JenkinsEdureka!
 
Transforming Organizations with CI/CD
Transforming Organizations with CI/CDTransforming Organizations with CI/CD
Transforming Organizations with CI/CDCprime
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for TestingMukta Aphale
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...Edureka!
 
Jenkins tutorial for beginners
Jenkins tutorial for beginnersJenkins tutorial for beginners
Jenkins tutorial for beginnersBugRaptors
 
Yale Jenkins Show and Tell
Yale Jenkins Show and TellYale Jenkins Show and Tell
Yale Jenkins Show and TellE. Camden Fisher
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Simplilearn
 

Tendances (20)

Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins Introduction
 
CI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and TutumCI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and Tutum
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with Jenkins
 
Transforming Organizations with CI/CD
Transforming Organizations with CI/CDTransforming Organizations with CI/CD
Transforming Organizations with CI/CD
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
 
Jenkins tutorial for beginners
Jenkins tutorial for beginnersJenkins tutorial for beginners
Jenkins tutorial for beginners
 
Jenkins Tutorial.pdf
Jenkins Tutorial.pdfJenkins Tutorial.pdf
Jenkins Tutorial.pdf
 
Yale Jenkins Show and Tell
Yale Jenkins Show and TellYale Jenkins Show and Tell
Yale Jenkins Show and Tell
 
Jenkins Automation
Jenkins AutomationJenkins Automation
Jenkins Automation
 
Jenkins-CI
Jenkins-CIJenkins-CI
Jenkins-CI
 
Dev ops using Jenkins
Dev ops using JenkinsDev ops using Jenkins
Dev ops using Jenkins
 
Jenkins
JenkinsJenkins
Jenkins
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
 

En vedette

AWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipelineAWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipelineJulien SIMON
 
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...Jeremy Brown
 
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...India Scrum Enthusiasts Community
 
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksCampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksSanjeev Sharma
 
Jenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous ImprovementJenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous ImprovementUdaypal Aarkoti
 
Continuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsContinuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsFrancesco Bruni
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Docker, Inc.
 
DevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerDevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerSonatype
 

En vedette (8)

AWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipelineAWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipeline
 
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...
Agile, DevOps, Continuous Delivery and Lean - How do you tie it all together ...
 
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...
Agile Tour Pune 2015: Agility with Microservices and Devops: Archana Joshi an...
 
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksCampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
 
Jenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous ImprovementJenkins + Docker = Continuous Improvement
Jenkins + Docker = Continuous Improvement
 
Continuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsContinuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and Jenkins
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
 
DevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerDevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for Docker
 

Similaire à CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand

DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDocker, Inc.
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline Docker, Inc.
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with DockerAnton Egorov
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...Puppet
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containersinside-BigData.com
 
Docker engine - Indroduc
Docker engine - IndroducDocker engine - Indroduc
Docker engine - IndroducAl Gifari
 
Docker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualizationDocker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualizationSuresh Balla
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...Ambassador Labs
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzSteve Hoffman
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2Vincent Mercier
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안양재동 코드랩
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
Making your app soar without a container manifest
Making your app soar without a container manifestMaking your app soar without a container manifest
Making your app soar without a container manifestLibbySchulze
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 

Similaire à CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand (20)

DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with Docker
 
Docking with Docker
Docking with DockerDocking with Docker
Docking with Docker
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
Docker engine - Indroduc
Docker engine - IndroducDocker engine - Indroduc
Docker engine - Indroduc
 
Docker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualizationDocker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualization
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Making your app soar without a container manifest
Making your app soar without a container manifestMaking your app soar without a container manifest
Making your app soar without a container manifest
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 

Dernier

Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLAlluxio, Inc.
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsJaydeep Chhasatia
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageDista
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionsNirav Modi
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native BuildpacksVish Abrams
 
Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntelliSource Technologies
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadIvo Andreev
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmonyelliciumsolutionspun
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...OnePlan Solutions
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024Mind IT Systems
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfTobias Schneck
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.Sharon Liu
 

Dernier (20)

Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in Trivandrum
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspections
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native Buildpacks
 
Introduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptxIntroduction-to-Software-Development-Outsourcing.pptx
Introduction-to-Software-Development-Outsourcing.pptx
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and Bad
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
 

CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand

  • 4. What is Continuous integration ▷ A development methodology ▷ Verified by builds ○ Unit test ○ Functional test ○ Integration test ▷ Every commit trigger a build
  • 5. What is Continuous delivery ▷ Continuous delivery/deployment ▷ Every commit that passed a build could be deploy to production ▷ Automation deploy
  • 6. What is Jenkins? ▷ CI/CD application ▷ Easy installation ▷ Rich plugin ▷ Distributed build
  • 8. What is Docker? Open Source engine for containers Build, ship, run your application within containers Docker enables separation of concerns
  • 9. How can you use Jenkins & Docker together? Run Jenkins Master & Slave in Docker Build, Test & Deploy Docker Image from Jenkins
  • 12. Tools ▷ SCM: Github ▷ CI/CD: Jenkins 2.0 ▷ Platform: docker ▷ Container Orchestration: docker swarm ▷ Service Discovery Tool: Consul
  • 14. Setup
  • 15. Node0 set up ▷ Start the Consul container $ docker run -d -p 8500:8500 -h consul --name consul progrium/consul -server -bootstrap Unable to find image 'progrium/consul:latest' locally latest: Pulling from progrium/consul 3b4d28ce80e4: Pull complete e5ab901dcf2d: Pull complete <snip>
  • 16. Node1-3 set up ▷ Edit DOCKER_OPTS daemon (/etc/default/docker) DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-store=consul://10.128.0.2:8500/network --cluster-advertise=ens4:2375"
  • 17. Install Docker Swarm Cluster ▷ Node0: Create Swarm Master # Create Swarm Master $ export TOKEN=$(docker run --rm swarm create) $ docker run -d -p 3375:2375 swarm manage token://$TOKEN # Join Swarm Node $ docker run -d swarm join --addr=10.128.0.3:2375 token://$TOKEN $ docker run -d swarm join --addr=10.128.0.4:2375 token://$TOKEN $ docker run -d swarm join --addr=10.128.0.5:2375 token://$TOKEN
  • 18. Jenkins Setup ▷ Build Docker image inside a docker container ▷ SSH Node with access to docker engine
  • 19. Jenkins Setup ▷ Node0: Install Jenkins Master $ docker -H unix:///var/run/docker.sock run -d -p 8080:8080 jenkins
  • 20. Jenkins Setup ▷ Node0: Configure Jenkins Master ○ Configure Global Security ○ Install plugins ■ Github plugin ■ CloudBees Docker Build and Publish ○ Create Jenkins Slave node (node1)
  • 21. Example Voting App ▷ A Python webapp which lets you vote between two options ▷ A Redis queue which collects new votes ▷ A Java worker which consumes votes and stores them in… ▷ A Postgres database backed by a Docker volume ▷ A Node.js webapp which shows the results of the voting in real time
  • 22. Voting App Dockerfile # Using official python runtime base image FROM python:2.7 # Set the application directory WORKDIR /app # Install our requirements.txt ADD requirements.txt /app/requirements.txt RUN pip install -r requirements.txt # Copy our code from the current folder to /app inside the container ADD . /app # Make port 5000 available for links and/or publish EXPOSE 80 # Define our command to be run when launching the container CMD ["python", "app.py"]
  • 23. Result App Dockerfile FROM node:0.10 RUN mkdir /app WORKDIR /app ADD package.json /app/package.json RUN npm install && npm ls RUN mv /app/node_modules /node_modules ADD . /app ENV PORT 80 EXPOSE 80 CMD ["node", "server.js"]
  • 24. Worker Dockerfile FROM java:7 RUN apt-get update -qq && apt-get install -y maven && apt-get clean WORKDIR /code ADD pom.xml /code/pom.xml RUN ["mvn", "dependency:resolve"] RUN ["mvn", "verify"] # Adding source, compile and package into a fat jar ADD src /code/src RUN ["mvn", "package"] CMD ["/usr/lib/jvm/java-7-openjdk-amd64/bin/java", "-jar", "target/worker-jar-with-dependencies.jar"]
  • 25. Github Webhook Setup ▷ Automatically build job when pushes are made to Github
  • 26. The Build Jobs ▷ Create 3 Jenkins jobs ○ build-voting-app ○ build-worker ○ build-result-app
  • 30. The Deploy Job ▷ Create a Jenkins jobs ○ Build section, Execute shell export DOCKER_HOST=10.128.0.4:2375 export DTR="https://registry.hub.docker.com/u" docker-compose -f vote-apps/docker-compose.yml stop voting-app result-app worker docker-compose -f vote-apps/docker-compose.yml rm -f docker-compose -f vote-apps/docker-compose.yml pull voting-app result-app worker docker-compose -f vote-apps/docker-compose.yml up -d
  • 31. The Deploy Job docker-compose.yml version: "2" services: voting-app: build: ./voting-app/. networks: - front-tier - back-tier result-app: build: ./result-app/. networks: - front-tier - back-tier worker: image: manomarks/worker networks: - back-tier redis: image: redis:alpine container_name: redis networks: - back-tier db: image: postgres:9.4 container_name: db volumes: - "db-data:/var/lib/postgresql/data" networks: - back-tier volumes: db-data: networks: front-tier: back-tier:
  • 32. Deploying The App ▷ Clone SCM, edit README.md and push to SCM
  • 33. Deploying The App root@node2:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0100cf6b0c14 engineerball/result-app:47d362f35a115f2098c80a11e161eef626e1dbcb "node server.js" 2 hours ago Up 2 hours 0.0.0.0:5001->80/tcp voteapps_result-app_1 296eee196e4e engineerball/voting-app:47d362f35a115f2098c80a11e161eef626e1dbcb "python app.py" 2 hours ago Up 2 hours 0.0.0.0:5000->80/tcp voteapps_voting-app_1 40f8d8aec4ca engineerball/worker:47d362f35a115f2098c80a11e161eef626e1dbcb "/usr/lib/jvm/java-7-" 2 hours ago Up 2 hours voteapps_worker_1 44da08df3d5c postgres:9.4 "/docker-entrypoint.s" 2 hours ago Up 2 hours 5432/tcp voteapps_db_1 fa10362631cb redis "docker-entrypoint.sh" 2 hours ago Up 2 hours 6379/tcp voteapps_redis_1
  • 36. DEMO
  • 38. In Conclusion ▷ Automate is the key ▷ Docker simplifies environment problems ▷ Jenkins is ready for Docker and CD