Skip to content

Commit

Permalink
Add sidekiq
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Mar 31, 2016
1 parent b66cc3d commit 133704d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AllCops:
- 'script/**/*'
- 'vendor/**/*'
- 'bin/*'
- 'config/deploy.rb'

Lint/UnusedBlockArgument:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ gem 'iiif-presentation'
gem 'omniauth-cas'
gem 'sneakers'
gem 'open_uri_redirections'
gem 'sidekiq'

# PUL Assets
gem 'pul-assets', github: 'pulibrary/pul_assets'
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ GEM
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.1)
connection_pool (2.2.0)
coveralls (0.8.13)
json (~> 1.8)
simplecov (~> 0.11.0)
Expand Down Expand Up @@ -379,6 +380,7 @@ GEM
rdoc (4.2.2)
json (~> 1.4)
redcarpet (3.3.4)
redis (3.2.2)
representable (2.3.0)
uber (~> 0.0.7)
request_store (1.3.0)
Expand Down Expand Up @@ -439,6 +441,10 @@ GEM
rdoc (~> 4.0)
serverengine (1.5.11)
sigdump (~> 0.2.2)
sidekiq (4.1.1)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
redis (~> 3.2, >= 3.2.1)
sigdump (0.2.4)
signet (0.7.2)
addressable (~> 2.3)
Expand Down Expand Up @@ -561,6 +567,7 @@ DEPENDENCIES
rubocop-rspec (~> 1.3.1)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
sidekiq
simplecov (~> 0.9)
sitemap_generator
sneakers
Expand Down
16 changes: 16 additions & 0 deletions bin/sidekiq
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'sidekiq' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("sidekiq", "sidekiq")
16 changes: 16 additions & 0 deletions bin/sidekiqctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'sidekiqctl' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("sidekiq", "sidekiqctl")
16 changes: 16 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,21 @@
end
end
end
namespace :sidekiq do
task :quiet do
on roles(:app) do
# Horrible hack to get PID without having to use terrible PID files
puts capture("kill -USR1 $(sudo initctl status pom-workers | grep /running | awk '{print $NF}') || :")
end
end
task :restart do
on roles(:app) do
execute :sudo, :initctl, :restart, "pom-workers"
end
end
end
after 'deploy:reverted', 'sneakers:restart'
after 'deploy:published', 'sneakers:restart'
after 'deploy:starting', 'sidekiq:quiet'
after 'deploy:reverted', 'sidekiq:restart'
after 'deploy:published', 'sidekiq:restart'
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.active_job.queue_adapter = :sidekiq
end
8 changes: 8 additions & 0 deletions config/sidekiq.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
:concurrency: 5
staging:
:concurrency: 10
production:
:concurrency: 20
:queues:
- default

0 comments on commit 133704d

Please sign in to comment.