Skip to content

Commit

Permalink
Refs #28064 - add sidekiq configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej authored and tbrisker committed Oct 24, 2019
1 parent 417c21a commit bc37bac
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ gem 'deacon', '~> 1.0'
gem 'webpack-rails', '~> 0.9.8'
gem 'mail', '~> 2.7'
gem 'sshkey', '~> 1.9'
gem 'dynflow', '>= 1.2.2', '< 2.0.0'
gem 'dynflow', '>= 1.4.0', '< 2.0.0'
gem 'daemons'
gem 'bcrypt', '~> 3.1'
gem 'get_process_mem'
Expand Down
2 changes: 1 addition & 1 deletion bundler.d/sidekiq.rb → bundler.d/dynflow_sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group :sidekiq do
group :dynflow_sidekiq do
gem 'sidekiq', '~> 5.0'
gem 'gitlab-sidekiq-fetcher', require: false
end
3 changes: 3 additions & 0 deletions config/dynflow/orchestrator.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:concurrency: 1
:queues:
- dynflow_orchestrator
4 changes: 4 additions & 0 deletions config/dynflow/worker.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:concurrency: 10
:queues:
- default
- remote_execution
2 changes: 2 additions & 0 deletions config/settings.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@

#
# Configure how many workers should dynflow use to handle incoming requests.
# If you want to use sidekiq, you should configure redis_url, unless you are using default redis configuration.
#
# :dynflow:
# :pool_size: 5
# :redis_url:

#
# Set the rails cache implementation:
Expand Down
5 changes: 4 additions & 1 deletion script/dynflow-sidekiq.rb → extras/dynflow-sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
require app_file

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

require rails_env_file

redis_url = SETTINGS.dig(:dynflow, :redis_url)
Sidekiq.redis = { url: redis_url }

if Sidekiq.options[:queues].include?("dynflow_orchestrator")
::Rails.application.dynflow.executor!
elsif (Sidekiq.options[:queues] - ['dynflow_orchestrator']).any?
Expand Down
16 changes: 16 additions & 0 deletions extras/systemd/dynflow-sidekiq@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Foreman jobs daemon on sidekiq
Documentation=https://theforeman.org
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
User=foreman
TimeoutSec=90
Environment=RAILS_ENV=production
Environment=DYNFLOW_SIDEKIQ_SCRIPT=/usr/share/foreman/extras/dynflow-sidekiq.rb
WorkingDirectory=/usr/share/foreman
ExecStart=/usr/bin/sidekiq -e ${RAILS_ENV} -r ${DYNFLOW_SIDEKIQ_SCRIPT} -C /etc/foreman/dynflow/%i.yml

[Install]
WantedBy=multi-user.target

0 comments on commit bc37bac

Please sign in to comment.