deploy.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. require 'bundler/capistrano'
  10. # be sure to change these
  11. set :user, 'rubys'
  12. set :domain, 'depot.pragprog.com'
  13. set :application, 'depot'
  14. # adjust if you are using RVM, remove if you are not
  15. require "rvm/capistrano"
  16. set :rvm_ruby_string, '1.9.3'
  17. set :rvm_type, :user
  18. # file paths
  19. set :repository, "#{user}@#{domain}:git/#{application}.git"
  20. set :deploy_to, "/home/#{user}/#{domain}"
  21. # distribute your applications across servers (the instructions below put them
  22. # all on the same server, defined above as 'domain', adjust as necessary)
  23. role :app, domain
  24. role :web, domain
  25. role :db, domain, :primary => true
  26. # you might need to set this if you aren't seeing password prompts
  27. # default_run_options[:pty] = true
  28. # As Capistrano executes in a non-interactive mode and therefore doesn't cause
  29. # any of your shell profile scripts to be run, the following might be needed
  30. # if (for example) you have locally installed gems or applications. Note:
  31. # this needs to contain the full values for the variables set, not simply
  32. # the deltas.
  33. # default_environment['PATH']='<your paths>:/usr/local/bin:/usr/bin:/bin'
  34. # default_environment['GEM_PATH']='<your paths>:/usr/lib/ruby/gems/1.8'
  35. # miscellaneous options
  36. set :deploy_via, :remote_cache
  37. set :scm, 'git'
  38. set :branch, 'master'
  39. set :scm_verbose, true
  40. set :use_sudo, false
  41. set :rails_env, :production
  42. namespace :deploy do
  43. desc "cause Passenger to initiate a restart"
  44. task :restart do
  45. run "touch #{current_path}/tmp/restart.txt"
  46. end
  47. desc "reload the database with seed data"
  48. task :seed do
  49. run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
  50. end
  51. end