Keine Beschreibung http://j1x-huginn.herokuapp.com

deploy.rb 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # This is an example Capistrano deployment script for Huginn. It
  2. # assumes you're running on an Ubuntu box and want to use Foreman,
  3. # Upstart, and Unicorn.
  4. default_run_options[:pty] = true
  5. set :application, "huginn"
  6. set :deploy_to, "/home/you/app"
  7. set :user, "you"
  8. set :use_sudo, false
  9. set :scm, :git
  10. set :rails_env, 'production'
  11. set :repository, "git@github.com:you/huginn-private.git"
  12. set :branch, "master"
  13. set :deploy_via, :remote_cache
  14. set :keep_releases, 5
  15. set :bundle_without, [:development]
  16. server "yourdomain.com", :app, :web, :db, :primary => true
  17. set :sync_backups, 3
  18. before 'deploy:restart', 'deploy:migrate'
  19. after 'deploy', 'deploy:cleanup'
  20. set :bundle_without, [:development, :test]
  21. after 'deploy:update_code', 'deploy:symlink_configs'
  22. after 'deploy:update', 'foreman:export'
  23. after 'deploy:update', 'foreman:restart'
  24. namespace :deploy do
  25. desc 'Link the .env environment and Procfile from shared/config into the new deploy directory'
  26. task :symlink_configs, :roles => :app do
  27. run <<-CMD
  28. cd #{latest_release} && ln -nfs #{shared_path}/config/.env #{latest_release}/.env
  29. CMD
  30. run <<-CMD
  31. cd #{latest_release} && ln -nfs #{shared_path}/config/Procfile #{latest_release}/Procfile
  32. CMD
  33. end
  34. end
  35. namespace :foreman do
  36. desc "Export the Procfile to Ubuntu's upstart scripts"
  37. task :export, :roles => :app do
  38. run "cd #{latest_release} && rvmsudo bundle exec foreman export upstart /etc/init -a #{application} -u #{user} -l #{deploy_to}/upstart_logs"
  39. end
  40. desc 'Start the application services'
  41. task :start, :roles => :app do
  42. sudo "sudo start #{application}"
  43. end
  44. desc 'Stop the application services'
  45. task :stop, :roles => :app do
  46. sudo "sudo stop #{application}"
  47. end
  48. desc 'Restart the application services'
  49. task :restart, :roles => :app do
  50. run "sudo start #{application} || sudo restart #{application}"
  51. end
  52. end
  53. # If you want to use rvm on your server and have it maintained by Capistrano, uncomment these lines:
  54. # set :rvm_ruby_string, '1.9.3-p286@huginn'
  55. # set :rvm_type, :user
  56. # before 'deploy', 'rvm:install_rvm'
  57. # before 'deploy', 'rvm:install_ruby'
  58. # require "rvm/capistrano"
  59. # Load Capistrano additions
  60. Dir[File.expand_path("../../lib/capistrano/*.rb", __FILE__)].each{|f| load f }
  61. require "bundler/capistrano"
  62. load 'deploy/assets'