Last active
August 29, 2015 14:15
-
-
Save gabeodess/1b13e0f8b0f69fda9122 to your computer and use it in GitHub Desktop.
Sidekiq on Heroku
This file contains hidden or 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
# = General ================================================================== | |
port 10081 | |
databases 1 | |
loglevel notice | |
logfile /mnt/redis.330229.log | |
# = Security ================================================================= | |
requirepass xxx | |
# = Limits =================================================================== | |
maxmemory 5242880 | |
maxmemory-policy volatile-lru | |
maxmemory-samples 3 | |
maxclients 10 | |
timeout 150 | |
# = Persistence ============================================================== | |
dir /home/redis/10081 | |
rdbcompression yes | |
dbfilename dump.rdb | |
save 900 1 | |
save 300 10 | |
save 60 10000 | |
# = Advanced Config ========================================================== | |
hash-max-ziplist-entries 64 | |
hash-max-ziplist-value 512 | |
list-max-ziplist-entries 512 | |
list-max-ziplist-value 64 | |
set-max-intset-entries 512 | |
zset-max-ziplist-entries 128 | |
zset-max-ziplist-value 64 | |
activerehashing yes | |
# = LUA Scripting ============================================================ | |
lua-time-limit 5000 | |
# = Client Limits ============================================================ | |
client-output-buffer-limit normal 0 0 0 | |
client-output-buffer-limit slave 256mb 64mb 60 | |
client-output-buffer-limit pubsub 32mb 8mb 60 |
This file contains hidden or 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
--- | |
:concurrency: 1 | |
:queues: | |
- default | |
- mailers |
This file contains hidden or 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
run_sidekiq_in_this_thread = ENV['SIDEKIQ_CONCURRENCY'] | |
worker_processes Integer(ENV["WEB_CONCURRENCY"] || (run_sidekiq_in_this_thread ? 2 : 3)) | |
timeout 15 | |
preload_app true | |
before_fork do |server, worker| | |
Signal.trap 'TERM' do | |
puts 'Unicorn master intercepting TERM and sending myself QUIT instead' | |
Process.kill 'QUIT', Process.pid | |
end | |
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! | |
if run_sidekiq_in_this_thread | |
@resque_pid ||= spawn("bundle exec sidekiq -c 1 -C config/sidekiq.yml") | |
Rails.logger.info('Spawned sidekiq #{@request_pid}') | |
end | |
end | |
after_fork do |server, worker| | |
Signal.trap 'TERM' do | |
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' | |
end | |
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection | |
end |
This file contains hidden or 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
2015-02-11T17:51:49.458277+00:00 app[web.1]: Started GET "/sidekiq/queues" for 71.192.31.1 at 2015-02-11 17:51:49 +0000 | |
2015-02-11T17:51:49.479546+00:00 app[web.1]: Redis::CommandError - ERR max number of clients reached: | |
2015-02-11T17:51:49.479552+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:110:in `call' | |
2015-02-11T17:51:49.479554+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:92:in `block in connect' | |
2015-02-11T17:51:49.479556+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:273:in `with_reconnect' | |
2015-02-11T17:51:49.479557+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:90:in `connect' | |
2015-02-11T17:51:49.479559+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:337:in `ensure_connected' | |
2015-02-11T17:51:49.479560+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/redis-3.2.0/lib/redis/client.rb:204:in `block in process' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error seems to show up if you do not have a sidekiq process running with the
-e production
flag. Also, I forgot to set my SIDEKIQ_CONCURRENCY flag. Once I added those two flags, I now have Sidekiq running along RedisToGo nano on a single Heroku dyno!Changed the command in unicorn.rb to: