deploy.rb revision ff0379a099ad656adaca6c74ecbcf4faeaf7e7ee
429N/Arequire 'bundler/capistrano'
429N/A
429N/A# RVM
429N/A$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
429N/Arequire 'rvm/capistrano'
429N/Aset :rvm_ruby_string, '1.9.3@ontohub'
429N/A
429N/Ahostname = 'ontohub.orgizm.net'
429N/A
429N/Aset :application, 'ontohub'
429N/Aset :scm, :git
429N/Aset :repository, "git@github.com:digineo/#{application}.git"
429N/Aset :deploy_to, "/srv/http/#{hostname}"
429N/A
429N/Aset :user, application
429N/Aset :use_sudo, false
429N/Aset :deploy_via, :remote_cache
429N/A
429N/Arole :app, hostname
429N/Arole :web, hostname
429N/Arole :db, hostname, :primary => true
429N/A
429N/Anamespace :deploy do
429N/A desc "Restart Application"
429N/A task :restart, :roles => :app, :except => { :no_release => true } do
429N/A run "touch #{current_path}/tmp/restart.txt"
429N/A end
429N/A
429N/A desc "Symlink shared configs and folders on each release."
429N/A task :symlink_shared, :roles => :app, :except => { :no_release => true } do
429N/A run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
429N/A run "ln -nfs #{shared_path}/config/newrelic.yml #{release_path}/config/"
429N/A end
429N/Aend
429N/A
429N/A
429N/Adef rake_command(cmd)
429N/A run "cd #{current_path} && bundle exec rake #{cmd}", :env => { :RAILS_ENV => rails_env }
429N/Aend
429N/A
429N/Anamespace :resque do
429N/A desc "Stop resque"
429N/A task :stop do
429N/A rake_command 'resque:stop'
429N/A end
429N/Aend
429N/A
429N/Anamespace :sunspot do
429N/A desc "Reindex all solr models"
429N/A task :reindex do
429N/A rake_command 'sunspot:reindex'
441N/A end
441N/Aend
441N/A
441N/A# https://makandracards.com/makandra/1431-resque-+-god-+-capistrano
441N/Anamespace :god do
429N/A def god_is_running
429N/A !capture("#{god_command} status >/dev/null 2>/dev/null || echo 'not running'").start_with?('not running')
429N/A end
429N/A
429N/A def god_command
429N/A "cd #{current_path}; bundle exec god"
429N/A end
429N/A
429N/A desc "Start god"
429N/A task :start do
429N/A run "#{god_command} -c config/god/app.rb", :env => environment = { :RAILS_ENV => rails_env }
429N/A end
429N/A
429N/A desc "Stop god"
429N/A task :stop do
429N/A if god_is_running
429N/A run "#{god_command} terminate"
429N/A end
429N/A end
429N/A
429N/A desc "Test if god is running"
441N/A task :status do
429N/A puts god_is_running ? "God is running" : "God is NOT running"
429N/A end
429N/Aend
429N/A
429N/Abefore "deploy:update", "god:stop"
429N/Abefore "deploy:update", "resque:stop"
429N/Aafter "deploy:update", "deploy:symlink_shared"
429N/Aafter "deploy:update", "god:start"
429N/Aafter :deploy, "deploy:cleanup"
429N/A
429N/A