SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Capistrano 2
  Rocks my world
       Graeme Mathieson, Rubaidh Ltd
           <mathie@rubaidh.com>
http://woss.name/ & http://www.rubaidh.com/
What’s the plan?
•   So, what is it?

•   Installing 2.0

•   What’s new in Cap 2?

•   Stuff I’ve done with cap 2
What is it?
•   A Rails deployment tool

•   A Java deployment tool

•   A troubleshooting tool

•   An ad-hoc systems management tool
Without a Capfile

$ cap2 invoke COMMAND=uname HOSTS=macallan,cardhu
   * executing `invoke'
   * executing quot;unamequot;
     servers: [quot;macallanquot;, quot;cardhuquot;]
     [macallan] executing command
     [cardhu] executing command
  ** [out :: cardhu] SunOS
  ** [out :: macallan] Linux
     command finished
$
Using cap shell
$ cap2 shell HOSTS=balvenie,cardhu
  * executing `shell'
cap> uptime
[establishing connection(s) to balvenie, cardhu]
 ** [out :: balvenie] 19:33:52 up 211 days, 7:25, 1 user, load
average: 0.06, 0.07, 0.07
 ** [out :: cardhu] 7:33pm up 10 day(s), 6:47, 2 users, load
average: 0.18, 0.16, 0.15
cap> uname -r
 ** [out :: balvenie] 2.4.21-47.0.1.EL
 ** [out :: cardhu] 5.10
cap>
Installing 2.0
$   gem   install -y net-ssh net-ftp highline
[   ...   ]
$   gem   install -s http://gems.rubyonrails.com/ capistrano
[   ...   ]




                             Done!
Co-existing with 1.x

# In ~/.bashrc
alias cap1=quot;`which cap` _1.4.1_quot;
alias cap2=quot;`which cap`quot;
alias cap=quot;echo 'Please explicitly choose cap1 or cap2.'quot;
New in 2.0?
•   More rake-like

    -   Use `cap2 -T` to list tasks

    -   Namespaces

•   Deployment strategies

•   Dependencies

•   Generic hooks
New task names
•   deploy    well, umm, deploy

•   deploy_with_migrations     deploy:migrations

•   diff_from_last_deploy    deploy:pending:diff

•   setup    deploy:setup

•   Same idea, just with namespaces
New Deployment Tasks
•   Subversion log of undeployed changes
    •   deploy:pending

•   Command, gem, file, directory dependencies
    • deploy:check
What I’ve been up to
Recipes in plugins

# New Capfile
Dir['vendor/plugins/*/recipes'].each do |plugin|
  load_paths << plugin
end
load 'deploy' if respond_to?(:namespace)
load 'config/deploy'
Daemon Strategies
•   Default uses spin/spawner/reaper

•   Solaris Service Management Framework

•   runit

•   daemontools

•   Autogenerate script/spin
Staging
•   Separate clusters for staging & deployment

•   Use svnmerge to manage branches

•   Trunk is deployed to staging server

•   Production branch gets deployed live
General Strategy


•   Create a rake task to do what you want.

•   Create a Capistrano task that runs the rake
    task.

•   Hook it into the deployment.
DB Backup - Rake
desc quot;Dumps the database into db/env-data.sql.quot;
task :dump => :environment do
  abc = ActiveRecord::Base.configurations[RAILS_ENV]
  cmd = ['mysqldump']
  cmd << quot;--host='#{abc['host']}'quot; unless abc['host'].blank?
  cmd << quot;--user='#{abc['username']}'quot;
  cmd << quot;--password='#{abc['password']}'quot;
  cmd << abc['database']
  cmd << quot; | gzip > #{RAILS_ROOT}/db/#{RAILS_ENV}-data.sql.gzquot;
  sh cmd.flatten.join ' '
end
DB Backup - Capfile

desc “Back up the production database”
task :backup, :roles => :db, :only => { :primary => true } do
  rake = fetch(:rake, 'rake')
  rails_env = fetch(:rails_env, 'production')

  run quot;cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} db:dumpquot;
  get quot;#{current_path}/db/#{rails_env}-data.sql.gzquot;, quot;db/#
{rails_env}-data.sql.gzquot;
end
Hook into deployment


before quot;deploy:migratequot;,   quot;db:backupquot;
All in a plugin


$ script/plugin install -x 
http://svn.rubaidh.com/plugins/trunk/rubaidh_platform
“I checked out your slides, and they look great!
Best of luck on your presentation.”

                                   - Jamis Buck
What else do you want
      to know?

Más contenido relacionado

La actualidad más candente

Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with ResqueNicolas Blanco
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resquehomanj
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupSaewoong Lee
 
Backing up thousands of containers
Backing up thousands of containersBacking up thousands of containers
Backing up thousands of containersMarian Marinov
 
Config managament for development environments ii
Config managament for development environments iiConfig managament for development environments ii
Config managament for development environments iiGareth Rushgrove
 
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy Carol
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy CarolScaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy Carol
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy CarolHakka Labs
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyoneGavin Barron
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios
 
Altitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopAltitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopFastly
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultBram Vogelaar
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Derek Willian Stavis
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverFastly
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Workhorse Computing
 

La actualidad más candente (20)

Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resque
 
Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
 
Backing up thousands of containers
Backing up thousands of containersBacking up thousands of containers
Backing up thousands of containers
 
Config managament for development environments ii
Config managament for development environments iiConfig managament for development environments ii
Config managament for development environments ii
 
Puppet
PuppetPuppet
Puppet
 
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy Carol
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy CarolScaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy Carol
Scaling HBase (nosql store) to handle massive loads at Pinterest by Jeremy Carol
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyone
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
 
Designing net-aws-glacier
Designing net-aws-glacierDesigning net-aws-glacier
Designing net-aws-glacier
 
Php resque
Php resquePhp resque
Php resque
 
Altitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopAltitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshop
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 

Destacado

Riads Essaouira Maroc Hotel Maison 002
Riads Essaouira Maroc Hotel Maison 002Riads Essaouira Maroc Hotel Maison 002
Riads Essaouira Maroc Hotel Maison 002essaouira
 
Riads Essaouira Maroc Hotel Maison 01
Riads Essaouira Maroc Hotel Maison 01Riads Essaouira Maroc Hotel Maison 01
Riads Essaouira Maroc Hotel Maison 01essaouira
 
Vickyandsunny V2
Vickyandsunny V2Vickyandsunny V2
Vickyandsunny V2mimosafly
 

Destacado (8)

QUE ES EL Spam OSCAR E OSPINA
QUE ES EL Spam OSCAR E OSPINAQUE ES EL Spam OSCAR E OSPINA
QUE ES EL Spam OSCAR E OSPINA
 
Riads Essaouira Maroc Hotel Maison 002
Riads Essaouira Maroc Hotel Maison 002Riads Essaouira Maroc Hotel Maison 002
Riads Essaouira Maroc Hotel Maison 002
 
Sample
SampleSample
Sample
 
Riads Essaouira Maroc Hotel Maison 01
Riads Essaouira Maroc Hotel Maison 01Riads Essaouira Maroc Hotel Maison 01
Riads Essaouira Maroc Hotel Maison 01
 
Kaleido02
Kaleido02Kaleido02
Kaleido02
 
Vickyandsunny V2
Vickyandsunny V2Vickyandsunny V2
Vickyandsunny V2
 
Medula Espinal
Medula EspinalMedula Espinal
Medula Espinal
 
TPTP
TPTPTPTP
TPTP
 

Similar a Capistrano 2 Rocks My World

Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterZendCon
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppSmartLogic
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceJesse Vincent
 
Useful Kafka tools
Useful Kafka toolsUseful Kafka tools
Useful Kafka toolsDale Lane
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modulesKris Buytaert
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoAlmir Mendes
 
Virtual Infrastructure
Virtual InfrastructureVirtual Infrastructure
Virtual InfrastructureBryan McLellan
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 

Similar a Capistrano 2 Rocks My World (20)

Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Capistrano2
Capistrano2Capistrano2
Capistrano2
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
 
Useful Kafka tools
Useful Kafka toolsUseful Kafka tools
Useful Kafka tools
 
Capistrano
CapistranoCapistrano
Capistrano
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
EC2
EC2EC2
EC2
 
Virtual Infrastructure
Virtual InfrastructureVirtual Infrastructure
Virtual Infrastructure
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 

Último

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 organizationRadu Cotescu
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Último (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Capistrano 2 Rocks My World

  • 1. Capistrano 2 Rocks my world Graeme Mathieson, Rubaidh Ltd <mathie@rubaidh.com> http://woss.name/ & http://www.rubaidh.com/
  • 2. What’s the plan? • So, what is it? • Installing 2.0 • What’s new in Cap 2? • Stuff I’ve done with cap 2
  • 3. What is it? • A Rails deployment tool • A Java deployment tool • A troubleshooting tool • An ad-hoc systems management tool
  • 4. Without a Capfile $ cap2 invoke COMMAND=uname HOSTS=macallan,cardhu * executing `invoke' * executing quot;unamequot; servers: [quot;macallanquot;, quot;cardhuquot;] [macallan] executing command [cardhu] executing command ** [out :: cardhu] SunOS ** [out :: macallan] Linux command finished $
  • 5. Using cap shell $ cap2 shell HOSTS=balvenie,cardhu * executing `shell' cap> uptime [establishing connection(s) to balvenie, cardhu] ** [out :: balvenie] 19:33:52 up 211 days, 7:25, 1 user, load average: 0.06, 0.07, 0.07 ** [out :: cardhu] 7:33pm up 10 day(s), 6:47, 2 users, load average: 0.18, 0.16, 0.15 cap> uname -r ** [out :: balvenie] 2.4.21-47.0.1.EL ** [out :: cardhu] 5.10 cap>
  • 6. Installing 2.0 $ gem install -y net-ssh net-ftp highline [ ... ] $ gem install -s http://gems.rubyonrails.com/ capistrano [ ... ] Done!
  • 7. Co-existing with 1.x # In ~/.bashrc alias cap1=quot;`which cap` _1.4.1_quot; alias cap2=quot;`which cap`quot; alias cap=quot;echo 'Please explicitly choose cap1 or cap2.'quot;
  • 8. New in 2.0? • More rake-like - Use `cap2 -T` to list tasks - Namespaces • Deployment strategies • Dependencies • Generic hooks
  • 9. New task names • deploy well, umm, deploy • deploy_with_migrations deploy:migrations • diff_from_last_deploy deploy:pending:diff • setup deploy:setup • Same idea, just with namespaces
  • 10. New Deployment Tasks • Subversion log of undeployed changes • deploy:pending • Command, gem, file, directory dependencies • deploy:check
  • 12. Recipes in plugins # New Capfile Dir['vendor/plugins/*/recipes'].each do |plugin| load_paths << plugin end load 'deploy' if respond_to?(:namespace) load 'config/deploy'
  • 13. Daemon Strategies • Default uses spin/spawner/reaper • Solaris Service Management Framework • runit • daemontools • Autogenerate script/spin
  • 14. Staging • Separate clusters for staging & deployment • Use svnmerge to manage branches • Trunk is deployed to staging server • Production branch gets deployed live
  • 15. General Strategy • Create a rake task to do what you want. • Create a Capistrano task that runs the rake task. • Hook it into the deployment.
  • 16. DB Backup - Rake desc quot;Dumps the database into db/env-data.sql.quot; task :dump => :environment do abc = ActiveRecord::Base.configurations[RAILS_ENV] cmd = ['mysqldump'] cmd << quot;--host='#{abc['host']}'quot; unless abc['host'].blank? cmd << quot;--user='#{abc['username']}'quot; cmd << quot;--password='#{abc['password']}'quot; cmd << abc['database'] cmd << quot; | gzip > #{RAILS_ROOT}/db/#{RAILS_ENV}-data.sql.gzquot; sh cmd.flatten.join ' ' end
  • 17. DB Backup - Capfile desc “Back up the production database” task :backup, :roles => :db, :only => { :primary => true } do rake = fetch(:rake, 'rake') rails_env = fetch(:rails_env, 'production') run quot;cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} db:dumpquot; get quot;#{current_path}/db/#{rails_env}-data.sql.gzquot;, quot;db/# {rails_env}-data.sql.gzquot; end
  • 18. Hook into deployment before quot;deploy:migratequot;, quot;db:backupquot;
  • 19. All in a plugin $ script/plugin install -x http://svn.rubaidh.com/plugins/trunk/rubaidh_platform
  • 20. “I checked out your slides, and they look great! Best of luck on your presentation.” - Jamis Buck
  • 21. What else do you want to know?