added capistrano scripts
This commit is contained in:
4
Capfile
Normal file
4
Capfile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||||
|
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||||
|
|
||||||
|
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
||||||
39
config/deploy.rb
Normal file
39
config/deploy.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
$:.unshift(File.expand_path("./lib", ENV["rvm_path"]))
|
||||||
|
set :rvm_ruby_string, "ruby-1.9.2"
|
||||||
|
require 'rvm/capistrano'
|
||||||
|
|
||||||
|
set :stages, %w(production staging)
|
||||||
|
set :default_stage, "staging"
|
||||||
|
require 'capistrano/ext/multistage'
|
||||||
|
|
||||||
|
require 'bundler/capistrano'
|
||||||
|
|
||||||
|
set :whenever_command, "bundle exec whenever"
|
||||||
|
set :whenever_environment, defer {stage}
|
||||||
|
require 'whenever/capistrano'
|
||||||
|
|
||||||
|
set :application, "danbooru"
|
||||||
|
set :repository, "git://github.com/r888888888/danbooru.git"
|
||||||
|
set :scm, :git
|
||||||
|
set :deploy_to, "/var/www/#{application}"
|
||||||
|
|
||||||
|
namespace :delayed_job do
|
||||||
|
desc "Start delayed_job process"
|
||||||
|
task :start, :roles => :app do
|
||||||
|
run "cd #{current_path}; script/delayed_job start #{rails_env}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Stop delayed_job process"
|
||||||
|
task :stop, :roles => :app do
|
||||||
|
run "cd #{current_path}; script/delayed_job stop #{rails_env}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Restart delayed_job process"
|
||||||
|
task :restart, :roles => :app do
|
||||||
|
run "cd #{current_path}; script/delayed_job restart #{rails_env}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
after "deploy:start", "delayed_job:start"
|
||||||
|
after "deploy:stop", "delayed_job:stop"
|
||||||
|
after "deploy:restart", "delayed_job:restart"
|
||||||
2
config/deploy/production.rb
Normal file
2
config/deploy/production.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
server "sonohara.donmai.us", :web, :app, :primary => true
|
||||||
|
server "hijiribe.donmai.us", :web, :app
|
||||||
1
config/deploy/staging.rb
Normal file
1
config/deploy/staging.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
server "testbooru.donmai.us", :web, :app, :primary => true
|
||||||
@@ -4,6 +4,8 @@ every 1.hour do
|
|||||||
TagSubscription.process_all
|
TagSubscription.process_all
|
||||||
end
|
end
|
||||||
|
|
||||||
every 1.hour do
|
if fetch(:whenever_environment) == "production"
|
||||||
AmazonBackup.execute
|
every 1.hour do
|
||||||
|
AmazonBackup.execute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user