-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b22599f
commit a41c097
Showing
9 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace :bundler do | ||
task :install do | ||
run <<-RUN | ||
cd #{release_path} && \ | ||
bundle install --path #{shared_path}/bundle --without development test | ||
RUN | ||
end | ||
before 'deploy:finalize_update', 'bundler:install' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace :carrierwave do | ||
task :symlink, roles: :app do | ||
run "ln -nfs #{shared_path}/uploads/ #{release_path}/public/uploads" | ||
end | ||
after "deploy:finalize_update", "carrierwave:symlink" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace :logs do | ||
desc "Get ouput of env's log file" | ||
task :tail do | ||
stream "tail -n 300 -f #{current_path}/log/#{stage}.log" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace :pry do | ||
desc "Connect to console" | ||
task :console do | ||
hostname = find_servers_for_task(current_task).first | ||
exec "ssh #{hostname} -t 'source ~/.zshrc && cd #{current_path} && bundle exec bin/prys'" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'resque' | ||
|
||
set_default(:resque_worker_count, 4) | ||
|
||
# Start a worker with proper env vars and output redirection | ||
def run_worker(queue = "*", count = 1) | ||
puts "Starting #{count} worker(s) with QUEUE: #{queue}" | ||
ops = {:pgroup => true, | ||
:err => [ | ||
(File.expand_path('../../../', __FILE__) + "/log/resque_err").to_s, "a"], | ||
:out => [ | ||
(File.expand_path('../../../', __FILE__) + "/log/resque_stdout").to_s, "a"] | ||
} | ||
env_vars = {"QUEUE" => queue.to_s} | ||
count.times { | ||
## Using Kernel.spawn and Process.detach because regular system() call would | ||
## cause the processes to quit when capistrano finishes | ||
pid = spawn(env_vars, "bundle exec rake resque:work", ops) | ||
Process.detach(pid) | ||
} | ||
end | ||
|
||
namespace :resque do | ||
|
||
desc "Start resque processes" | ||
task :start do | ||
run ". ~/.zshrc && cd #{current_path} && bundle exec rake resque:start" | ||
end | ||
|
||
desc "Quit running workers" | ||
task :stop do | ||
run ". /home/#{user}/.zshrc && cd #{current_path} && bundle exec rake resque:stop" | ||
end | ||
|
||
desc "Restart running workers" | ||
task :restart do | ||
stop | ||
start | ||
end | ||
|
||
%w[stop start restart].each do |command| | ||
after "deploy:#{command}", "resque:#{command}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters