This commit is contained in:
albert
2011-08-29 14:49:34 -04:00
parent 03a5fff219
commit 51e8b57a3d
3 changed files with 64 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
$:.unshift(File.expand_path("./lib", ENV["rvm_path"]))
set :rvm_ruby_string, "ruby-1.9.2"
set :rvm_bin_path, "/usr/local/rvm/bin"
require 'rvm/capistrano'
set :stages, %w(production staging)
@@ -15,8 +16,30 @@ require 'whenever/capistrano'
set :application, "danbooru"
set :repository, "git://github.com/r888888888/danbooru.git"
set :scm, :git
set :user, "danbooru"
set :deploy_to, "/var/www/#{application}"
default_run_options[:pty] = true
desc "Change ownership of common directory to user"
task :reset_ownership_of_common_directory do
sudo "chown -R #{user}:#{user} /var/www/danbooru"
end
namespace :deploy do
namespace :web do
desc "Present a maintenance page to visitors."
task :disable do
run "mv #{current_path}/public/maintenance2.html #{current_path}/public/maintenance.html"
end
desc "Makes the application web-accessible again."
task :enable do
run "mv #{current_path}/public/maintenance.html #{current_path}/public/maintenance2.html"
end
end
end
namespace :delayed_job do
desc "Start delayed_job process"
task :start, :roles => :app do
@@ -34,6 +57,8 @@ namespace :delayed_job do
end
end
after "deploy:setup", "reset_ownership_of_common_directory"
after "deploy:start", "delayed_job:start"
after "deploy:stop", "delayed_job:stop"
after "deploy:restart", "delayed_job:restart"