deploy.rb 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. #---
  10. # Excerpted from "Agile Web Development with Rails, 4rd Ed.",
  11. # published by The Pragmatic Bookshelf.
  12. # Copyrights apply to this code. It may not be used to create training material,
  13. # courses, books, articles, and the like. Contact us if you are in doubt.
  14. # We make no guarantees that this code is fit for any purpose.
  15. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  16. #---
  17. # be sure to change these
  18. set :user, 'rubys'
  19. set :domain, 'depot.pragprog.com'
  20. set :application, 'depot'
  21. # file paths
  22. set :repository, "#{user}@#{domain}:git/#{application}.git"
  23. set :deploy_to, "/home/#{user}/#{domain}"
  24. # distribute your applications across servers (the instructions below put them
  25. # all on the same server, defined above as 'domain', adjust as necessary)
  26. role :app, domain
  27. role :web, domain
  28. role :db, domain, :primary => true
  29. # you might need to set this if you aren't seeing password prompts
  30. # default_run_options[:pty] = true
  31. # As Capistrano executes in a non-interactive mode and therefore doesn't cause
  32. # any of your shell profile scripts to be run, the following might be needed
  33. # if (for example) you have locally installed gems or applications. Note:
  34. # this needs to contain the full values for the variables set, not simply
  35. # the deltas.
  36. # default_environment['PATH']='<your paths>:/usr/local/bin:/usr/bin:/bin'
  37. # default_environment['GEM_PATH']='<your paths>:/usr/lib/ruby/gems/1.8'
  38. # miscellaneous options
  39. set :deploy_via, :remote_cache
  40. set :scm, 'git'
  41. set :branch, 'master'
  42. set :scm_verbose, true
  43. set :use_sudo, false
  44. namespace :deploy do
  45. desc "cause Passenger to initiate a restart"
  46. task :restart do
  47. run "touch #{current_path}/tmp/restart.txt"
  48. end
  49. desc "reload the database with seed data"
  50. task :seed do
  51. run "cd #{current_path}; rake db:seed RAILS_ENV=production"
  52. end
  53. end
  54. after "deploy:update_code", :bundle_install
  55. desc "install the necessary prerequisites"
  56. task :bundle_install, :roles => :app do
  57. run "cd #{release_path} && bundle install"
  58. end