Two-Step Deployment for RailsDoug Smithhttp://daveramsey.com
Classic Capistrano One-Step ProcessExport code from GithubAsset Precompileetc., etc.Staging ProductionExport code from Git...
Problems With Classic Approach• Staging and Production might run different code• Production requires extra dependencies
Two-Step Process1. Build deployable “package”2. Deploy same package to all environments
Why Two Steps?• Consistent code package deployed• Fewer dependencies on production
Build ProcessExport code from GithubRun Entire Test SuiteAsset Precompilebundle install --deployment$ cap build deploy
Deploy Built Package To ServersBuildStaging Production
Deploy ProcessRSync built app to serverGraceful Unicorn restart$ cap staging deploy -s release_name="20130430172348"
RSync Task: production environmentsnamespace :deploy dodesc <<-DESCUpdate all servers with the latest release of the sourc...
Summary1. Build once2. Deploy same package everywhere
Follow-up• http://slidesha.re/Ylgipm• doug.smith@daveramsey.com• @arogos• http://developwithpurpose.com
Upcoming SlideShare
Loading in …5
×

Two-Step Deployment with Rails

473
-1

Published on

A 5-minute "lightning talk". Very briefly shows how we package a Rails app on a build server, then RSync the app package to our staging and production environments.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
473
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Two-Step Deployment with Rails

  1. 1. Two-Step Deployment for RailsDoug Smithhttp://daveramsey.com
  2. 2. Classic Capistrano One-Step ProcessExport code from GithubAsset Precompileetc., etc.Staging ProductionExport code from GithubAsset Precompileetc., etc.$ cap deploy
  3. 3. Problems With Classic Approach• Staging and Production might run different code• Production requires extra dependencies
  4. 4. Two-Step Process1. Build deployable “package”2. Deploy same package to all environments
  5. 5. Why Two Steps?• Consistent code package deployed• Fewer dependencies on production
  6. 6. Build ProcessExport code from GithubRun Entire Test SuiteAsset Precompilebundle install --deployment$ cap build deploy
  7. 7. Deploy Built Package To ServersBuildStaging Production
  8. 8. Deploy ProcessRSync built app to serverGraceful Unicorn restart$ cap staging deploy -s release_name="20130430172348"
  9. 9. RSync Task: production environmentsnamespace :deploy dodesc <<-DESCUpdate all servers with the latest release of the source code.Since production servers do not have access to SCM, we usersync to push to code to the servers.DESCtask :update_code, :roles => [:app, :web] doon_rollback { run "rm -rf #{release_path}; true" }username = user || ENV[USER]run <<-CMDrsync -avz -e ssh #{Dir.pwd}/ #{username}@$CAPISTRANO:HOST$:#{release_path} --exclude log --exclude tmp--exclude public/assets --exclude public/files --exclude public/systemCMDhttps://gist.github.com/dugsmith/5109521
  10. 10. Summary1. Build once2. Deploy same package everywhere
  11. 11. Follow-up• http://slidesha.re/Ylgipm• doug.smith@daveramsey.com• @arogos• http://developwithpurpose.com

×