SlideShare uma empresa Scribd logo
1 de 11
Baixar para ler offline
Two-Step Deployment for Rails
Doug Smith
http://daveramsey.com
Classic Capistrano One-Step Process
Export code from Github
Asset Precompile
etc., etc.
Staging Production
Export code from Github
Asset Precompile
etc., etc.
$ cap deploy
Problems With Classic Approach
• Staging and Production might run different code
• Production requires extra dependencies
Two-Step Process
1. Build deployable “package”
2. Deploy same package to all environments
Why Two Steps?
• Consistent code package deployed
• Fewer dependencies on production
Build Process
Export code from Github
Run Entire Test Suite
Asset Precompile
bundle install --deployment
$ cap build deploy
Deploy Built Package To Servers
Build
Staging Production
Deploy Process
RSync built app to server
Graceful Unicorn restart
$ cap staging deploy -s release_name="20130430172348"
RSync Task: production environments
namespace :deploy do
desc <<-DESC
Update all servers with the latest release of the source code.
Since production servers do not have access to SCM, we use
rsync to push to code to the servers.
DESC
task :update_code, :roles => [:app, :web] do
on_rollback { run "rm -rf #{release_path}; true" }
username = user || ENV['USER']
run <<-CMD
rsync -avz -e ssh '#{Dir.pwd}/' 
'#{username}@$CAPISTRANO:HOST$:#{release_path}' 
--exclude 'log' 
--exclude 'tmp'
--exclude 'public/assets' 
--exclude 'public/files' 
--exclude 'public/system'
CMD
https://gist.github.com/dugsmith/5109521
Summary
1. Build once
2. Deploy same package everywhere
Follow-up
• http://slidesha.re/Ylgipm
• doug.smith@daveramsey.com
• @arogos
• http://developwithpurpose.com

Mais conteúdo relacionado

Mais procurados

Dennis Benkert - The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
Dennis Benkert -  The Dog Ate My Deployment - Symfony Usergroup Berlin March ...Dennis Benkert -  The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
Dennis Benkert - The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
D
 
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
D
 
The Dog Ate My Deployment - PHP Uncoference September 2013
The Dog Ate My Deployment - PHP Uncoference September 2013The Dog Ate My Deployment - PHP Uncoference September 2013
The Dog Ate My Deployment - PHP Uncoference September 2013
D
 

Mais procurados (20)

(GAM404) Gaming DevOps: Scopely's Continuous Deployment Pipeline | AWS re:Inv...
(GAM404) Gaming DevOps: Scopely's Continuous Deployment Pipeline | AWS re:Inv...(GAM404) Gaming DevOps: Scopely's Continuous Deployment Pipeline | AWS re:Inv...
(GAM404) Gaming DevOps: Scopely's Continuous Deployment Pipeline | AWS re:Inv...
 
Dennis Benkert - The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
Dennis Benkert -  The Dog Ate My Deployment - Symfony Usergroup Berlin March ...Dennis Benkert -  The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
Dennis Benkert - The Dog Ate My Deployment - Symfony Usergroup Berlin March ...
 
Docker on Windows and Linux - Red Shirt Dev Tour
Docker on Windows and Linux - Red Shirt Dev TourDocker on Windows and Linux - Red Shirt Dev Tour
Docker on Windows and Linux - Red Shirt Dev Tour
 
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
The Dog Ate My Deployment - Symfony Usergroup Cologne July 2013
 
The Dog Ate My Deployment - PHP Uncoference September 2013
The Dog Ate My Deployment - PHP Uncoference September 2013The Dog Ate My Deployment - PHP Uncoference September 2013
The Dog Ate My Deployment - PHP Uncoference September 2013
 
Continuous integration in games development
Continuous integration in games developmentContinuous integration in games development
Continuous integration in games development
 
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Lightning branches at RedMart (Js conf Asia 2014  Talk)Lightning branches at RedMart (Js conf Asia 2014  Talk)
Lightning branches at RedMart (Js conf Asia 2014 Talk)
 
CodeIgniter For Project : Workshop 001 - Install Docker and CodeIgniter
CodeIgniter For Project : Workshop 001 - Install Docker and CodeIgniterCodeIgniter For Project : Workshop 001 - Install Docker and CodeIgniter
CodeIgniter For Project : Workshop 001 - Install Docker and CodeIgniter
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Zalenium - SeleniumConf Austin 2017
Zalenium - SeleniumConf Austin 2017Zalenium - SeleniumConf Austin 2017
Zalenium - SeleniumConf Austin 2017
 
Developer South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with DockerDeveloper South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with Docker
 
How application performance requirements impacted the (r)evolution of the Doc...
How application performance requirements impacted the (r)evolution of the Doc...How application performance requirements impacted the (r)evolution of the Doc...
How application performance requirements impacted the (r)evolution of the Doc...
 
Testing as a container
Testing as a containerTesting as a container
Testing as a container
 
Exploring Docker in CI/CD
Exploring Docker in CI/CDExploring Docker in CI/CD
Exploring Docker in CI/CD
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
 
Developer South Coast 2018: Docker on Windows - The Beginner's Guide
Developer South Coast 2018: Docker on Windows - The Beginner's GuideDeveloper South Coast 2018: Docker on Windows - The Beginner's Guide
Developer South Coast 2018: Docker on Windows - The Beginner's Guide
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev opsGet started with docker &amp; dev ops
Get started with docker &amp; dev ops
 
CloudExpo 2018: Docker - Power Your Move to the Cloud
CloudExpo 2018: Docker - Power Your Move to the CloudCloudExpo 2018: Docker - Power Your Move to the Cloud
CloudExpo 2018: Docker - Power Your Move to the Cloud
 
Performance testing as part of Agile - Continius Delivery solution
Performance testing as part of Agile - Continius Delivery solutionPerformance testing as part of Agile - Continius Delivery solution
Performance testing as part of Agile - Continius Delivery solution
 
Continuous Updating with VersionEye at code.talks 2014
Continuous Updating with VersionEye at code.talks 2014Continuous Updating with VersionEye at code.talks 2014
Continuous Updating with VersionEye at code.talks 2014
 

Destaque

Presentation media
Presentation mediaPresentation media
Presentation media
JordanField
 
Fish hub cfn_20130309
Fish hub cfn_20130309Fish hub cfn_20130309
Fish hub cfn_20130309
barbielucio
 
Slaidi ettekanne mäng ja loovus
Slaidi ettekanne  mäng ja loovusSlaidi ettekanne  mäng ja loovus
Slaidi ettekanne mäng ja loovus
Pille Lehtemaa
 
CCFT_CDP_Presentation
CCFT_CDP_PresentationCCFT_CDP_Presentation
CCFT_CDP_Presentation
barbielucio
 
Managing a Quota Leasing Program
Managing a Quota Leasing ProgramManaging a Quota Leasing Program
Managing a Quota Leasing Program
barbielucio
 
MANOJ PS-Welding Engineer Resume
MANOJ PS-Welding Engineer ResumeMANOJ PS-Welding Engineer Resume
MANOJ PS-Welding Engineer Resume
Manoj Ps
 

Destaque (13)

Presentation media
Presentation mediaPresentation media
Presentation media
 
Fish hub cfn_20130309
Fish hub cfn_20130309Fish hub cfn_20130309
Fish hub cfn_20130309
 
Retailers and brands must work together on experience
Retailers and brands must work together on experienceRetailers and brands must work together on experience
Retailers and brands must work together on experience
 
Social Media and Employment
Social Media and EmploymentSocial Media and Employment
Social Media and Employment
 
Sevanna Gilpin, CID
Sevanna Gilpin, CIDSevanna Gilpin, CID
Sevanna Gilpin, CID
 
Slaidi ettekanne mäng ja loovus
Slaidi ettekanne  mäng ja loovusSlaidi ettekanne  mäng ja loovus
Slaidi ettekanne mäng ja loovus
 
CCFT_CDP_Presentation
CCFT_CDP_PresentationCCFT_CDP_Presentation
CCFT_CDP_Presentation
 
Catalogo integratori sportivi Inkospor 2015 - integratori alimentari per lo s...
Catalogo integratori sportivi Inkospor 2015 - integratori alimentari per lo s...Catalogo integratori sportivi Inkospor 2015 - integratori alimentari per lo s...
Catalogo integratori sportivi Inkospor 2015 - integratori alimentari per lo s...
 
20x20
20x2020x20
20x20
 
iLetsLPM presentation at the launch event @60HopeStreet
iLetsLPM presentation at the launch event @60HopeStreetiLetsLPM presentation at the launch event @60HopeStreet
iLetsLPM presentation at the launch event @60HopeStreet
 
Smartphone apps
Smartphone appsSmartphone apps
Smartphone apps
 
Managing a Quota Leasing Program
Managing a Quota Leasing ProgramManaging a Quota Leasing Program
Managing a Quota Leasing Program
 
MANOJ PS-Welding Engineer Resume
MANOJ PS-Welding Engineer ResumeMANOJ PS-Welding Engineer Resume
MANOJ PS-Welding Engineer Resume
 

Semelhante a Two-Step Deployment with Rails

UGent Django Infrastructure
UGent Django InfrastructureUGent Django Infrastructure
UGent Django Infrastructure
kevinvw
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Agile Base Camp
 
Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)
Akhmad Fathonih
 

Semelhante a Two-Step Deployment with Rails (20)

UGent Django Infrastructure
UGent Django InfrastructureUGent Django Infrastructure
UGent Django Infrastructure
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
AWS Code Services
AWS Code ServicesAWS Code Services
AWS Code Services
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"
 
DevOps Practices @Pipedrive
DevOps Practices @PipedriveDevOps Practices @Pipedrive
DevOps Practices @Pipedrive
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
Ruby on Rails Kickstart 101 & 102
Ruby on Rails Kickstart 101 & 102Ruby on Rails Kickstart 101 & 102
Ruby on Rails Kickstart 101 & 102
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)
 
Continuous Integration & Development with Gitlab
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Infrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef AutomateInfrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef Automate
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Capistrano
CapistranoCapistrano
Capistrano
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
 
Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"Alexey Kupriyanenko "Release Early, Often, Stable"
Alexey Kupriyanenko "Release Early, Often, Stable"
 

Ú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
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Two-Step Deployment with Rails

  • 1. Two-Step Deployment for Rails Doug Smith http://daveramsey.com
  • 2. Classic Capistrano One-Step Process Export code from Github Asset Precompile etc., etc. Staging Production Export code from Github Asset Precompile etc., etc. $ cap deploy
  • 3. Problems With Classic Approach • Staging and Production might run different code • Production requires extra dependencies
  • 4. Two-Step Process 1. Build deployable “package” 2. Deploy same package to all environments
  • 5. Why Two Steps? • Consistent code package deployed • Fewer dependencies on production
  • 6. Build Process Export code from Github Run Entire Test Suite Asset Precompile bundle install --deployment $ cap build deploy
  • 7. Deploy Built Package To Servers Build Staging Production
  • 8. Deploy Process RSync built app to server Graceful Unicorn restart $ cap staging deploy -s release_name="20130430172348"
  • 9. RSync Task: production environments namespace :deploy do desc <<-DESC Update all servers with the latest release of the source code. Since production servers do not have access to SCM, we use rsync to push to code to the servers. DESC task :update_code, :roles => [:app, :web] do on_rollback { run "rm -rf #{release_path}; true" } username = user || ENV['USER'] run <<-CMD rsync -avz -e ssh '#{Dir.pwd}/' '#{username}@$CAPISTRANO:HOST$:#{release_path}' --exclude 'log' --exclude 'tmp' --exclude 'public/assets' --exclude 'public/files' --exclude 'public/system' CMD https://gist.github.com/dugsmith/5109521
  • 10. Summary 1. Build once 2. Deploy same package everywhere