Skip to content
代码片段 群组 项目
提交 30adf0ce 编辑于 作者: Mehmet Emin INAC's avatar Mehmet Emin INAC
浏览文件

Merge branch 'remove-sidekiq-standalone-references' into 'master'

Remove Sidekiq standalone references from systemd examples

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97694



Merged-by: default avatarMehmet Emin INAC <minac@gitlab.com>
Approved-by: default avatarDJ Mountney <dj@gitlab.com>
Approved-by: default avatarMehmet Emin INAC <minac@gitlab.com>
Reviewed-by: default avatarJörg Behrmann <behrmann@physik.fu-berlin.de>
Co-authored-by: default avatarSean McGivern <sean@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -65,11 +65,7 @@ if ! cd "$app_root" ; then
echo "Failed to cd into $app_root, exiting!"; exit 1
fi
if [ -z "$SIDEKIQ_WORKERS" ]; then
sidekiq_pid_path="$pid_path/sidekiq.pid"
else
sidekiq_pid_path="$pid_path/sidekiq-cluster.pid"
fi
sidekiq_pid_path="$pid_path/sidekiq-cluster.pid"
### Init Script functions
......
......@@ -10,13 +10,14 @@ Type=notify
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec sidekiq --config /home/git/gitlab/config/sidekiq_queues.yml --environment production
Environment=SIDEKIQ_QUEUES=*
ExecStart=/home/git/gitlab/bin/sidekiq-cluster $SIDEKIQ_QUEUES -P /home/git/gitlab/tmp/pids/sidekiq.pid
NotifyAccess=all
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-sidekiq
Slice=gitlab.slice
WatchdogSec=10
[Install]
WantedBy=gitlab.target
......@@ -5,6 +5,8 @@ module SystemCheck
class SidekiqCheck < BaseCheck
set_name 'Sidekiq:'
SYSTEMD_UNIT_PATH = '/run/systemd/units/invocation:gitlab-sidekiq.service'
def multi_check
check_sidekiq_running
only_one_sidekiq_running
......@@ -37,9 +39,9 @@ def only_one_sidekiq_running
$stdout.print 'Number of Sidekiq processes (cluster/worker) ... '
if (cluster_count == 1 && worker_count > 0) || (cluster_count == 0 && worker_count == 1)
if cluster_count == 1 && worker_count >= 1
$stdout.puts "#{cluster_count}/#{worker_count}".color(:green)
elsif File.symlink?('/run/systemd/units/invocation:gitlab-sidekiq.service')
elsif File.symlink?(SYSTEMD_UNIT_PATH)
$stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
try_fixing_it(
'sudo systemctl restart gitlab-sidekiq.service'
......
......@@ -37,45 +37,53 @@ def expect_check_output(matcher)
)
end
it 'succeeds when one cluster process and one or more worker processes are running' do
stub_ps_output <<~PS
root 2193947 0.9 0.1 146564 18104 ? Ssl 17:34 0:00 ruby bin/sidekiq-cluster * -P ...
root 2193955 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
root 2193956 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
PS
expect_check_output <<~OUTPUT
Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/2
OUTPUT
end
# TODO: Running without a cluster is deprecated and will be removed in GitLab 14.0
# https://gitlab.com/gitlab-org/gitlab/-/issues/323225
context 'when running without a cluster' do
it 'fails when more than one worker process is running' do
context 'when only a worker process is running' do
before do
stub_ps_output <<~PS
root 2193955 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
root 2193956 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
PS
end
expect_check_output include(
'Running? ... yes',
'Number of Sidekiq processes (cluster/worker) ... 0/2',
'Please fix the error above and rerun the checks.'
)
it 'fails with the right message for systemd' do
allow(File).to receive(:symlink?).with(described_class::SYSTEMD_UNIT_PATH).and_return(true)
expect_check_output <<~OUTPUT
Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 0/1
Try fixing it:
sudo systemctl restart gitlab-sidekiq.service
Please fix the error above and rerun the checks.
OUTPUT
end
it 'succeeds when one worker process is running' do
stub_ps_output <<~PS
root 2193955 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
PS
it 'fails with the right message for sysvinit' do
allow(File).to receive(:symlink?).with(described_class::SYSTEMD_UNIT_PATH).and_return(false)
allow(subject).to receive(:gitlab_user).and_return('git')
expect_check_output <<~OUTPUT
Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 0/1
Try fixing it:
sudo service gitlab stop
sudo pkill -u git -f sidekiq
sleep 10 && sudo pkill -9 -u git -f sidekiq
sudo service gitlab start
Please fix the error above and rerun the checks.
OUTPUT
end
end
it 'succeeds when one cluster process and one or more worker processes are running' do
stub_ps_output <<~PS
root 2193947 0.9 0.1 146564 18104 ? Ssl 17:34 0:00 ruby bin/sidekiq-cluster * -P ...
root 2193955 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
root 2193956 92.2 3.1 4675972 515516 ? Sl 17:34 0:13 sidekiq 5.2.9 ...
PS
expect_check_output <<~OUTPUT
Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/2
OUTPUT
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册