Skip to content

Commit

Permalink
Add sidekiq loader file
Browse files Browse the repository at this point in the history
From root of foreman checkout run something along the lines of

bundle exec sidekiq -r ../foreman-tasks/bin/sidekiq-loader.rb -q default
  • Loading branch information
adamruzicka committed Jul 22, 2019
1 parent 8566a69 commit deb4c6a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bin/sidekiq-loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rails_root = Dir.pwd

app_file = File.expand_path('./config/application', rails_root)
require app_file

rails_env_file = File.expand_path('./config/environment.rb', rails_root)

::Rails.application.dynflow.config.process_role =
if Sidekiq.options[:queues].include?("dynflow_orchestrator")
::Rails.application.dynflow.executor!
:orchestrator
elsif (Sidekiq.options[:queues] - ['dynflow_orchestrator']).any?
::Rails.application.dynflow.config.remote = true
:worker
end

require rails_env_file
::Rails.application.dynflow.initialize!
world_id = ::Rails.application.dynflow.world.id
STDOUT.puts("Everything ready for world: #{world_id}")

0 comments on commit deb4c6a

Please sign in to comment.