Apache  @csanchez                   Maven                                       Apache   ASF                              ...
Dev... What?
Agile           planning   iterative development  continuous integrationrelease soon, release often
DevQaOps ?
DevOps addresses       Fear of change     Risky deployments It works on my machine!         SiloisationDev Change vs. Ops ...
Individuals and interactions over processes and tools Working software over comprehensive documentation  Customer collabor...
Our highest priority is to satisfy the customer through early and            continuous delivery of valuable software. Wel...
Dev
What developers do today tospecify target environments is         NOT enough
Ops
requirementsOperating Systemconfig filespackages installedmulti stage configurationsdevQApre-productionproduction
DeploymentHow do I deploy this?documentationmanual stepsprone to errors
CloudHow do I deploy this?to hundreds of servers
DevOps
Should I worry about my OPS            job?
yes my job is to make otherpeople’s jobs unnecessary
yes noyou should see the NOOPS           guys
DevOps is NOT about the tools
Nice, BUThow can I implement IT
Tools can enablechange in behavior  and eventually  change culture     Patrick Debois
DevOps toolseveryone is intelligentenoughevery tool is cloudenabledevery tool is DevOps(tm)
DevOps tools: infrastructure automation                 infrastructure as code      it’s all invented, now it’s standardized
Infrastructure as CodeNew solutions bring new challengesFollow development best practices              tagging            ...
New solutions bring new problems               DEVOPS  “MY MACHINES ARE BEING PROVISIONED”
Puppet                 exec { "maven-untar":manifests          command => "tar xf /tmp/x.tgz",                   cwd => "/...
Puppetinfrastructure IS code                   package { openssh-server:                     ensure => present,           ...
Puppetdeclarative modelstate vs process no scripting                    service { ntp:                      name      => n...
Puppetmaster - agentarchitecture
Vagrant
Vagrant     Oracle VirtualBox cmdline automation       Easy Puppet and Chef provisioning  Keep VM configuration for differe...
Vagrant base boxes  www.vagrantbox.esanywhere! 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...
VagrantVagrant::Config.run do |config|  # Every Vagrant virtual environment requires a box to build off of.  config.vm.box...
manifests/base.pppackage { jdk:  ensure => installed,  name    => $operatingsystem ? {     centOS => "java-1.6.0-openjdk-d...
VeeWee
VeeWee   easily build Vagrant base boxeshttps://github.com/jedi4ever/veewee
using VeeWee$ gem install veewee$ vagrant basebox templates$ vagrant basebox define my-ubuntu-server    ubuntu-11.04-serve...
Geppetto
http://cloudsmith.github.com/geppetto
Puppet DSL
Puppet resourcesuser { dave:  ensure     =>   present,  uid        =>   507,  gid        =>   admin,  shell      =>   /bin...
Puppet standalone$ puppet apply my_test_manifest.pp
orderingfile {/tmp/test1:  ensure => present,  content => "Hi.",}notify {/tmp/test1 has alreadybeen synced.:  require => F...
orderingfile {/tmp/test1:  ensure => present,  content => "Hi.",} ->notify {/tmp/test1 has alreadybeen synced.:}
variables$longthing = "Imagine I have something reallylong in here. Like an SSH key, lets say."file {authorized_keys:  pat...
factshost {self:  ensure         =>   present,  name           =>   $::fqdn,  host_aliases   =>   [puppet, $::hostname],  ...
conditionalscase $operatingsystem {  centos, redhat: { $apache = "httpd" }  debian, ubuntu: { $apache = "apache2" }  defau...
class definitionclass ntp {    package { ntp:      ensure => installed,    }    service { ntp:      name      => ntpd,     ...
parameterized classesclass paramclassexample ($value1, $value2 = "Defaultvalue") {  notify {"Value 1 is ${value1}.":}  not...
modules{module}/    files/    lib/    manifests/         init.pp         {class}.pp         {defined type}.pp         {nam...
templatingfile {/etc/foo.conf:  ensure => file,  require => Package[foo],  content => template(foo/foo.conf.erb),}
templates/foo.conf.erbOS is <%= $::operatingsystem %>
node configuration# nodes.ppnode someserver.domain.com inherits basenode {    $web_fqdn = www.domain.com    include generic...
Examples
Tomcat cluster + postgres     postgres database         db.acme.com      tomcat servers        www1.acme.com        www2.a...
Modules requiredgit clone   https://github.com/maestrodev/puppet-postgres   modules/postgresgit clone   https://github.com...
modules/example/database.ppclass database ($db_password = password) {    class { "postgres" :      password => postgres   ...
modules/example/webserver.ppclass webserver($db_server = localhost, $db_password = password) {  package { "java-1.6.0-open...
manifests/site.ppnode base {  $db_password = web}node db.acme.com inherits base {  class {database: db_password => $db_pas...
spec/hosts/ db_spec.pp & www_spec.pp require rspec-puppet describe db.acme.com do   it { should contain_package(postgres) ...
Example code and slides                    Available at        http://slideshare.carlossanchez.eu          http://github.c...
Gracias!http://blog.carlossanchez.euhttp://maestrodev.comcsanchez@maestrodev.comcarlos@apache.org@csanchez
Photo Credits               Son of Man Lego - Alex Eylarhttp://www.flickr.com/photos/hoyvinmayvin/4702772452/              ...
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Upcoming SlideShare
Loading in...5
×

From Dev to DevOps - Codemotion ES 2012

3,536

Published on

More info at http://blog.carlossanchez.eu/tag/devops

Video en español: http://youtu.be/E_OE4l3t5BA

The DevOps movement aims to improve communication between developers and operations teams to solve critical issues such as fear of change and risky deployments. But the same way that Agile development would likely fail without continuous integration tools, the DevOps principles need tools to make them real, and provide the automation required to actually be implemented. Most of the so called DevOps tools focus on the operations side, and there should be more than that, the automation must cover the full process, Dev to QA to Ops and be as automated and agile as possible. Tools in each part of the workflow have evolved in their own silos, and with the support of their own target teams. But a true DevOps mentality requires a seamless process from the start of development to the end in production deployments and maintenance, and for a process to be successful there must be tools that take the burden out of humans.
Apache Maven has arguably been the most successful tool for development, project standardization and automation introduced in the last years. On the operations side we have open source tools like Puppet or Chef that are becoming increasingly popular to automate infrastructure maintenance and server provisioning.
In this presentation we will introduce an end-to-end development-to-production process that will take advantage of Maven and Puppet, each of them at their strong points, and open source tools to automate the handover between them, automating continuous build and deployment, continuous delivery, from source code to any number of application servers managed with Puppet, running either in physical hardware or the cloud, handling new continuous integration builds and releases automatically through several stages and environments such as development, QA, and production.

Published in: Technology
4 Comments
9 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,536
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
114
Comments
4
Likes
9
Embeds 0
No embeds

No notes for slide

From Dev to DevOps - Codemotion ES 2012

  1. 1. From Dev to DevOpsCarlos Sanchez@csanchezhttp://carlossanchez.euhttp://maestrodev.com
  2. 2. Apache @csanchez Maven Apache ASF Archiva Member ApacheEclipse IAM Continuum blog.carlossanchez.eu
  3. 3. Dev... What?
  4. 4. Agile planning iterative development continuous integrationrelease soon, release often
  5. 5. DevQaOps ?
  6. 6. DevOps addresses Fear of change Risky deployments It works on my machine! SiloisationDev Change vs. Ops stability
  7. 7. Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan
  8. 8. Our highest priority is to satisfy the customer through early and continuous delivery of valuable software. Welcome changing requirements, even late in development. Agile processes harness change for the customers competitive advantage. Deliver working software frequently, from a couple of weeksto a couple of months, with a preference to the shorter timescale. Business people and developers must work together daily throughout the project. The most efficient and effective method of conveying information to and within a development team is face-to-face conversation. Agile processes promote sustainable development. Thesponsors, developers, and users should be able to maintain a constant pace indefinitely.
  9. 9. Dev
  10. 10. What developers do today tospecify target environments is NOT enough
  11. 11. Ops
  12. 12. requirementsOperating Systemconfig filespackages installedmulti stage configurationsdevQApre-productionproduction
  13. 13. DeploymentHow do I deploy this?documentationmanual stepsprone to errors
  14. 14. CloudHow do I deploy this?to hundreds of servers
  15. 15. DevOps
  16. 16. Should I worry about my OPS job?
  17. 17. yes my job is to make otherpeople’s jobs unnecessary
  18. 18. yes noyou should see the NOOPS guys
  19. 19. DevOps is NOT about the tools
  20. 20. Nice, BUThow can I implement IT
  21. 21. Tools can enablechange in behavior and eventually change culture Patrick Debois
  22. 22. DevOps toolseveryone is intelligentenoughevery tool is cloudenabledevery tool is DevOps(tm)
  23. 23. DevOps tools: infrastructure automation infrastructure as code it’s all invented, now it’s standardized
  24. 24. Infrastructure as CodeNew solutions bring new challengesFollow development best practices tagging branching releasing dev, QA, production
  25. 25. New solutions bring new problems DEVOPS “MY MACHINES ARE BEING PROVISIONED”
  26. 26. Puppet exec { "maven-untar":manifests command => "tar xf /tmp/x.tgz", cwd => "/opt", creates => "/opt/apache-maven-${version}",ruby-like path => ["/bin"], } -> ERB templates 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], }
  27. 27. Puppetinfrastructure IS code package { openssh-server: ensure => present, }
  28. 28. Puppetdeclarative modelstate vs process no scripting service { ntp: name => ntpd, ensure => running, }
  29. 29. Puppetmaster - agentarchitecture
  30. 30. Vagrant
  31. 31. Vagrant Oracle VirtualBox cmdline automation Easy Puppet and Chef provisioning Keep VM configuration for different projectsShare boxes and configuration files across teams base box + configuration files
  32. 32. Vagrant base boxes www.vagrantbox.esanywhere! just (big) files
  33. 33. 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
  34. 34. VagrantVagrant::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" endend
  35. 35. manifests/base.pppackage { jdk: ensure => installed, name => $operatingsystem ? { centOS => "java-1.6.0-openjdk-devel", Ubuntu => "openjdk-6-jdk", default => "jdk", },}
  36. 36. VeeWee
  37. 37. VeeWee easily build Vagrant base boxeshttps://github.com/jedi4ever/veewee
  38. 38. using VeeWee$ gem install veewee$ vagrant basebox templates$ vagrant basebox define my-ubuntu-server ubuntu-11.04-server-amd64# customize definitions/my-ubuntu-server$ vagrant basebox build my-ubuntu-server$ vagrant basebox validate my-ubuntu-server$ vagrant basebox export my-ubuntu-server$ vagrant box add my-ubuntu-server my-ubuntu-server.box$ vagrant init my-ubuntu-server
  39. 39. Geppetto
  40. 40. http://cloudsmith.github.com/geppetto
  41. 41. Puppet DSL
  42. 42. Puppet resourcesuser { dave: ensure => present, uid => 507, gid => admin, shell => /bin/zsh, home => /home/dave, managehome => true,}
  43. 43. Puppet standalone$ puppet apply my_test_manifest.pp
  44. 44. orderingfile {/tmp/test1: ensure => present, content => "Hi.",}notify {/tmp/test1 has alreadybeen synced.: require => File[/tmp/test1],}
  45. 45. orderingfile {/tmp/test1: ensure => present, content => "Hi.",} ->notify {/tmp/test1 has alreadybeen synced.:}
  46. 46. variables$longthing = "Imagine I have something reallylong in here. Like an SSH key, lets say."file {authorized_keys: path => /root/.ssh/authorized_keys, content => $longthing,}
  47. 47. factshost {self: ensure => present, name => $::fqdn, host_aliases => [puppet, $::hostname], ip => $::ipaddress,}file {motd: ensure => file, path => /etc/motd, mode => 0644, content => "Welcome to ${::hostname},na ${::operatingsystem} island in the sea of ${::domain}.n",}
  48. 48. conditionalscase $operatingsystem { centos, redhat: { $apache = "httpd" } debian, ubuntu: { $apache = "apache2" } default: { fail("Unrecognized operating system forwebserver") }}$apache = $operatingsystem ? { centos => httpd, redhat => httpd, /(?i)(ubuntu|debian)/ => "apache2-$1", # (Dont actually use that package name.) default => undef, }
  49. 49. class definitionclass ntp { package { ntp: ensure => installed, } service { ntp: name => ntpd, ensure => running, enable => true, subscribe => File[ntp.conf], }}
  50. 50. parameterized classesclass paramclassexample ($value1, $value2 = "Defaultvalue") { notify {"Value 1 is ${value1}.":} notify {"Value 2 is ${value2}.":}}class {paramclassexample: value1 => Something, value2 => Something else,}class {paramclassexample: value1 => Something,}
  51. 51. modules{module}/ files/ lib/ manifests/ init.pp {class}.pp {defined type}.pp {namespace}/ {class}.pp {class}.pp templates/ tests/
  52. 52. templatingfile {/etc/foo.conf: ensure => file, require => Package[foo], content => template(foo/foo.conf.erb),}
  53. 53. templates/foo.conf.erbOS is <%= $::operatingsystem %>
  54. 54. node configuration# nodes.ppnode someserver.domain.com inherits basenode { $web_fqdn = www.domain.com include genericwebserver include some_other_service}node ldapmaster.domain.com inherits basenode { include s_ldap::master}node humanresources.domain.com inherits basenode { include c_humanresources}
  55. 55. Examples
  56. 56. Tomcat cluster + postgres postgres database db.acme.com tomcat servers www1.acme.com www2.acme.com ... webapp
  57. 57. Modules requiredgit clone https://github.com/maestrodev/puppet-postgres modules/postgresgit clone https://github.com/camptocamp/puppet-tomcat modules/tomcatgit clone https://github.com/maestrodev/puppet-maven modules/maven
  58. 58. modules/example/database.ppclass database ($db_password = password) { class { "postgres" : password => postgres } -> postgres::initdb{ "initdb": } -> postgres::enable { "enable": } -> postgres::user { "web": passwd => $db_password } -> postgres::createdb { "web": owner=> "web" }}
  59. 59. modules/example/webserver.ppclass webserver($db_server = localhost, $db_password = password) { package { "java-1.6.0-openjdk-devel": ensure => "latest" } class { tomcat: } -> tomcat::instance {"mytomcat": } -> class { maven::maven: } -> maven { "/srv/tomcat/${mytomcat}/webapps/mywebapp.war": id => "com.acme:mywebapp:1.0:war", } file { /etc/acme.conf: content => "db = ${db_server}password = ${db_password}", }}
  60. 60. manifests/site.ppnode base { $db_password = web}node db.acme.com inherits base { class {database: db_password => $db_password }}# www1.acme.com, www2.acme.com, www3.acme.com,...node /^wwwd+.acme.com$/ inherits base { class {webserver: db_server => db.acme.com, db_password => $db_password, }}
  61. 61. spec/hosts/ db_spec.pp & www_spec.pp require rspec-puppet describe db.acme.com do it { should contain_package(postgres) } end require rspec-puppet describe www55.acme.com do it should have valid config file do content = catalogue.resource(file, /etc/acme.conf).send (:parameters)[:content] content.should match /db.acme.com/ content.should match /password = web/ end end
  62. 62. Example code and slides Available at http://slideshare.carlossanchez.eu http://github.carlossanchez.eu http://blog.carlossanchez.euhttps://github.com/maestrodev/puppet-modules
  63. 63. Gracias!http://blog.carlossanchez.euhttp://maestrodev.comcsanchez@maestrodev.comcarlos@apache.org@csanchez
  64. 64. Photo Credits Son of Man Lego - Alex Eylarhttp://www.flickr.com/photos/hoyvinmayvin/4702772452/ Brick wall - Luis Argerich http://www.flickr.com/photos/lrargerich/4353397797/ Agile vs. Iterative flow - Christopher Littlehttp://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. Escherhttp://en.wikipedia.org/wiki/File:Escher%27s_Relativity.jpg Teacher and class - Herald Post http://www.flickr.com/photos/heraldpost/5169295832/

×