Commit 180ac475 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'osw-move-sidekiq-cluster-to-core' into 'master'

Move sidekiq-cluster script to Core (bin folder)

See merge request gitlab-org/gitlab!26703
parents 05f63ab6 ae9fc7f6
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'optparse' require 'optparse'
require_relative '../../lib/gitlab' require_relative '../lib/gitlab'
require_relative '../../lib/gitlab/utils' require_relative '../lib/gitlab/utils'
require_relative '../../lib/gitlab/sidekiq_config/cli_methods' require_relative '../lib/gitlab/sidekiq_config/cli_methods'
require_relative '../lib/gitlab/sidekiq_cluster' require_relative '../lib/gitlab/sidekiq_cluster'
require_relative '../lib/gitlab/sidekiq_cluster/cli' require_relative '../lib/gitlab/sidekiq_cluster/cli'
......
---
title: Move sidekiq-cluster script to Core
merge_request: 26703
author:
type: other
...@@ -311,11 +311,11 @@ If you experience a problem, you should contact GitLab support. Use the command ...@@ -311,11 +311,11 @@ If you experience a problem, you should contact GitLab support. Use the command
line at your own risk. line at your own risk.
For debugging purposes, you can start extra Sidekiq processes by using the command For debugging purposes, you can start extra Sidekiq processes by using the command
`/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster`. This command `/opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster`. This command
takes arguments using the following syntax: takes arguments using the following syntax:
```shell ```shell
/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster [QUEUE,QUEUE,...] [QUEUE, ...] /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster [QUEUE,QUEUE,...] [QUEUE, ...]
``` ```
Each separate argument denotes a group of queues that have to be processed by a Each separate argument denotes a group of queues that have to be processed by a
...@@ -333,14 +333,14 @@ For example, say you want to start 2 extra processes: one to process the ...@@ -333,14 +333,14 @@ For example, say you want to start 2 extra processes: one to process the
done as follows: done as follows:
```shell ```shell
/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit post_receive /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster process_commit post_receive
``` ```
If you instead want to start one process processing both queues, you'd use the If you instead want to start one process processing both queues, you'd use the
following syntax: following syntax:
```shell ```shell
/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit,post_receive /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster process_commit,post_receive
``` ```
If you want to have one Sidekiq process dealing with the `process_commit` and If you want to have one Sidekiq process dealing with the `process_commit` and
...@@ -348,7 +348,7 @@ If you want to have one Sidekiq process dealing with the `process_commit` and ...@@ -348,7 +348,7 @@ If you want to have one Sidekiq process dealing with the `process_commit` and
you'd use the following: you'd use the following:
```shell ```shell
/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit,post_receive gitlab_shell /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster process_commit,post_receive gitlab_shell
``` ```
### Monitoring the `sidekiq-cluster` command ### Monitoring the `sidekiq-cluster` command
...@@ -380,7 +380,7 @@ file is written, but this can be changed by passing the `--pidfile` option to ...@@ -380,7 +380,7 @@ file is written, but this can be changed by passing the `--pidfile` option to
`sidekiq-cluster`. For example: `sidekiq-cluster`. For example:
```shell ```shell
/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster --pidfile /var/run/gitlab/sidekiq_cluster.pid process_commit /opt/gitlab/embedded/service/gitlab-rails/bin/sidekiq-cluster --pidfile /var/run/gitlab/sidekiq_cluster.pid process_commit
``` ```
Keep in mind that the PID file will contain the PID of the `sidekiq-cluster` Keep in mind that the PID file will contain the PID of the `sidekiq-cluster`
......
...@@ -83,7 +83,7 @@ module Gitlab ...@@ -83,7 +83,7 @@ module Gitlab
end end
if dryrun if dryrun
puts "Sidekiq command: #{cmd}" puts "Sidekiq command: #{cmd}" # rubocop:disable Rails/Output
return return
end end
......
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
CommandError = Class.new(StandardError) CommandError = Class.new(StandardError)
def initialize(log_output = STDERR) def initialize(log_output = STDERR)
require_relative '../../../../lib/gitlab/sidekiq_logging/json_formatter' require_relative '../../../lib/gitlab/sidekiq_logging/json_formatter'
# As recommended by https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency # As recommended by https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency
@max_concurrency = 50 @max_concurrency = 50
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe 'ee/bin/sidekiq-cluster' do describe 'bin/sidekiq-cluster' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
context 'when selecting some queues and excluding others' do context 'when selecting some queues and excluding others' do
...@@ -13,7 +13,7 @@ describe 'ee/bin/sidekiq-cluster' do ...@@ -13,7 +13,7 @@ describe 'ee/bin/sidekiq-cluster' do
with_them do with_them do
it 'runs successfully', :aggregate_failures do it 'runs successfully', :aggregate_failures do
cmd = %w[ee/bin/sidekiq-cluster --dryrun] + args cmd = %w[bin/sidekiq-cluster --dryrun] + args
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s) output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
...@@ -31,14 +31,14 @@ describe 'ee/bin/sidekiq-cluster' do ...@@ -31,14 +31,14 @@ describe 'ee/bin/sidekiq-cluster' do
%w[--experimental-queue-selector *] %w[--experimental-queue-selector *]
].each do |args| ].each do |args|
it "runs successfully with `#{args}`", :aggregate_failures do it "runs successfully with `#{args}`", :aggregate_failures do
cmd = %w[ee/bin/sidekiq-cluster --dryrun] + args cmd = %w[bin/sidekiq-cluster --dryrun] + args
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s) output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
expect(status).to be(0) expect(status).to be(0)
expect(output).to include('"bundle", "exec", "sidekiq"') expect(output).to include('"bundle", "exec", "sidekiq"')
expect(output).to include('-qdefault,1') expect(output).to include('-qdefault,1')
expect(output).to include('-qcronjob:update_all_mirrors,1') expect(output).to include('-qcronjob:ci_archive_traces_cron,1')
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment