PageRenderTime 660ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/config/deploy.rb

https://bitbucket.org/pavana21/socialloginapplication
Ruby | 114 lines | 52 code | 21 blank | 41 comment | 1 complexity | b14ca93e7413790e45b065166eca54f2 MD5 | raw file
  1. require "bundler/capistrano"
  2. require "rvm/capistrano"
  3. require 'capistrano/ext/multistage'
  4. load "deploy/assets"
  5. set :application, "SocialLoginApp"
  6. set :repository, "git@bitbucket.org:pavana21/socialloginapplication.git"
  7. set :scm, :git
  8. set :user, "deploy"
  9. set :deploy_to, "/apps/SocialLoginApp"
  10. set :use_sudo, false
  11. current_branch = $1 if `git branch` =~ /\* (\S+)\s/
  12. set :branch, 'master'
  13. set :stages, %w(production)
  14. set :default_stage, "production"
  15. # set :whenever_command, "bundle exec whenever"
  16. # set :whenever_environment, defer { stage }
  17. # require "whenever/capistrano"
  18. set :chmod755, 'app config db lib public vendor script script/* public/ disp* log/'
  19. set :runner, 'rails'
  20. namespace :deploy do
  21. after 'deploy:setup', 'deploy:basic_setup'
  22. before "deploy:assets:precompile", "deploy:symlink_shared"
  23. after 'deploy:update', 'deploy:cleanup'
  24. after "deploy", "deploy:migrate"
  25. task :stop, :roles => :app do
  26. invoke_command "cd #{current_path};bundle exec thin stop -C config/thin.yml"
  27. invoke_command "service thin stop"
  28. end
  29. desc "Custom AceMoney deployment: start."
  30. task :start, :roles => :app do
  31. invoke_command "cd #{current_path};bundle exec thin start -C config/thin.yml"
  32. invoke_command "service thin start"
  33. end
  34. # Need to define this restart ALSO as 'cap deploy' uses it
  35. # (Gautam) I dont know how to call tasks within tasks.
  36. desc "Custom AceMoney deployment: restart."
  37. task :restart, :roles => :app do
  38. invoke_command "cd #{current_path};bundle exec thin stop -C config/thin.yml"
  39. invoke_command "service thin stop"
  40. invoke_command "cd #{current_path};bundle exec thin start -C config/thin.yml"
  41. invoke_command "service thin start"
  42. end
  43. task :basic_setup do
  44. # run "mkdir -p #{shared_path}/uploads"
  45. run "mkdir -p #{shared_path}/config"
  46. # run "mkdir -p #{deploy_to}/shared/solr/data"
  47. end
  48. task :symlink_shared, :roles => :app do
  49. # run "ln -nfs #{shared_path}/solr/data #{release_path}/solr/data"
  50. run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  51. # run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
  52. end
  53. # task :stop, :roles => :app do
  54. # run "kill -QUIT `cat #{deploy_to}/shared/pids/unicorn.pid`; true"
  55. # end
  56. #
  57. # task :start, :roles => :app do
  58. # run "mkdir -p #{shared_path}/sockets && ln -s #{shared_path}/sockets #{release_path}/tmp/sockets"
  59. # run "cd #{release_path} && bundle exec unicorn -Dc #{release_path}/config/deploy/#{stage}/unicorn.rb -E #{rails_env}"
  60. # end
  61. #
  62. # task :restart, :roles => :app do
  63. # stop
  64. # start
  65. # end
  66. end
  67. namespace :db do
  68. task :create, :roles => :app do
  69. run "cd #{current_path}; bundle exec rake db:create RAILS_ENV=#{rails_env}"
  70. end
  71. task :setup, :roles => :app do
  72. run "cp -f #{current_path}/config/deploy/#{stage}/database.yml #{shared_path}/config/database.yml"
  73. end
  74. end
  75. # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
  76. #
  77. # role :web, "your web-server here" # Your HTTP server, Apache/etc
  78. # role :app, "your app-server here" # This may be the same as your `Web` server
  79. # role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
  80. # role :db, "your slave db-server here"
  81. #
  82. # if you want to clean up old releases on each deploy uncomment this:
  83. # after "deploy:restart", "deploy:cleanup"
  84. # if you're still using the script/reaper helper you will need
  85. # these http://github.com/rails/irs_process_scripts
  86. # If you are using Passenger mod_rails uncomment this:
  87. # namespace :deploy do
  88. # task :start do ; end
  89. # task :stop do ; end
  90. # task :restart, :roles => :app, :except => { :no_release => true } do
  91. # run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  92. # end
  93. # end