Skip to content

Instantly share code, notes, and snippets.

View natedrouin's full-sized avatar

Nate Drouin natedrouin

View GitHub Profile
@natedrouin
natedrouin / production.rb
Created July 19, 2013 02:53
config/deploy/production.rb
server "EC2ADDRESS.compute-1.amazonaws.com", :web, :app, :db, :background, :primary => true
server "EC2-1ADDRESS.compute-1.amazonaws.com", :web, :app, :worker
@natedrouin
natedrouin / resque.rake
Created July 19, 2013 02:57
lib/tasks/resque.rake
require 'resque/tasks'
task "resque:setup" => :environment
task "resque:work"
namespace :resque do
task :setup => :environment
desc "Restart running workers"
task :restart_workers => :environment do
@natedrouin
natedrouin / deploy.rb
Created July 19, 2013 03:06
config/deploy.rb
after "deploy:restart", "deploy:restart_workers"
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && bundle exec #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
cmd += "['#{rake_args.join("','")}']" unless rake_args.empty?
run cmd
set :rakefile, nil if exists?(:rakefile)
end