SlideShare une entreprise Scribd logo
1  sur  38
Get start with Docker &
DevOps
Sr.Analyst Oksana Dudnik
Let’s start with Docker ToolBox
• At first we must install Docker ToolBox on local computer:
• Go to the Docker Toolbox page.
• https://www.docker.com/products/docker-toolbox
• Download and install (close all another programs).
Let’s create docker-machine
• In FAR or in Git CMD(run as administrator) :
• >docker-machine create –driver virtualbox –virtualbox-memory 4096 default
• If there now errors:
• >docker-machine create –driver virtualbox –virtualbox-memory 4096 adop
• >docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
adop * virtualbox Running tcp://192.168.99.101:2376 v1.10.3
default - virtualbox Running tcp://192.168.99.100:2376 v1.10.3
CREATE environment variables
• >SETX DOCKER_MACHINE_NAME “adop”
• >SETX DOCKER_HOST “tcp://192.168.99.101:2376”
• >SETX DOCKER_CERT_PATH
“C:Usersoksana.dudnik.dockermachinemachinesadop”
• >SETX DOCKER_TLS_VERYFY “1”
• setx LDAP_PWD "Jpk66g63ZifGYIcShSGM“
• setx LDAP_DOMAIN "ldap.example.com“
• setx LDAP_FULL_DOMAIN "dc=ldap,dc=example,dc=com“
• setx GERRIT_MYSQL_USER "gerrit“
• setx GERRIT_MYSQL_PASSWORD "gerrit“
• setx GERRIT_MYSQL_DATABASE "gerrit“
• setx GERRIT_USER_NAME "Gerrit Code Review"
• setx GERRIT_USER_EMAIL "gerrit@adop“
• setx SONAR_MYSQL_USER "sonar“
• setx SONAR_MYSQL_PASSWORD "sonar“
• setx SONAR_MYSQL_DATABASE "sonar“
• setx SONAR_ACCOUNT_LOGIN "jenkins“
• setx SONAR_ACCOUNT_PASSWORD "jenkins“
• setx SONAR_DB_LOGIN "%SONAR_MYSQL_USER%“
• setx SONAR_DB_PASSWORD "%SONAR_MYSQL_PASSWORD%“
• setx DOCKER_CLIENT_CERT_PATH “//root/.docker/”
Received environment variables
• CERT_PATH=$0 //root/.docker/
• CLIENT_SUBJ=/CN=client
• CUSTOM_NETWORK_NAME=adopnetwork
• DOCKER_CERT_PATH=C:Usersoksana.dudnik.dockermachinemachinesadop
• DOCKER_CLIENT_CERT_PATH=//root/.docker/
• DOCKER_HOST=tcp://192.168.99.101:2376
• DOCKER_MACHINE_NAME=adop
• DOCKER_TLS_VERIFY=1
• DOCKER_TOOLBOX_INSTALL_PATH=C:Program FilesDocker Toolbox
Envorment variables
• GERRIT_MYSQL_DATABASE=gerrit
• GERRIT_MYSQL_PASSWORD=gerrit
• GERRIT_MYSQL_USER=gerrit
• GERRIT_USER_EMAIL=gerrit@adop
• GERRIT_USER_NAME=Gerrit Code Review
• HOME=/root
• HOMEDRIVE=C:
• HOMEPATH=Usersoksana.dudnik
• HOST=192.168.99.100
• LDAP_DOMAIN=ldap.example.com
• LDAP_FULL_DOMAIN=dc=ldap,dc=example,dc=com
• LDAP_PWD=Jpk66g63ZifGYIcShSGM
Envorment variables
• LOGSTASH_HOST=192.168.99.101
• MACHINE_NAME=adop
• SONAR_ACCOUNT_LOGIN=jenkins
• SONAR_ACCOUNT_PASSWORD=jenkins
• SONAR_DB_LOGIN=sonar
• SONAR_DB_PASSWORD=sonar
• SONAR_MYSQL_DATABASE=sonar
• SONAR_MYSQL_PASSWORD=sonar
• SONAR_MYSQL_USER=sonar
• USER_HOME=C:Usersoksana.dudnik
CREATE network
• setx TARGET_HOST "192.168.99.101“
• setx LOGSTASH_HOST “%TARGET_HOST%"
• docker network create %CUSTOM_NETWORK_NAME%
Start docker-compose
• docker-compose -f compose/elk.yml pull
• docker-compose -f docker-compose.yml -f
etc/volumes/local/default.yml -f etc/logging/syslog/default.yml pull
• docker-compose pull
• docker-compose -f compose/elk.yml up -d
• docker-compose -f docker-compose.yml -f
etc/volumes/local/default.yml -f etc/logging/syslog/default.yml up -d
Run docker container jenkins
• >docker exec jenkins curl -I -s
jenkins:jenkins@localhost:8080/jenkins/
• >docker exec jenkins curl -X POST
jenkins:jenkins@localhost:8080/jenkins/job/Load_Platform/build
WithParameters --data token=gAsuE35s
GENERATE ssl certificates
• This command you must run from Git CMD as administrator
• Or from program Kitematic -> PowerShell (from DockerToolBox)
• >generate_client_certs.sh ${DOCKER_CLIENT_CERT_PATH}
Let’s go to docker-host:
Access the target host url
http://<TARGET_HOST>
with the
user john.smith
and
password Password01
Success!
Prepared project PetClinic
• http://<TARGET_HOST>/jenkins/job/LoadPlatform -
• rebuild All downstream jobs
• http://<TARGET_HOST>/jenkins/job/ExampleWorkspace/job/Exa
mpleProject/job/Create_Environment
• Click “Build with parameters”
• http://<TARGET_HOST>/jenkins/job/ExampleWorkspace/job/Exa
mpleProject/view/Java_Reference_Application/
• Click “Run”
Success build and deploy!
Click on link Console Output
Click on Environment URL
Click on link #1Reference_Application_Deploy
Get Result!
Let’s create own example
• Our tasks:
• Create new job for Jenkins for build project from GIT-repository
• Create shell script for setup tomcat-service
• Create new job for Jenkins for deploy this project with service
tomcat
• Create view for review our jobs
Let’s install Jenkins Job DSL plugin
Let’s check if installed
Let’s create freestyle initial job which will be
generate
another jobs : tomcat setup, build, deploy
Click add Item:
Let’s create freestyle initial job which will be
generate
another jobs : tomcat setup, build, deploy
Let’s add step during build “Process Job
DSLs”:
Let’s add step during build “Process Job
DSLs”:
Let’s create groovy - script for job
https://innersource.accenture.com/java201
/java201-adop-cartidge.git
//dls_generate_jobs.groovy
def PROJECT_NAME="Master_Build"
def WORKSPACE_NAME="Master_Build"
// Folders
def workspaceFolderName = "${WORKSPACE_NAME}"
def projectFolderName = "${PROJECT_NAME}"
// Variables
def referenceAppGitRepo = "master"
def referenceAppGitUrl =
"https://github.com/adm3942soit/Master.git"
Let’s see dsl_generate_job.groovy
on("This job builds Master application")
{
ildCleanup()
tPasswords()
asswords()
ent("adop-jenkins-master")
emote {
url(referenceAppGitUrl)
credentials("adop-jenkins-master")
ranch("*/master")
ntVariables {
WORKSPACE_NAME',workspaceFolderName)
PROJECT_NAME',projectFolderName)
ENVIRONMENT_NAME",'CI')
va8")
t{
vents{
refUpdated()
onfigure { gerritxml ->
gerritxml / 'gerritProjects' {
'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject' {
compareType("PLAIN")
pattern(referenceAppGitRepo)
'branches' {
'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch' {
compareType("PLAIN")
pattern("master")
}
}
}
}
gerritxml / serverName("ADOP Gerrit")
Creating view:
// Views
def pipelineView = buildPipelineView("Master_Application")
pipelineView.with{
title('Master_Application Pipeline')
displayedBuilds(5)
selectedJob("Master_Build")
showPipelineParameters()
showPipelineDefinitionHeader()
refreshFrequency(5)
}
queue("Master_Application")
Result:
Created view “Master_Application”
Click “Master_Application” tab:
Let’s add downstream-projects to view:
Let’s add new listview with button “Build”
Groovy script for this you will find in
repository:
• https://innersource.accenture.com/java201/java201-adop-
cartidge.git
References
• http://sheehan.github.io/job-dsl-slides/#/
• http://codeventor.blogspot.com/2015/06/jenkins-dsl-scripting-
part-1-basics-tldr.html
• http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting-
part-2-basics.html
• http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting-
part-3.html
• http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting-
part-4-adding-new-commands.html

Contenu connexe

Tendances

Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 

Tendances (20)

Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
 
Cooking with Chef on Windows
Cooking with Chef on WindowsCooking with Chef on Windows
Cooking with Chef on Windows
 
Cooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 EditionCooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 Edition
 
Automating That "Other" OS
Automating That "Other" OSAutomating That "Other" OS
Automating That "Other" OS
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
Configuration Management in a Containerized World
Configuration Management in a Containerized WorldConfiguration Management in a Containerized World
Configuration Management in a Containerized World
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
 
Tips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefTips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with Chef
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: Vagrant
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Kubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of KubernetesKubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of Kubernetes
 

Similaire à Get started with docker &amp; dev ops

Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 

Similaire à Get started with docker &amp; dev ops (20)

Docker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google CloudDocker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google Cloud
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Geode on Docker
Geode on DockerGeode on Docker
Geode on Docker
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Docker
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
 
moscmy2016: Extending Docker
moscmy2016: Extending Dockermoscmy2016: Extending Docker
moscmy2016: Extending Docker
 
Docker for dev
Docker for devDocker for dev
Docker for dev
 
Docker
DockerDocker
Docker
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Azure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish KalamatiAzure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish Kalamati
 
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 

Plus de Asya Dudnik

использование Hibernate java persistence.part 4.
использование Hibernate java persistence.part 4.использование Hibernate java persistence.part 4.
использование Hibernate java persistence.part 4.
Asya Dudnik
 
использование Hibernate java persistence.part 2.
использование Hibernate java persistence.part 2.использование Hibernate java persistence.part 2.
использование Hibernate java persistence.part 2.
Asya Dudnik
 
Threads in java
Threads in javaThreads in java
Threads in java
Asya Dudnik
 

Plus de Asya Dudnik (20)

Work with my_sql_-_database_in_java
Work with my_sql_-_database_in_javaWork with my_sql_-_database_in_java
Work with my_sql_-_database_in_java
 
Oracle database
Oracle databaseOracle database
Oracle database
 
Work with xml in java
Work with xml in javaWork with xml in java
Work with xml in java
 
Jdbc in java
Jdbc in javaJdbc in java
Jdbc in java
 
Java.fundamentals
Java.fundamentalsJava.fundamentals
Java.fundamentals
 
Data bases in pictures
Data bases in picturesData bases in pictures
Data bases in pictures
 
использование Hibernate java persistence.part 4.
использование Hibernate java persistence.part 4.использование Hibernate java persistence.part 4.
использование Hibernate java persistence.part 4.
 
Hibernate&ejb3 . part3.
Hibernate&ejb3 . part3.Hibernate&ejb3 . part3.
Hibernate&ejb3 . part3.
 
использование Hibernate java persistence.part 2.
использование Hibernate java persistence.part 2.использование Hibernate java persistence.part 2.
использование Hibernate java persistence.part 2.
 
Work with my sql database in java
Work with my sql   database in javaWork with my sql   database in java
Work with my sql database in java
 
Java.fundamentals
Java.fundamentalsJava.fundamentals
Java.fundamentals
 
Web&java. gwt
Web&java. gwtWeb&java. gwt
Web&java. gwt
 
Web&java.jsf.
Web&java.jsf.Web&java.jsf.
Web&java.jsf.
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
 
Web&java. jsp
Web&java. jspWeb&java. jsp
Web&java. jsp
 
Java fx for interface
Java fx for interfaceJava fx for interface
Java fx for interface
 
Java fx for interface
Java fx for interfaceJava fx for interface
Java fx for interface
 
Apache maven in java projects
Apache maven in java projectsApache maven in java projects
Apache maven in java projects
 
Threads in java
Threads in javaThreads in java
Threads in java
 
Ejb in java. part 1.
Ejb in java. part 1.Ejb in java. part 1.
Ejb in java. part 1.
 

Dernier

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Get started with docker &amp; dev ops

  • 1. Get start with Docker & DevOps Sr.Analyst Oksana Dudnik
  • 2. Let’s start with Docker ToolBox • At first we must install Docker ToolBox on local computer: • Go to the Docker Toolbox page. • https://www.docker.com/products/docker-toolbox • Download and install (close all another programs).
  • 3. Let’s create docker-machine • In FAR or in Git CMD(run as administrator) : • >docker-machine create –driver virtualbox –virtualbox-memory 4096 default • If there now errors: • >docker-machine create –driver virtualbox –virtualbox-memory 4096 adop • >docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS adop * virtualbox Running tcp://192.168.99.101:2376 v1.10.3 default - virtualbox Running tcp://192.168.99.100:2376 v1.10.3
  • 4. CREATE environment variables • >SETX DOCKER_MACHINE_NAME “adop” • >SETX DOCKER_HOST “tcp://192.168.99.101:2376” • >SETX DOCKER_CERT_PATH “C:Usersoksana.dudnik.dockermachinemachinesadop” • >SETX DOCKER_TLS_VERYFY “1”
  • 5. • setx LDAP_PWD "Jpk66g63ZifGYIcShSGM“ • setx LDAP_DOMAIN "ldap.example.com“ • setx LDAP_FULL_DOMAIN "dc=ldap,dc=example,dc=com“ • setx GERRIT_MYSQL_USER "gerrit“ • setx GERRIT_MYSQL_PASSWORD "gerrit“ • setx GERRIT_MYSQL_DATABASE "gerrit“ • setx GERRIT_USER_NAME "Gerrit Code Review" • setx GERRIT_USER_EMAIL "gerrit@adop“ • setx SONAR_MYSQL_USER "sonar“ • setx SONAR_MYSQL_PASSWORD "sonar“ • setx SONAR_MYSQL_DATABASE "sonar“ • setx SONAR_ACCOUNT_LOGIN "jenkins“ • setx SONAR_ACCOUNT_PASSWORD "jenkins“ • setx SONAR_DB_LOGIN "%SONAR_MYSQL_USER%“ • setx SONAR_DB_PASSWORD "%SONAR_MYSQL_PASSWORD%“ • setx DOCKER_CLIENT_CERT_PATH “//root/.docker/”
  • 6. Received environment variables • CERT_PATH=$0 //root/.docker/ • CLIENT_SUBJ=/CN=client • CUSTOM_NETWORK_NAME=adopnetwork • DOCKER_CERT_PATH=C:Usersoksana.dudnik.dockermachinemachinesadop • DOCKER_CLIENT_CERT_PATH=//root/.docker/ • DOCKER_HOST=tcp://192.168.99.101:2376 • DOCKER_MACHINE_NAME=adop • DOCKER_TLS_VERIFY=1 • DOCKER_TOOLBOX_INSTALL_PATH=C:Program FilesDocker Toolbox
  • 7. Envorment variables • GERRIT_MYSQL_DATABASE=gerrit • GERRIT_MYSQL_PASSWORD=gerrit • GERRIT_MYSQL_USER=gerrit • GERRIT_USER_EMAIL=gerrit@adop • GERRIT_USER_NAME=Gerrit Code Review • HOME=/root • HOMEDRIVE=C: • HOMEPATH=Usersoksana.dudnik • HOST=192.168.99.100 • LDAP_DOMAIN=ldap.example.com • LDAP_FULL_DOMAIN=dc=ldap,dc=example,dc=com • LDAP_PWD=Jpk66g63ZifGYIcShSGM
  • 8. Envorment variables • LOGSTASH_HOST=192.168.99.101 • MACHINE_NAME=adop • SONAR_ACCOUNT_LOGIN=jenkins • SONAR_ACCOUNT_PASSWORD=jenkins • SONAR_DB_LOGIN=sonar • SONAR_DB_PASSWORD=sonar • SONAR_MYSQL_DATABASE=sonar • SONAR_MYSQL_PASSWORD=sonar • SONAR_MYSQL_USER=sonar • USER_HOME=C:Usersoksana.dudnik
  • 9. CREATE network • setx TARGET_HOST "192.168.99.101“ • setx LOGSTASH_HOST “%TARGET_HOST%" • docker network create %CUSTOM_NETWORK_NAME%
  • 10. Start docker-compose • docker-compose -f compose/elk.yml pull • docker-compose -f docker-compose.yml -f etc/volumes/local/default.yml -f etc/logging/syslog/default.yml pull • docker-compose pull • docker-compose -f compose/elk.yml up -d • docker-compose -f docker-compose.yml -f etc/volumes/local/default.yml -f etc/logging/syslog/default.yml up -d
  • 11. Run docker container jenkins • >docker exec jenkins curl -I -s jenkins:jenkins@localhost:8080/jenkins/ • >docker exec jenkins curl -X POST jenkins:jenkins@localhost:8080/jenkins/job/Load_Platform/build WithParameters --data token=gAsuE35s
  • 12. GENERATE ssl certificates • This command you must run from Git CMD as administrator • Or from program Kitematic -> PowerShell (from DockerToolBox) • >generate_client_certs.sh ${DOCKER_CLIENT_CERT_PATH}
  • 13. Let’s go to docker-host: Access the target host url http://<TARGET_HOST> with the user john.smith and password Password01
  • 15. Prepared project PetClinic • http://<TARGET_HOST>/jenkins/job/LoadPlatform - • rebuild All downstream jobs • http://<TARGET_HOST>/jenkins/job/ExampleWorkspace/job/Exa mpleProject/job/Create_Environment • Click “Build with parameters” • http://<TARGET_HOST>/jenkins/job/ExampleWorkspace/job/Exa mpleProject/view/Java_Reference_Application/ • Click “Run”
  • 16. Success build and deploy!
  • 17. Click on link Console Output
  • 19. Click on link #1Reference_Application_Deploy
  • 21. Let’s create own example • Our tasks: • Create new job for Jenkins for build project from GIT-repository • Create shell script for setup tomcat-service • Create new job for Jenkins for deploy this project with service tomcat • Create view for review our jobs
  • 22. Let’s install Jenkins Job DSL plugin
  • 23. Let’s check if installed
  • 24. Let’s create freestyle initial job which will be generate another jobs : tomcat setup, build, deploy
  • 26. Let’s create freestyle initial job which will be generate another jobs : tomcat setup, build, deploy
  • 27. Let’s add step during build “Process Job DSLs”:
  • 28. Let’s add step during build “Process Job DSLs”:
  • 29. Let’s create groovy - script for job https://innersource.accenture.com/java201 /java201-adop-cartidge.git //dls_generate_jobs.groovy def PROJECT_NAME="Master_Build" def WORKSPACE_NAME="Master_Build" // Folders def workspaceFolderName = "${WORKSPACE_NAME}" def projectFolderName = "${PROJECT_NAME}" // Variables def referenceAppGitRepo = "master" def referenceAppGitUrl = "https://github.com/adm3942soit/Master.git"
  • 30. Let’s see dsl_generate_job.groovy on("This job builds Master application") { ildCleanup() tPasswords() asswords() ent("adop-jenkins-master") emote { url(referenceAppGitUrl) credentials("adop-jenkins-master") ranch("*/master") ntVariables { WORKSPACE_NAME',workspaceFolderName) PROJECT_NAME',projectFolderName) ENVIRONMENT_NAME",'CI') va8") t{ vents{ refUpdated() onfigure { gerritxml -> gerritxml / 'gerritProjects' { 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject' { compareType("PLAIN") pattern(referenceAppGitRepo) 'branches' { 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch' { compareType("PLAIN") pattern("master") } } } } gerritxml / serverName("ADOP Gerrit")
  • 31. Creating view: // Views def pipelineView = buildPipelineView("Master_Application") pipelineView.with{ title('Master_Application Pipeline') displayedBuilds(5) selectedJob("Master_Build") showPipelineParameters() showPipelineDefinitionHeader() refreshFrequency(5) } queue("Master_Application")
  • 36. Let’s add new listview with button “Build”
  • 37. Groovy script for this you will find in repository: • https://innersource.accenture.com/java201/java201-adop- cartidge.git
  • 38. References • http://sheehan.github.io/job-dsl-slides/#/ • http://codeventor.blogspot.com/2015/06/jenkins-dsl-scripting- part-1-basics-tldr.html • http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting- part-2-basics.html • http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting- part-3.html • http://codeventor.blogspot.com/2015/07/jenkins-dsl-scripting- part-4-adding-new-commands.html