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.
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
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