SlideShare a Scribd company logo
Continuous Delivery
with Maven, Puppet
and Tomcat


Carlos Sanchez
@csanchez
http://csanchez.org
http://maestrodev.com
@csanchez            Apache
                      Maven



 ASF                    Eclipse
Member                Foundation



          csanchez.org
         maestrodev.com
How we got here
Agile




         planning
  iterative development
  continuous integration
release soon, release often
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Fear of change
    Risky deployments
 It works on my machine!
        Siloisation
Dev Change vs. Ops stability
Individuals and interactions over processes and tools
Working software over comprehensive documentation
  Customer collaboration over contract negotiation
    Responding to change over following a plan
OPs requirements


Operating System
config files
packages installed
multi stage configurations
dev
QA
pre-production
production
Deployment


How do I deploy this?
documentation
manual steps
prone to errors
Cloud



How do I deploy this?
to hundreds of servers
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
DevOps
DevQaOps ?
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
DEV   QA   OPS
QA




DEV        OPS
Specs
Packages   DEV   PROD

Versions
Testability
DEV   QA
Metrics
Logs       DEV   PROD
Security
updates
is not about
the tools
but

how can I
implement IT
Tools can
enable change
in behavior
and eventually
change
culture
Patrick Debois
everyone is
intelligent
enough
every tool is
cloud enabled
every tool is DevOps(tm)
3 key concepts
Continuous
Delivery
Continuous
delivery
Infrastructure
as Code
it’s all been invented,
now it’s standardized
manifests
ruby-like
ERB templates
                exec { "maven-untar":
                  command => "tar xf /tmp/x.tgz",
                  cwd => "/opt",
                  creates => "/opt/apache-maven-${version}",
                  path => ["/bin"],
                } ->
                file { "/usr/bin/mvn":
                  ensure => link,
                  target => "/opt/apache-maven-${version}/bin/mvn",
                }
                file { "/usr/local/bin/mvn":
                  ensure => absent,
                  require => Exec["maven-untar"],
                }
                file { "$home/.mavenrc":
                  mode => "0600",
                  owner => $user,
                  content => template("maven/mavenrc.erb"),
                  require => User[$user],
                }
package { 'openssh-server':
                   ensure => present,
                 }




infrastructure
IS code
service { 'ntp':
  name      => 'ntpd',
  ensure    => running,
}




                      declarative model
                      state vs process
                      no scripting
Follow
development             new
best                  solutions
practices
tagging
branching
                         new
releasing             challenges
dev, QA, production
Self servicing
Infrastructure
always
available
virtualization & cloud
empower developers
reduce time-to-
market
devs buy-in
With great power
comes great
responsibility
Vagrant
empower developers
dev-ops collaboration
automation
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Vagrant
Vagrant



     Oracle VirtualBox cmdline automation
      Easy Puppet and Chef provisioning
  Keep VM configuration for different projects
Share boxes and configuration files across teams
         base box + configuration files
Vagrant base boxes




  www.vagrantbox.es


anywhere! just (big) files
using Vagrant


$ gem install vagrant
$ vagrant box add centos-6.0-x86_64 
      http://dl.dropbox.com/u/1627760/centos-6.0-x86_64.box

$   vagrant     init myproject
$   vagrant     up
$   vagrant     ssh
$   vagrant     suspend
$   vagrant     resume
$   vagrant     destroy
Vagrant
Vagrant::Config.run do |config|

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "centos-6.0-x86_64"

  # The url from where the 'config.vm.box' box will be fetched
  config.vm.box_url = "http://dl.dropbox.com/u/1627760/centos-6.0-x86_64.box"

  # Boot with a GUI so you can see the screen. (Default is headless)
  #config.vm.boot_mode = :gui

  # Assign this VM to a host only network IP, allowing you to access it via the IP.
  # config.vm.network "33.33.33.10"

  # Forward a port from the guest to the host, which allows for outside
  # computers to access the VM, whereas host only networking does not.
  config.vm.forward_port "sonar", 9000, 19000

  # Enable provisioning with Puppet stand alone.
  config.vm.share_folder("templates", "/tmp/vagrant-puppet/templates", "templates")

  config.vm.provision :puppet do |puppet|
    puppet.manifest_file = "base.pp"
    puppet.module_path = "mymodules"
    puppet.options = ["--templatedir","/tmp/vagrant-puppet/templates"]
    puppet.options = "-v -d"
  end

end
manifests/base.pp




package { jdk:
  ensure => installed,
  name    => $operatingsystem ? {
     centOS => "java-1.6.0-openjdk-devel",
     Ubuntu => "openjdk-6-jdk",
     default => "jdk",
  },
}
Maven and Puppet
What am I doing to automate deployment



             Ant tasks plugin
              ssh commands
             Assembly plugin
                  Cargo
               Capistrano
What can I do to automate deployment


  Handle full deployment including infrastructure
           not just webapp deployment
    Help Ops with clear, automated manifests
  Ability to reproduce production environments
  in local box using Vagrant / VirtualBox / VMWare
        Use the right tool for the right job
Maven-Puppet module


          A Maven Puppet module


https://github.com/maestrodev/puppet-maven


    fetches Maven artifacts from the repo
        manages them with Puppet
          no more extra packaging
Installing Maven

$repo1 = {
  id => "myrepo",
  username => "myuser",
  password => "mypassword",
  url => "http://repo.acme.com",
}

# Install Maven
class { "maven::maven":
  version => "2.2.1",
} ->

# Create a settings.xml with the repo credentials
class { "maven::settings" :
  servers => [$repo1],
}
New Maven type




maven { "/tmp/maven-core-2.2.1.jar":
  id => "org.apache.maven:maven-core:jar:2.2.1",
  repos => ["http://repo1.maven.apache.org/maven2",
          "http://mirrors.ibiblio.org/pub/mirrors/maven2"],
}
New Maven type




maven { "/tmp/maven-core-2.2.1.jar":
  groupId => "org.apache.maven",
  artifactId => "maven-core",
  version => "2.2.1",
  packaging => "jar",
  repos => ["http://repo1.maven.apache.org/maven2",
          "http://mirrors.ibiblio.org/pub/mirrors/maven2"],
}
Examples
Infrastructure

                 QA           www
            httpd, tomcat,    httpd
               postgres
Jenkins
                             tomcat1
                              tomcat
Archiva

                               db
                             postgres
Tomcat cluster + postgres


      postgres database
          db.acme.com

       tomcat servers
        tomcat1.acme.com
        tomcat2.acme.com
               ...

            httpd
         www.acme.com
Puppet Modules required

                     bundle install && librarian-puppet install


mod 'puppetlabs/java', '0.1.6'
mod 'puppetlabs/apache', '0.4.0'
mod 'inkling/postgresql', '0.2.0'
mod 'puppetlabs/firewall', '0.0.4'
mod 'tomcat',
 :git => 'https://github.com/carlossg/puppet-tomcat.git',
 :ref => 'centos'
mod 'maestrodev/maven', '1.x'
mod 'stahnma/epel', '0.0.2'
mod 'maestrodev/avahi', '1.x'
mod 'acme', :path => 'mymodules/acme'
mymodules/acme/manifests/db_node.pp


class 'acme::db_node' {

    class { "postgresql::server" :
      config_hash => {
         'postgres_password' => 'postgres'
      }
    } ->
    postgresql::db{ "appfuse":
      user      => "appfuse",
      password => "appfuse",
      grant     => "all",
    }
}
mymodules/acme/manifests/tomcat_node.pp

  class 'acme::tomcat_node'($db_host = 'db.local') {

      class { "java":
        distribution => "java-1.6.0-openjdk"
      }

      class { 'tomcat': } ->
      tomcat::instance {'appfuse': } ->

      class { 'maven::maven': } ->
      maven { "/srv/tomcat/appfuse/webapps/ROOT.war":
        id => "org.appfuse:appfuse-spring:2.2.1:war",
      }
  }
manifests/site.pp



import 'nodes/*.pp'

node ‘parent’ {
  class {'epel': } ->

    class {'avahi':
      firewall => true,
    }
}
manifests/nodes/tomcat.pp



# tomcat1.acme.com, tomcat2.acme.com,
tomcat3.acme.com,...
node /tomcatd..*/ inherits ‘parent’ {
  file {'/etc/motd':
    content => ”tomcat server: ${::hostname}n”,
  }

    class {'acme::tomcat_node'}
}
manifests/nodes/qa.pp


node /qa..*/ inherits ‘parent’ {
  class {'acme::db_node': }

     class {'acme::tomcat_node':
       db_host => 'localhost',
     }

    class {'acme::www_node':
       tomcat_host => 'localhost',
     }
}
spec/hosts/db_spec.pp



require 'rspec-puppet'

describe 'db.acme.com' do
  let(:facts) { {
    :osfamily => 'RedHat',
    :operatingsystem => 'CentOS',
    :operatingsystemrelease => ‘6.3’} }

  it { should contain_class('postgresql::server') }
end
spec/hosts/www_spec.pp



require 'rspec-puppet'

describe 'www.acme.com' do
  let(:facts) { {
    :osfamily => 'RedHat',
    :operatingsystem => 'CentOS',
    :operatingsystemrelease => ‘6.3’} }

  it { should contain_package('httpd') }
end
Example code and slides




          Available at
 http://slideshare.csanchez.org
  http://github.csanchez.org
   http://blog.csanchez.org
Thanks!

http://csanchez.org
http://maestrodev.com


csanchez@maestrodev.com
carlos@apache.org
@csanchez
Photo Credits

                Brick wall - Luis Argerich
  http://www.flickr.com/photos/lrargerich/4353397797/
       Agile vs. Iterative flow - Christopher Little
http://en.wikipedia.org/wiki/File:Agile-vs-iterative-flow.jpg
                   DevOps - Rajiv.Pant
      http://en.wikipedia.org/wiki/File:Devops.png
         Pimientos de Padron - Howard Walfish
  http://www.flickr.com/photos/h-bomb/4868400647/
                    Compiling - XKCD
                  http://xkcd.com/303/
            Printer in 1568 - Meggs, Philip B
 http://en.wikipedia.org/wiki/File:Printer_in_1568-ce.png
                 Relativity - M. C. Escher
http://en.wikipedia.org/wiki/File:Escher%27s_Relativity.jpg
             Teacher and class - Herald Post
 http://www.flickr.com/photos/heraldpost/5169295832/

More Related Content

KEY
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
KEY
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
KEY
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
KEY
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez
 
PDF
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Carlos Sanchez
 
PDF
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
PDF
From Dev to DevOps
Agile Spain
 
PDF
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Carlos Sanchez
 
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
From Dev to DevOps
Agile Spain
 
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 

What's hot (20)

PDF
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
PDF
Antons Kranga Building Agile Infrastructures
Antons Kranga
 
PDF
Continuous infrastructure testing
Daniel Paulus
 
PDF
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
PDF
Puppet: Eclipsecon ALM 2013
grim_radical
 
PDF
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
PDF
10 Million hits a day with WordPress using a $15 VPS
Paolo Tonin
 
PDF
Ansible new paradigms for orchestration
Paolo Tonin
 
PPTX
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Martin Etmajer
 
PPTX
Docker Starter Pack
Saeed Hajizade
 
PDF
DevOps(3) : Ansible - (MOSG)
Soshi Nemoto
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Ansible 實戰:top down 觀點
William Yeh
 
PDF
PuppetCamp SEA 1 - Puppet Deployment at OnApp
Walter Heck
 
PDF
Getting started with Ansible
Ivan Serdyuk
 
PDF
Cooking Perl with Chef
David Golden
 
PPTX
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Acquia
 
PDF
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
PDF
PuppetCamp SEA 1 - Use of Puppet
Walter Heck
 
PDF
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
Antons Kranga Building Agile Infrastructures
Antons Kranga
 
Continuous infrastructure testing
Daniel Paulus
 
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
Puppet: Eclipsecon ALM 2013
grim_radical
 
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
10 Million hits a day with WordPress using a $15 VPS
Paolo Tonin
 
Ansible new paradigms for orchestration
Paolo Tonin
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Martin Etmajer
 
Docker Starter Pack
Saeed Hajizade
 
DevOps(3) : Ansible - (MOSG)
Soshi Nemoto
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Ansible 實戰:top down 觀點
William Yeh
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
Walter Heck
 
Getting started with Ansible
Ivan Serdyuk
 
Cooking Perl with Chef
David Golden
 
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Acquia
 
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
PuppetCamp SEA 1 - Use of Puppet
Walter Heck
 
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
 
Ad

Viewers also liked (20)

PDF
Automated Deployment with Maven - going the whole nine yards
John Ferguson Smart Limited
 
PDF
Industrialisation des développements Java
Christian Blavier
 
PDF
DevOps: Coding Defines Monitoring
Opsta
 
PPTX
如何利用Jira + structure 做需求管理
howie YU
 
PDF
Puppet Deployment at OnApp
Puppet
 
PPTX
Fastest Servlets in the West
Stuart (Pid) Williams
 
PDF
Alpes Jug (29th March, 2010) - Apache Maven
Arnaud Héritier
 
ODP
Captain Agile and the Providers of Value
Schalk Cronjé
 
KEY
Building Android apps with Maven
Fabrizio Giudici
 
PPTX
20091112 - Mars Jug - Apache Maven
Arnaud Héritier
 
PDF
Maven 3.0 at Øredev
Matthew McCullough
 
PDF
Veni, Vide, Built: Android Gradle Plugin
Leonardo YongUk Kim
 
PDF
Gradle enabled android project
Shaka Huang
 
PDF
不只自動化而且更敏捷的Android開發工具 gradle mopcon
sam chiu
 
PDF
Gradle in 45min
Schalk Cronjé
 
PDF
Lorraine JUG (1st June, 2010) - Maven
Arnaud Héritier
 
PPTX
Gradle
Vít Kotačka
 
PDF
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Rajmahendra Hegde
 
PDF
Gradle - the Enterprise Automation Tool
Izzet Mustafaiev
 
PDF
Gradle talk, Javarsovia 2010
Tomek Kaczanowski
 
Automated Deployment with Maven - going the whole nine yards
John Ferguson Smart Limited
 
Industrialisation des développements Java
Christian Blavier
 
DevOps: Coding Defines Monitoring
Opsta
 
如何利用Jira + structure 做需求管理
howie YU
 
Puppet Deployment at OnApp
Puppet
 
Fastest Servlets in the West
Stuart (Pid) Williams
 
Alpes Jug (29th March, 2010) - Apache Maven
Arnaud Héritier
 
Captain Agile and the Providers of Value
Schalk Cronjé
 
Building Android apps with Maven
Fabrizio Giudici
 
20091112 - Mars Jug - Apache Maven
Arnaud Héritier
 
Maven 3.0 at Øredev
Matthew McCullough
 
Veni, Vide, Built: Android Gradle Plugin
Leonardo YongUk Kim
 
Gradle enabled android project
Shaka Huang
 
不只自動化而且更敏捷的Android開發工具 gradle mopcon
sam chiu
 
Gradle in 45min
Schalk Cronjé
 
Lorraine JUG (1st June, 2010) - Maven
Arnaud Héritier
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Rajmahendra Hegde
 
Gradle - the Enterprise Automation Tool
Izzet Mustafaiev
 
Gradle talk, Javarsovia 2010
Tomek Kaczanowski
 
Ad

Similar to Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013 (20)

PDF
How I hack on puppet modules
Kris Buytaert
 
PDF
Test driven infrastructure
Skills Matter Talks
 
PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet
 
PDF
Security Testing Using Infrastructure-As-Code
Vision Concepts Infrastructure Services Solution
 
PPTX
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Bamdad Dashtban
 
PDF
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Puppet
 
PDF
Deploying software at Scale
Kris Buytaert
 
PDF
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Cosimo Streppone
 
PDF
20090514 Introducing Puppet To Sasag
garrett honeycutt
 
PDF
SCALE 2011 Deploying OpenStack with Chef
Matt Ray
 
KEY
20100425 Configuration Management With Puppet Lfnw
garrett honeycutt
 
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Walter Heck
 
PDF
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
OlinData
 
PDF
Puppet and the HashiStack
Bram Vogelaar
 
PDF
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Hendrik Ebbers
 
ODP
Vagrant and puppet: Deployment made easy
Geronimo Orozco
 
PDF
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Fabrice Bernhard
 
PDF
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
PDF
Vagrant Binding JayDay 2013
Hendrik Ebbers
 
How I hack on puppet modules
Kris Buytaert
 
Test driven infrastructure
Skills Matter Talks
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet
 
Security Testing Using Infrastructure-As-Code
Vision Concepts Infrastructure Services Solution
 
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Bamdad Dashtban
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Puppet
 
Deploying software at Scale
Kris Buytaert
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Cosimo Streppone
 
20090514 Introducing Puppet To Sasag
garrett honeycutt
 
SCALE 2011 Deploying OpenStack with Chef
Matt Ray
 
20100425 Configuration Management With Puppet Lfnw
garrett honeycutt
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Walter Heck
 
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
OlinData
 
Puppet and the HashiStack
Bram Vogelaar
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Hendrik Ebbers
 
Vagrant and puppet: Deployment made easy
Geronimo Orozco
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Fabrice Bernhard
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
Vagrant Binding JayDay 2013
Hendrik Ebbers
 

More from Carlos Sanchez (20)

PDF
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
PDF
Using Containers for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
PDF
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Carlos Sanchez
 
PDF
Testing Distributed Micro Services. Agile Testing Days 2017
Carlos Sanchez
 
PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
PDF
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
PDF
From Monolith to Docker Distributed Applications. JavaOne
Carlos Sanchez
 
PDF
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Carlos Sanchez
 
PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
PDF
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
PDF
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
PDF
Using Docker for Testing
Carlos Sanchez
 
PDF
Scaling Docker with Kubernetes
Carlos Sanchez
 
PPTX
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
PDF
Scaling Docker with Kubernetes
Carlos Sanchez
 
KEY
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
KEY
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
Using Containers for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Carlos Sanchez
 
Testing Distributed Micro Services. Agile Testing Days 2017
Carlos Sanchez
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
From Monolith to Docker Distributed Applications. JavaOne
Carlos Sanchez
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Carlos Sanchez
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
Using Docker for Testing
Carlos Sanchez
 
Scaling Docker with Kubernetes
Carlos Sanchez
 
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
Scaling Docker with Kubernetes
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Carlos Sanchez
 

Recently uploaded (20)

PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
Doc9.....................................
SofiaCollazos
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Software Development Methodologies in 2025
KodekX
 
Software Development Company | KodekX
KodekX
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 

Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013

  • 1. Continuous Delivery with Maven, Puppet and Tomcat Carlos Sanchez @csanchez http://csanchez.org http://maestrodev.com
  • 2. @csanchez Apache Maven ASF Eclipse Member Foundation csanchez.org maestrodev.com
  • 3. How we got here
  • 4. Agile planning iterative development continuous integration release soon, release often
  • 7. Fear of change Risky deployments It works on my machine! Siloisation Dev Change vs. Ops stability
  • 8. Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan
  • 9. OPs requirements Operating System config files packages installed multi stage configurations dev QA pre-production production
  • 10. Deployment How do I deploy this? documentation manual steps prone to errors
  • 11. Cloud How do I deploy this? to hundreds of servers
  • 16. DEV QA OPS
  • 17. QA DEV OPS
  • 18. Specs Packages DEV PROD Versions
  • 20. Metrics Logs DEV PROD Security updates
  • 21. is not about the tools but how can I implement IT
  • 22. Tools can enable change in behavior and eventually change culture Patrick Debois
  • 23. everyone is intelligent enough every tool is cloud enabled every tool is DevOps(tm)
  • 27. Infrastructure as Code it’s all been invented, now it’s standardized
  • 28. manifests ruby-like ERB templates exec { "maven-untar": command => "tar xf /tmp/x.tgz", cwd => "/opt", creates => "/opt/apache-maven-${version}", path => ["/bin"], } -> file { "/usr/bin/mvn": ensure => link, target => "/opt/apache-maven-${version}/bin/mvn", } file { "/usr/local/bin/mvn": ensure => absent, require => Exec["maven-untar"], } file { "$home/.mavenrc": mode => "0600", owner => $user, content => template("maven/mavenrc.erb"), require => User[$user], }
  • 29. package { 'openssh-server': ensure => present, } infrastructure IS code
  • 30. service { 'ntp': name => 'ntpd', ensure => running, } declarative model state vs process no scripting
  • 31. Follow development new best solutions practices tagging branching new releasing challenges dev, QA, production
  • 34. devs buy-in With great power comes great responsibility
  • 38. Vagrant Oracle VirtualBox cmdline automation Easy Puppet and Chef provisioning Keep VM configuration for different projects Share boxes and configuration files across teams base box + configuration files
  • 39. Vagrant base boxes www.vagrantbox.es anywhere! just (big) files
  • 40. using Vagrant $ gem install vagrant $ vagrant box add centos-6.0-x86_64 http://dl.dropbox.com/u/1627760/centos-6.0-x86_64.box $ vagrant init myproject $ vagrant up $ vagrant ssh $ vagrant suspend $ vagrant resume $ vagrant destroy
  • 41. Vagrant Vagrant::Config.run do |config| # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "centos-6.0-x86_64" # The url from where the 'config.vm.box' box will be fetched config.vm.box_url = "http://dl.dropbox.com/u/1627760/centos-6.0-x86_64.box" # Boot with a GUI so you can see the screen. (Default is headless) #config.vm.boot_mode = :gui # Assign this VM to a host only network IP, allowing you to access it via the IP. # config.vm.network "33.33.33.10" # Forward a port from the guest to the host, which allows for outside # computers to access the VM, whereas host only networking does not. config.vm.forward_port "sonar", 9000, 19000 # Enable provisioning with Puppet stand alone. config.vm.share_folder("templates", "/tmp/vagrant-puppet/templates", "templates") config.vm.provision :puppet do |puppet| puppet.manifest_file = "base.pp" puppet.module_path = "mymodules" puppet.options = ["--templatedir","/tmp/vagrant-puppet/templates"] puppet.options = "-v -d" end end
  • 42. manifests/base.pp package { jdk: ensure => installed, name => $operatingsystem ? { centOS => "java-1.6.0-openjdk-devel", Ubuntu => "openjdk-6-jdk", default => "jdk", }, }
  • 44. What am I doing to automate deployment Ant tasks plugin ssh commands Assembly plugin Cargo Capistrano
  • 45. What can I do to automate deployment Handle full deployment including infrastructure not just webapp deployment Help Ops with clear, automated manifests Ability to reproduce production environments in local box using Vagrant / VirtualBox / VMWare Use the right tool for the right job
  • 46. Maven-Puppet module A Maven Puppet module https://github.com/maestrodev/puppet-maven fetches Maven artifacts from the repo manages them with Puppet no more extra packaging
  • 47. Installing Maven $repo1 = { id => "myrepo", username => "myuser", password => "mypassword", url => "http://repo.acme.com", } # Install Maven class { "maven::maven": version => "2.2.1", } -> # Create a settings.xml with the repo credentials class { "maven::settings" : servers => [$repo1], }
  • 48. New Maven type maven { "/tmp/maven-core-2.2.1.jar": id => "org.apache.maven:maven-core:jar:2.2.1", repos => ["http://repo1.maven.apache.org/maven2", "http://mirrors.ibiblio.org/pub/mirrors/maven2"], }
  • 49. New Maven type maven { "/tmp/maven-core-2.2.1.jar": groupId => "org.apache.maven", artifactId => "maven-core", version => "2.2.1", packaging => "jar", repos => ["http://repo1.maven.apache.org/maven2", "http://mirrors.ibiblio.org/pub/mirrors/maven2"], }
  • 51. Infrastructure QA www httpd, tomcat, httpd postgres Jenkins tomcat1 tomcat Archiva db postgres
  • 52. Tomcat cluster + postgres postgres database db.acme.com tomcat servers tomcat1.acme.com tomcat2.acme.com ... httpd www.acme.com
  • 53. Puppet Modules required bundle install && librarian-puppet install mod 'puppetlabs/java', '0.1.6' mod 'puppetlabs/apache', '0.4.0' mod 'inkling/postgresql', '0.2.0' mod 'puppetlabs/firewall', '0.0.4' mod 'tomcat', :git => 'https://github.com/carlossg/puppet-tomcat.git', :ref => 'centos' mod 'maestrodev/maven', '1.x' mod 'stahnma/epel', '0.0.2' mod 'maestrodev/avahi', '1.x' mod 'acme', :path => 'mymodules/acme'
  • 54. mymodules/acme/manifests/db_node.pp class 'acme::db_node' { class { "postgresql::server" : config_hash => { 'postgres_password' => 'postgres' } } -> postgresql::db{ "appfuse": user => "appfuse", password => "appfuse", grant => "all", } }
  • 55. mymodules/acme/manifests/tomcat_node.pp class 'acme::tomcat_node'($db_host = 'db.local') { class { "java": distribution => "java-1.6.0-openjdk" } class { 'tomcat': } -> tomcat::instance {'appfuse': } -> class { 'maven::maven': } -> maven { "/srv/tomcat/appfuse/webapps/ROOT.war": id => "org.appfuse:appfuse-spring:2.2.1:war", } }
  • 56. manifests/site.pp import 'nodes/*.pp' node ‘parent’ { class {'epel': } -> class {'avahi': firewall => true, } }
  • 57. manifests/nodes/tomcat.pp # tomcat1.acme.com, tomcat2.acme.com, tomcat3.acme.com,... node /tomcatd..*/ inherits ‘parent’ { file {'/etc/motd': content => ”tomcat server: ${::hostname}n”, } class {'acme::tomcat_node'} }
  • 58. manifests/nodes/qa.pp node /qa..*/ inherits ‘parent’ { class {'acme::db_node': } class {'acme::tomcat_node': db_host => 'localhost', } class {'acme::www_node': tomcat_host => 'localhost', } }
  • 59. spec/hosts/db_spec.pp require 'rspec-puppet' describe 'db.acme.com' do let(:facts) { { :osfamily => 'RedHat', :operatingsystem => 'CentOS', :operatingsystemrelease => ‘6.3’} } it { should contain_class('postgresql::server') } end
  • 60. spec/hosts/www_spec.pp require 'rspec-puppet' describe 'www.acme.com' do let(:facts) { { :osfamily => 'RedHat', :operatingsystem => 'CentOS', :operatingsystemrelease => ‘6.3’} } it { should contain_package('httpd') } end
  • 61. Example code and slides Available at http://slideshare.csanchez.org http://github.csanchez.org http://blog.csanchez.org
  • 63. Photo Credits Brick wall - Luis Argerich http://www.flickr.com/photos/lrargerich/4353397797/ Agile vs. Iterative flow - Christopher Little http://en.wikipedia.org/wiki/File:Agile-vs-iterative-flow.jpg DevOps - Rajiv.Pant http://en.wikipedia.org/wiki/File:Devops.png Pimientos de Padron - Howard Walfish http://www.flickr.com/photos/h-bomb/4868400647/ Compiling - XKCD http://xkcd.com/303/ Printer in 1568 - Meggs, Philip B http://en.wikipedia.org/wiki/File:Printer_in_1568-ce.png Relativity - M. C. Escher http://en.wikipedia.org/wiki/File:Escher%27s_Relativity.jpg Teacher and class - Herald Post http://www.flickr.com/photos/heraldpost/5169295832/