SlideShare uma empresa Scribd logo
1 de 63
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
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
DevOps
DevQaOps ?
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
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/

Mais conteúdo relacionado

Mais procurados

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
 
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Acquia
 

Mais procurados (20)

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 ...
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Continuous infrastructure testing
Continuous infrastructure testingContinuous infrastructure testing
Continuous infrastructure testing
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPS
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous Delivery
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet tree
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Cooking Perl with Chef
Cooking Perl with ChefCooking Perl with Chef
Cooking Perl with Chef
 
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 

Destaque

如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理
howie YU
 

Destaque (20)

Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
 
Industrialisation des développements Java
Industrialisation des développements JavaIndustrialisation des développements Java
Industrialisation des développements Java
 
DevOps: Coding Defines Monitoring
DevOps: Coding Defines MonitoringDevOps: Coding Defines Monitoring
DevOps: Coding Defines Monitoring
 
如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
Alpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache MavenAlpes Jug (29th March, 2010) - Apache Maven
Alpes Jug (29th March, 2010) - Apache Maven
 
Captain Agile and the Providers of Value
Captain Agile and the Providers of ValueCaptain Agile and the Providers of Value
Captain Agile and the Providers of Value
 
Building Android apps with Maven
Building Android apps with MavenBuilding Android apps with Maven
Building Android apps with Maven
 
20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
Veni, Vide, Built: Android Gradle Plugin
Veni, Vide, Built: Android Gradle PluginVeni, Vide, Built: Android Gradle Plugin
Veni, Vide, Built: Android Gradle Plugin
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android project
 
不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopcon不只自動化而且更敏捷的Android開發工具 gradle mopcon
不只自動化而且更敏捷的Android開發工具 gradle mopcon
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Lorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenLorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - Maven
 
Gradle
GradleGradle
Gradle
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 

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

20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
garrett honeycutt
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
Joe Ray
 

Semelhante a Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013 (20)

Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Puppet
PuppetPuppet
Puppet
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
Puppet
PuppetPuppet
Puppet
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 

Mais de Carlos Sanchez

Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
Carlos Sanchez
 

Mais de Carlos Sanchez (20)

Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-Services
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2daysUsing Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
 
Using Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous DeliveryUsing Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous Delivery
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-Services
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
From Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOneFrom Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOne
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and Kubernetes
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and Kubernetes
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

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
  • 5.
  • 6.
  • 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
  • 12.
  • 15.
  • 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
  • 36.
  • 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/