Created
September 27, 2019 08:31
-
-
Save ezr-ondrej/48d687f214c244494965be1aaec340d4 to your computer and use it in GitHub Desktop.
Dynflow by sidekiq start
This file contains 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
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) | |
require rails_env_file | |
# require 'dynflow/executors/sidekiq/core' | |
role = nil | |
if Sidekiq.options[:queues].include?("dynflow_orchestrator") | |
::Rails.application.dynflow.config.world_config.executor = ->(world, config) { Dynflow::Executors::Sidekiq::Core } | |
::Rails.application.dynflow.executor! | |
role = :orchestrator | |
elsif (Sidekiq.options[:queues] - ['dynflow_orchestrator']).any? | |
require 'sidekiq-reliable-fetch' | |
::Rails.application.dynflow.config.remote = true | |
Sidekiq.configure_server do |config| | |
require 'sidekiq-reliable-fetch' | |
# Use semi-reliable fetch | |
# for details see https://gitlab.com/gitlab-org/sidekiq-reliable-fetch/blob/master/README.md | |
config.options[:semi_reliable_fetch] = true | |
Sidekiq::ReliableFetch.setup_reliable_fetch!(config) | |
end | |
role = :worker | |
end | |
::Rails.application.dynflow.config.world_config.process_role = role | |
::Rails.application.dynflow.initialize! | |
world_id = ::Rails.application.dynflow.world.id | |
STDOUT.puts("Everything ready for world: #{world_id}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment