Sidekiq deploy to multiple environments
In your initializers/sidekiq.rb file, you specify the Redis queue all environments boot up with.
For mine it is:
redisServer = "localhost"
Sidekiq.configure_server do |config|
config.redis = { :url => 'redis://' + redisServer + ':6379/0' }
end
If you want each environment to process from separate queues, you can have specific sidekiq.rb files in the environments folder for each environment. Each with different redis servers.
Specify environment specific configuration with Sidekiq and plain Ruby
To support multiple environments in sidekiq - look at this: Sidekiq configuration for multiple environments
For your specific question - how to implement initializers in pure ruby, you can put them anywhere you want, but you need to require
them in your main file.
If you want to be a little more sophisticated (or you have a lot of initializers), you can require all of them under a folder (initializers/
for example), and then require anything under that folder:
Dir["/initializers/*.rb"].each {|file| require file }
How can I specify different concurrency queues for sidekiq configuration?
Concurrency is a property of the Sidekiq process, representing how many threads it spins up. You can't have one Sidekiq process operating at two different concurrencies; however, you could spin up two Sidekiq processes with separate config files:
bin/sidekiq -C config/sidekiq_one.yml
bin/sidekiq -C config/sidekiq_two.yml
However, depending on your motivations here, you're likely better off just using one Sidekiq process and ordering your queues within it by priority. That way, no workers in one process are sitting idle while the other process's queue is growing. Though depending on your situation, e.g. if the second queue's jobs are few but very important, such a solution does make sense.
Related Topics
Are There Good Reasons for 'Private' to Work the Way It Does in Ruby
How to Write a Web Scraper in Ruby
Using Rails to Consume Web Services/Apis
Rails: Custom Text for Rails Form_For Label
Ruby Mixins: Extend and Include
How to Select Option in Drop Down Using Capybara
How to Set an Attr_Accessor for a Dynamic Instance Variable
Restoring Rails 3's Bundle Install Path... It's Now Install in My Root
How to Check to See If a File Exists (On the Remote Server) in Capistrano
How to Redefine a Ruby Constant Without Warning
Combinatory Method Like Tap, But Able to Return a Different Value
Difference Between Map and Each
Ruby SASS, Unable to Resolve Dependancies
Count the Number of Lines in a File Without Reading Entire File into Memory
Having Trouble Installing Any Ruby 1.9.X (With Rbenv) on MAC Osx Due to Psych Yaml Parse Errors