deploy.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. set :rvm_type, :user
  16. set :rvm_ruby_string, 'ruby-2.0.0-p481'
  17. require 'rvm/capistrano'
  18. # file paths
  19. set :repository, "#{user}@#{domain}:git/#{application}.git"
  20. set :deploy_to, "/home/#{user}/deploy/#{application}"
  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 :normalize_asset_timestamps, false
  42. set :rails_env, :production
  43. namespace :deploy do
  44. desc "cause Passenger to initiate a restart"
  45. task :restart do
  46. run "touch #{current_path}/tmp/restart.txt"
  47. end
  48. desc "reload the database with seed data"
  49. task :seed do
  50. deploy.migrations
  51. run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
  52. end
  53. end