Your SlideShare is downloading. ×
Two-Step Deployment with Rails
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Two-Step Deployment with Rails

440

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.

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
440
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Two-Step Deployment for RailsDoug Smithhttp://daveramsey.com
  • 2. Classic Capistrano One-Step ProcessExport code from GithubAsset Precompileetc., etc.Staging ProductionExport code from GithubAsset Precompileetc., etc.$ cap deploy
  • 3. Problems With Classic Approach• Staging and Production might run different code• Production requires extra dependencies
  • 4. Two-Step Process1. Build deployable “package”2. Deploy same package to all environments
  • 5. Why Two Steps?• Consistent code package deployed• Fewer dependencies on production
  • 6. Build ProcessExport code from GithubRun Entire Test SuiteAsset Precompilebundle install --deployment$ cap build deploy
  • 7. Deploy Built Package To ServersBuildStaging Production
  • 8. Deploy ProcessRSync built app to serverGraceful Unicorn restart$ cap staging deploy -s release_name="20130430172348"
  • 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. Summary1. Build once2. Deploy same package everywhere
  • 11. Follow-up• http://slidesha.re/Ylgipm• doug.smith@daveramsey.com• @arogos• http://developwithpurpose.com

×