Guest User

Untitled

a guest
Jun 21st, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. set :application, "your_application_name"
  2. set :ip_address , "000.000.000.000"
  3.  
  4. set :scm, :git
  5. set :repository, "git@github.com:albertoleal/OlaMundo.git"
  6. set :branch, "master"
  7. set :deploy_via, :remote_cache # Deploy only the changes you have made since last deploy.
  8.  
  9. set :user , "albertoleal"
  10. set :deploy_to, "/home/albertoleal/#{application}"
  11. set :shared_directory, "#{deploy_to}/shared"
  12. set :use_sudo, false
  13. set :group_writable, false
  14. set :scm_verbose, true
  15. default_run_options[:pty] = true
  16.  
  17. # ROLES
  18. server ip_address, :app, :web, :db, :primary => true
  19.  
  20. # HOOKS
  21. after 'deploy:setup', 'db:setup'
  22.  
  23. after 'deploy:update_code' do
  24. db.symlink
  25. assets.symlink
  26. end
  27. before 'deploy:migrate' do
  28. deploy.bundle_install
  29. end
  30.  
  31. # TASKS
  32. namespace :deploy do
  33. # Restart passenger on deploy
  34. desc "Restarting mod_rails with restart.txt"
  35. task :restart, :roles => :app, :except => { :no_release => true } do
  36. run "touch #{current_path}/tmp/restart.txt"
  37. end
  38.  
  39. [:start, :stop].each do |t|
  40. desc "#{t} task is a no-op with mod_rails"
  41. task t, :roles => :app do ; end
  42. end
  43.  
  44. desc "Run bundle install"
  45. task :bundle_install do
  46. run "cd #{release_path}/ && bundle install"
  47. end
  48. end
  49.  
  50. namespace :db do
  51. desc "upload database.yml"
  52. task :setup do
  53. upload File.join(File.dirname(__FILE__),"database.yml"), "#{shared_path}/database.yml"
  54. end
  55.  
  56. desc "link database.yml"
  57. task :symlink do
  58. run "rm -rf #{release_path}/config/database.yml"
  59. run "ln -s #{shared_path}/database.yml #{release_path}/config/database.yml"
  60. end
  61.  
  62. desc "seed database"
  63. task :seed do
  64. run "cd #{current_path} && rake db:seed RAILS_ENV=production"
  65. end
  66. end
  67.  
  68. namespace :assets do
  69. desc "assets symlink"
  70. task :symlink, :roles => :app do
  71. run <<-CMD
  72. rm -rf #{current_path}/public/images/system &&
  73. ln -nfs #{shared_path}/system #{release_path}/public/images/system
  74. CMD
  75. end
  76. end
Add Comment
Please, Sign In to add comment