Commit 8bc6b632 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Raise warning if Redis version < 4.0.0

Signed-off-by: default avatarBalasankar "Balu" C <balasankarc@autistici.org>
parent 6c3a813b
# frozen_string_literal: true
require 'redis'
module SystemCheck
module App
class RedisVersionCheck < SystemCheck::BaseCheck
MIN_REDIS_VERSION = '2.8.0'
set_name "Redis version >= #{MIN_REDIS_VERSION}?"
RECOMMENDED_REDIS_VERSION = '4.0.0'
set_name "Redis version >= #{RECOMMENDED_REDIS_VERSION}?"
@custom_error_message = ''
def check?
redis_version = run_command(%w(redis-cli --version))
redis_version = redis_version.try(:match, /redis-cli (\d+\.\d+\.\d+)/)
redis_version = Gitlab::Redis::Queues.with do |redis|
redis.info['redis_version']
end
status = true
if !redis_version
@custom_error_message = "Could not retrieve the Redis version. Please check if your settings are correct"
status = false
elsif Gem::Version.new(redis_version) < Gem::Version.new(MIN_REDIS_VERSION)
@custom_error_message = "Your Redis version #{redis_version} is not supported anymore. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
status = false
elsif Gem::Version.new(redis_version) < Gem::Version.new(RECOMMENDED_REDIS_VERSION)
@custom_error_message = "Support for your Redis version #{redis_version} has been deprecated and will be removed soon. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
status = false
end
redis_version && (Gem::Version.new(redis_version[1]) > Gem::Version.new(MIN_REDIS_VERSION))
status
end
def show_error
try_fixing_it(
"Update your redis server to a version >= #{MIN_REDIS_VERSION}"
@custom_error_message
)
for_more_information(
'gitlab-public-wiki/wiki/Trouble-Shooting-Guide in section sidekiq'
......
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