SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
Rails Machine




Thursday, January 15, 2009
The State of Rails
                             Application Deployment




Thursday, January 15, 2009
It’s easy, I’ll just use
                                  Capistrano.


Thursday, January 15, 2009
ssh m
                        e@myn
                               ewser
                                    ver.c
                                         om




                             It’s easy, I’ll just use
                                  Capistrano.


Thursday, January 15, 2009
ssh m
                        e@myn
                               ewser
                                      ver.c
                                            om




                             It’s easy, I’ll just use
     apt
                ‐ge
                                  Capistrano.
                         t i
                             nst
                         lib     all
                             mag      li
                                 ick     bma
                                     9‐d     gic
                                         ev      k10
                                                     
Thursday, January 15, 2009
ssh m
                        e@myn
                                ewser
                                          ver.c
                                                om

                                       ag ick
                                  l  rm
                             st al
                 m  in
         ge
                             It’s easy, I’ll just use
     apt
                ‐ge
                                  Capistrano.
                         t i
                             nst
                         lib     all
                             mag      li
                                 ick     bma
                                     9‐d     gic
                                         ev      k10
                                                      
Thursday, January 15, 2009
ssh m                                                          l‐
                    e@myn                                       ysq  
                                                              m by
                           ewser
                                  ver.c                  all ‐ru
                                                       st ql
                                         om          in ys
                                                   t  bm             ev
                                            p
                                                ge li
                                              t‐ r            t1 5‐d
                                        k a rve            en
                                 ma gic      se ysql   cli
                           l l r                 bm
                        ta                    li
                 m  ins
         ge
                             It’s easy, I’ll just use
     apt
                ‐ge
                                  Capistrano.
                         t i
                             nst
                         lib     all
                             mag      li
                                 ick     bma
                                     9‐d     gic
                                         ev      k10
                                                     
Thursday, January 15, 2009
ssh m                                                          l‐
                    e@myn                                       ysq  
                                                              m by
                           ewser
                                  ver.c                  all ‐ru
                                                       st ql
                                         om          in ys
                                                   t  bm             ev
                                            p
                                                ge li
                                              t‐ r            t1 5‐d
                                        k a rve            en
                                 ma gic      se ysql   cli
                           l l r                 bm
                        ta                    li
                 m  ins
         ge
                             It’s easy, I’ll just use
     apt
                ‐ge
                                  Capistrano. /my.cnf
                         t i
                             nst                           / etc
                         lib     all                   vi
                             mag      li
                                 ick     bma
                                     9‐d     gic
                                         ev      k10
                                                      
Thursday, January 15, 2009
ssh m                                                          l‐
                    e@myn                                       ysq  
                                                              m by
                           ewser
                                  ver.c                  all ‐ru
                                                       st ql
                                         om          in ys
                                                   t  bm             ev
                                            p
                                                ge li
                                              t‐ r            t1 5‐d
                                        k a rve            en
                                 ma gic      se ysql   cli
                           l l r                 bm
                        ta                    li
                 m  ins
         ge
                             It’s easy, I’ll just use
     apt
                ‐ge
                                  Capistrano. /my.cnf
                         t i
                             nst                           / etc
                         lib     all                   vi
                             mag      li    /etc/
                                 ick               init.
                                         bma               d/mys
                                     9‐d     gic                 ql st
                                         ev      k10                   art
                                                      
Thursday, January 15, 2009
UR SHIPMENT OF FAIL HAS ARRIVED
Thursday, January 15, 2009
What is
                             deployment?




Thursday, January 15, 2009
A Series of
                             Dependencies
                    • Rails v2.2.2, v1.2.3, etc
                     • Ruby/Ruby Enterprise
                     • Apache/Nginx
                     • Passenger/Thin/Mongrel
                     • MySQL/PostgreSQL
                     • system user
Thursday, January 15, 2009
A Series of
                                  Dependencies
                             • rmagick
                              • libmagick10 libmagick9-dev
                             • thinking-sphinx
                              • compile by hand
                             • memcached
                              • libmemcached, rubygem, service
Thursday, January 15, 2009
Satisfying these dependencies via
                               shell commands is backwards




Thursday, January 15, 2009
• impossible to verify
                    • not revisioned
                    • no ‘migrations’
                    • not DRY
                    • not testable

Thursday, January 15, 2009
Not “The Rails Way”




Thursday, January 15, 2009
script/plugin install moonshine_rails*
                 script/generate moonshine




Thursday, January 15, 2009
Moonshine::Manifest

 #config/moonshine/default.rb
 class Moonshine::Manifest::Rails::Production < Moonshine::Manifest::Rails
   #packages(%w(vim curl))

   #service('memcached', %w(memcache libmemcached))

   #puppet.exec 'foo',
   #  :command => "echo 'normal puppet stuff' > /tmp/test"
 end




Thursday, January 15, 2009
Opinionated Software
Thursday, January 15, 2009
Opinionated Deployment
Thursday, January 15, 2009
Decisions We’ve
                                  Made For You
                    •        Ubuntu

                    •        Apache

                    •        Passenger

                    •        Ruby Enterprise Edition

                    •        MySQL

                    •        ‘rails’ user

                    •        /srv/rails


Thursday, January 15, 2009
Look at all the choices
                                I’m not making
                     class Moonshine::Manifest::Rails < Moonshine::Manifest
                       requires [
                         :user,
                         :ruby,
                         :rubygems,
                         :db,
                         :web,
                         :rails,
                         :deploy
                       ]
                       provides :user, 'rails'
                       provides :ruby, 'enterprise_ruby'
                       provides :rubygems, 'enterprise_rubygems'
                       provides :db, 'mysql'
                       provides :web, 'apache2'
                       provides :rails, 'passenger'
                       provides :deploy, 'git'
                     end


Thursday, January 15, 2009
On your server...


Thursday, January 15, 2009
sudo apt‐get install moonshine*
                                 sudo moonshine




Thursday, January 15, 2009
Answer some questions
                    • application name
                    • git repo
                    • branch to deploy from
                    • user to create
                     • generates SSH key for git host
                    • server ‘tags’
Thursday, January 15, 2009
Moonshine goes to
                                   work
                    • clones your repo
                    • parses and executes generated moonshine
                             manifests
                             • installs needed gems
                             • install dependencies
                             • migrates your db
                             • deploys your app
Thursday, January 15, 2009
Gem Dependencies
                   gem_dependencies do |gem|

                     #lots of dependencies are specified for you already
                     #gem.packages 'mysql', %w(mysql‐dev libmysqlclient5‐dev)
                     #gem.packages 'rmagick', %w(ruby‐dev libmagick9‐dev)
                     #...

                     #can specify a mini‐manifest to satisfy before
                     #installation of this gem 
                     gem.custom 'urgem' do |puppet|
                       puppet.file '/file/needed/by/ur/gem',
                         :ensure   => 'present',
                         :content  => 'foo'

                       build_tarball('http://whatever.com/lib‐something.tgz')
                     end

                   end


Thursday, January 15, 2009
#need to deploy again?
                                 sudo moonshine




Thursday, January 15, 2009
On subsequent runs
                    • updates your repo
                    • parses and executes updated moonshine
                             manifests
                             • verifies needed gems
                             • verifies dependencies
                             • migrates your db
                             • deploys your app
Thursday, January 15, 2009
Deployment is now...
                    • Reproducible
                    • Verified from top-bottom on each deploy
                    • Versionable with your application
                     • same commit can contain, for example,
                             thinking sphinx and installation of the
                             sphinx searchd daemon
                    • DRY
Thursday, January 15, 2009
Puppet Based
                             class MysqlMain < Moonshine::Manifest
                               puppet.file '/etc/my.cnf',
                                 :ensure => 'present',
                                 :content => """
                             [client]
                             port      = 3306
                             socket    = /var/run/mysqld/mysqld.sock
                             [mysqld]
                             default‐character‐set = utf8
                             key_buffer            = 16M
                             max_allowed_packet    = 16M
                             thread_stack          = 128K
                             thread_cache_size     = 8
                             """
                             end




Thursday, January 15, 2009
But Ruby

             class MysqlMain < Moonshine::Manifest
               puppet.file '/etc/my.cnf',
                 :ensure   => 'present',
                 :content  => ArbitraryKlass.arbitrary_function('foo')
             end




Thursday, January 15, 2009
Modular
                    UrClass < Moonshine::Manifest::Rails < Moonshine::Manifest




                    • easy to create your own reusable
                             server manifests

                    • extend existing ones with modules


Thursday, January 15, 2009
Sample ‘plugin’
                       module MoonshineOrderedPackages
                         def packages(array_or_name, params = {})
                           package_array = array_or_name.to_a
                           params = {
                             :ensure => 'installed'
                           }.merge(params)

                           package_array.each_with_index do |name,index|
                             #ensure packages are installed in order given
                             package_params = params
                             if package_array[index+1]
                               package_params.merge({
                                 :before => package(package_array[index+1])
                               })
                             end
                             puppet.package name.to_s, package_params
                           end
                         end
                       end

                       Moonshine::Manifest::Rails.send(:extend, MoonshineOrderedPackages)



Thursday, January 15, 2009
Coming Soon


                    • screencast demo (blog.railsmachine.com)
                    • source on GitHub


Thursday, January 15, 2009
Questions?



Thursday, January 15, 2009
Jesse Newland



                              jesse@railsmachine.com


Thursday, January 15, 2009
Flickr FTW

                    •        http://www.flickr.com/photos/wolfgangstaudt/2279651479/sizes/o/

                    •        http://www.flickr.com/photos/ramdac/373881476/sizes/o/

                    •        http://www.flickr.com/photos/striatic/2192189572/sizes/o/

                    •        http://www.flickr.com/photos/blakespot/2376243022/sizes/o

                    •        http://www.flickr.com/photos/gravestone/449328990/sizes/l/

                    •        http://www.flickr.com/photos/redglow/410800461/sizes/o/




Thursday, January 15, 2009

Más contenido relacionado

Más de elliando dias

Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introductionelliando dias
 
FleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in ClojureFleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in Clojureelliando dias
 
Clojure and The Robot Apocalypse
Clojure and The Robot ApocalypseClojure and The Robot Apocalypse
Clojure and The Robot Apocalypseelliando dias
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lispelliando dias
 

Más de elliando dias (20)

Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
 
FleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in ClojureFleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in Clojure
 
Clojure and The Robot Apocalypse
Clojure and The Robot ApocalypseClojure and The Robot Apocalypse
Clojure and The Robot Apocalypse
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 

Último

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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...apidays
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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 WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
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...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
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...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Railsmachine - Moonshine

  • 2. The State of Rails Application Deployment Thursday, January 15, 2009
  • 3. It’s easy, I’ll just use Capistrano. Thursday, January 15, 2009
  • 4. ssh m e@myn ewser ver.c om It’s easy, I’ll just use Capistrano. Thursday, January 15, 2009
  • 5. ssh m e@myn ewser ver.c om It’s easy, I’ll just use apt ‐ge Capistrano. t i nst lib all mag  li ick bma 9‐d gic ev k10   Thursday, January 15, 2009
  • 6. ssh m e@myn ewser ver.c om ag ick l  rm st al m  in ge It’s easy, I’ll just use apt ‐ge Capistrano. t i nst lib all mag  li ick bma 9‐d gic ev k10   Thursday, January 15, 2009
  • 7. ssh m l‐ e@myn ysq    m by ewser ver.c all ‐ru st ql om in ys t  bm ev p ge li t‐ r  t1 5‐d k a rve en ma gic se ysql cli l l r bm ta li m  ins ge It’s easy, I’ll just use apt ‐ge Capistrano. t i nst lib all mag  li ick bma 9‐d gic ev k10   Thursday, January 15, 2009
  • 8. ssh m l‐ e@myn ysq    m by ewser ver.c all ‐ru st ql om in ys t  bm ev p ge li t‐ r  t1 5‐d k a rve en ma gic se ysql cli l l r bm ta li m  ins ge It’s easy, I’ll just use apt ‐ge Capistrano. /my.cnf t i nst  / etc lib all vi mag  li ick bma 9‐d gic ev k10   Thursday, January 15, 2009
  • 9. ssh m l‐ e@myn ysq    m by ewser ver.c all ‐ru st ql om in ys t  bm ev p ge li t‐ r  t1 5‐d k a rve en ma gic se ysql cli l l r bm ta li m  ins ge It’s easy, I’ll just use apt ‐ge Capistrano. /my.cnf t i nst  / etc lib all vi mag  li /etc/ ick init. bma d/mys 9‐d gic ql st ev k10 art   Thursday, January 15, 2009
  • 10. UR SHIPMENT OF FAIL HAS ARRIVED Thursday, January 15, 2009
  • 11. What is deployment? Thursday, January 15, 2009
  • 12. A Series of Dependencies • Rails v2.2.2, v1.2.3, etc • Ruby/Ruby Enterprise • Apache/Nginx • Passenger/Thin/Mongrel • MySQL/PostgreSQL • system user Thursday, January 15, 2009
  • 13. A Series of Dependencies • rmagick • libmagick10 libmagick9-dev • thinking-sphinx • compile by hand • memcached • libmemcached, rubygem, service Thursday, January 15, 2009
  • 14. Satisfying these dependencies via shell commands is backwards Thursday, January 15, 2009
  • 15. • impossible to verify • not revisioned • no ‘migrations’ • not DRY • not testable Thursday, January 15, 2009
  • 16. Not “The Rails Way” Thursday, January 15, 2009
  • 17. script/plugin install moonshine_rails* script/generate moonshine Thursday, January 15, 2009
  • 18. Moonshine::Manifest #config/moonshine/default.rb class Moonshine::Manifest::Rails::Production < Moonshine::Manifest::Rails   #packages(%w(vim curl))   #service('memcached', %w(memcache libmemcached))   #puppet.exec 'foo',   #  :command => "echo 'normal puppet stuff' > /tmp/test" end Thursday, January 15, 2009
  • 21. Decisions We’ve Made For You • Ubuntu • Apache • Passenger • Ruby Enterprise Edition • MySQL • ‘rails’ user • /srv/rails Thursday, January 15, 2009
  • 22. Look at all the choices I’m not making class Moonshine::Manifest::Rails < Moonshine::Manifest   requires [     :user,     :ruby,     :rubygems,     :db,     :web,     :rails,     :deploy   ]   provides :user, 'rails'   provides :ruby, 'enterprise_ruby'   provides :rubygems, 'enterprise_rubygems'   provides :db, 'mysql'   provides :web, 'apache2'   provides :rails, 'passenger'   provides :deploy, 'git' end Thursday, January 15, 2009
  • 23. On your server... Thursday, January 15, 2009
  • 24. sudo apt‐get install moonshine* sudo moonshine Thursday, January 15, 2009
  • 25. Answer some questions • application name • git repo • branch to deploy from • user to create • generates SSH key for git host • server ‘tags’ Thursday, January 15, 2009
  • 26. Moonshine goes to work • clones your repo • parses and executes generated moonshine manifests • installs needed gems • install dependencies • migrates your db • deploys your app Thursday, January 15, 2009
  • 27. Gem Dependencies gem_dependencies do |gem|   #lots of dependencies are specified for you already   #gem.packages 'mysql', %w(mysql‐dev libmysqlclient5‐dev)   #gem.packages 'rmagick', %w(ruby‐dev libmagick9‐dev)   #...   #can specify a mini‐manifest to satisfy before   #installation of this gem    gem.custom 'urgem' do |puppet|     puppet.file '/file/needed/by/ur/gem',       :ensure   => 'present',       :content  => 'foo'     build_tarball('http://whatever.com/lib‐something.tgz')   end end Thursday, January 15, 2009
  • 28. #need to deploy again? sudo moonshine Thursday, January 15, 2009
  • 29. On subsequent runs • updates your repo • parses and executes updated moonshine manifests • verifies needed gems • verifies dependencies • migrates your db • deploys your app Thursday, January 15, 2009
  • 30. Deployment is now... • Reproducible • Verified from top-bottom on each deploy • Versionable with your application • same commit can contain, for example, thinking sphinx and installation of the sphinx searchd daemon • DRY Thursday, January 15, 2009
  • 31. Puppet Based class MysqlMain < Moonshine::Manifest   puppet.file '/etc/my.cnf',     :ensure => 'present',     :content => """ [client] port      = 3306 socket    = /var/run/mysqld/mysqld.sock [mysqld] default‐character‐set = utf8 key_buffer            = 16M max_allowed_packet    = 16M thread_stack          = 128K thread_cache_size     = 8 """ end Thursday, January 15, 2009
  • 32. But Ruby class MysqlMain < Moonshine::Manifest   puppet.file '/etc/my.cnf',     :ensure   => 'present',     :content  => ArbitraryKlass.arbitrary_function('foo') end Thursday, January 15, 2009
  • 33. Modular UrClass < Moonshine::Manifest::Rails < Moonshine::Manifest • easy to create your own reusable server manifests • extend existing ones with modules Thursday, January 15, 2009
  • 34. Sample ‘plugin’ module MoonshineOrderedPackages   def packages(array_or_name, params = {})     package_array = array_or_name.to_a     params = {       :ensure => 'installed'     }.merge(params)     package_array.each_with_index do |name,index|       #ensure packages are installed in order given       package_params = params       if package_array[index+1]         package_params.merge({           :before => package(package_array[index+1])         })       end       puppet.package name.to_s, package_params     end   end end Moonshine::Manifest::Rails.send(:extend, MoonshineOrderedPackages) Thursday, January 15, 2009
  • 35. Coming Soon • screencast demo (blog.railsmachine.com) • source on GitHub Thursday, January 15, 2009
  • 37. Jesse Newland jesse@railsmachine.com Thursday, January 15, 2009
  • 38. Flickr FTW • http://www.flickr.com/photos/wolfgangstaudt/2279651479/sizes/o/ • http://www.flickr.com/photos/ramdac/373881476/sizes/o/ • http://www.flickr.com/photos/striatic/2192189572/sizes/o/ • http://www.flickr.com/photos/blakespot/2376243022/sizes/o • http://www.flickr.com/photos/gravestone/449328990/sizes/l/ • http://www.flickr.com/photos/redglow/410800461/sizes/o/ Thursday, January 15, 2009