summaryrefslogtreecommitdiff
path: root/lib/system_check
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
commit983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch)
treeb153cd387c14ba23bd5a07514c7c01fddf6a78a0 /lib/system_check
parenta2bddee2cdb38673df0e004d5b32d9f77797de64 (diff)
downloadgitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'lib/system_check')
-rw-r--r--lib/system_check/app/redis_version_check.rb33
1 files changed, 26 insertions, 7 deletions
diff --git a/lib/system_check/app/redis_version_check.rb b/lib/system_check/app/redis_version_check.rb
index da695cc9272..aca2972f287 100644
--- a/lib/system_check/app/redis_version_check.rb
+++ b/lib/system_check/app/redis_version_check.rb
@@ -1,24 +1,43 @@
# 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}?"
+ MIN_REDIS_VERSION = '3.2.0'
+ 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'
+ 'doc/administration/high_availability/redis.md#provide-your-own-redis-instance-core-only'
)
fix_and_rerun
end