PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/config/deploy.rb

https://bitbucket.org/tommyvyo/profiletool
Ruby | 62 lines | 49 code | 13 blank | 0 comment | 2 complexity | 5b04d0d282907326a2e1c55b4f0236b9 MD5 | raw file
  1. load 'deploy/assets'
  2. require "bundler/capistrano"
  3. set :application, "thomaswebsite"
  4. set :repository, "git@bitbucket.org:tommyvyo/profiletool.git"
  5. set :branch, :master
  6. set :deploy_to, '/var/www/rails/thomaswebsite'
  7. set :deploy_via, :remote_cache
  8. set :scm, :git
  9. set :user, "app"
  10. set :default_environment, {
  11. 'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
  12. }
  13. set :rails_env, :production
  14. set :unicorn_binary, "/home/app/.rbenv/shims/unicorn"
  15. set :unicorn_config, "#{current_path}/config/unicorn.rb"
  16. set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
  17. ssh_options[:forward_agent] = true
  18. default_run_options[:pty] = true
  19. role :web, "thomasvendetta.com" # Your HTTP server, Apache/etc
  20. role :app, "thomasvendetta.com" # This may be the same as your `Web` server
  21. role :db, "thomasvendetta.com", :primary => true # This is where Rails migrations will run
  22. set :use_sudo, false
  23. after "deploy", "deploy:migrate"
  24. namespace :deploy do
  25. task :start, :roles => :app, :except => { :no_release => true } do
  26. run "cd #{current_path} && #{try_sudo} bundle exec unicorn -c #{unicorn_config} -E #{rails_env} -D"
  27. end
  28. task :stop, :roles => :app, :except => { :no_release => true } do
  29. run "#{try_sudo} kill `cat #{unicorn_pid}`"
  30. end
  31. task :graceful_stop, :roles => :app, :except => { :no_release => true } do
  32. run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
  33. end
  34. task :reload, :roles => :app, :except => { :no_release => true } do
  35. run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
  36. end
  37. task :restart, :roles => :app, :except => { :no_release => true } do
  38. stop
  39. start
  40. end
  41. desc "tail production log files"
  42. task :tail_logs, :roles => :app do
  43. run "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
  44. puts # for an extra line break before the host name
  45. puts "#{channel[:host]}: #{data}"
  46. break if stream == :err
  47. end
  48. end
  49. end