Guest User

Untitled

a guest
Oct 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. $:.unshift(File.expand_path('./lib', ENV['rvm_path']))
  2. require 'rubygems'
  3. require 'bundler/capistrano'
  4. require 'rvm/capistrano'
  5.  
  6. set :application, "izinenko-ru"
  7. set :user, 'hosting_zinenkoan'
  8. set :use_sudo, false
  9. set :rails_env, 'production'
  10. set :rake, 'rake'
  11.  
  12. set :rvm_ruby_string, '1.9.2@blog'
  13. set :rvm_type, :user
  14.  
  15. role :web, "lithium.locum.ru"
  16. role :app, "lithium.locum.ru"
  17. role :db, "lithium.locum.ru", :primary => true
  18.  
  19. set :scm, :git
  20. set :deploy_to, "/home/#{user}/projects/#{application}"
  21. set :deploy_via, :remote_cache
  22. set :repository, "git://github.com/zinenko/izinenko.git"
  23. set :branch, 'master'
  24.  
  25. set :bundle_gemfile, 'Gemfile'
  26. set :bundle_dir, fetch(:shared_path) + '/bundle'
  27. set :bundle_flags, '--deployment --quiet'
  28. set :bundle_without, [ :development, :test ]
  29. set :bundle_cmd, 'LANG=ru_RU.UTF-8 bundle'
  30.  
  31. set :unicorn_rails, "#{bundle_cmd} exec unicorn_rails"
  32. set :unicorn_conf, "/etc/unicorn/#{application}.#{user}.rb"
  33. set :unicorn_pid, "/var/run/unicorn/#{application}.#{user}.pid"
  34.  
  35. after "deploy:update_code", :copy_database_config
  36.  
  37. task :copy_database_config, roles => :app do
  38. db_config = "#{shared_path}/database.yml"
  39. run "cp #{db_config} #{release_path}/config/database.yml"
  40. end
  41.  
  42. # after 'deploy:symlink' do
  43. # release_log_dir = File.join(current_path, 'log')
  44. # shared_log_dir = File.join(shared_path, 'log')
  45. # run "rm -rf #{release_log_dir}"
  46. # run "ln -sf #{shared_log_dir} #{release_log_dir}"
  47.  
  48. # sockets_dir = File.join(current_path, 'tmp', 'sockets')
  49. # run("mkdir -p #{sockets_dir}")
  50.  
  51. # run("ln -sf #{shared_path}/things " +
  52. # "#{current_path}/public/things")
  53.  
  54. # run("ln -sf #{shared_path}/database.yml " +
  55. # "#{current_path}/config/database.yml")
  56. # end
  57.  
  58. namespace :deploy do
  59. task :start do
  60. run "cd #{current_path} && #{unicorn_rails} -Dc #{unicorn_conf} -E #{rails_env}"
  61. end
  62. task :stop do
  63. run "[ -f #{unicorn_pid} ] && kill -QUIT `cat #{unicorn_pid}`"
  64. end
  65. task :restart, :roles => :app, :except => { :no_release => true } do
  66. run "cd #{current_path} && [ -f #{unicorn_pid} ] && kill -USR2 `cat #{unicorn_pid}` || #{unicorn_rails} -Dc #{unicorn_conf} -E #{rails_env}"
  67. end
  68. end
Add Comment
Please, Sign In to add comment