From d83da596be54a211019d60a99107a01272505843 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 15 Feb 2022 12:25:22 -0300 Subject: [PATCH] FIX: Redis may not be availiable on Redis initializer (#15955) --- README.md | 2 +- config/initializers/001-redis.rb | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1537e2e7448..dae3839f011 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To get your environment setup, follow the community setup guide for your operati If you're familiar with how Rails works and are comfortable setting up your own environment, you can also try out the [**Discourse Advanced Developer Guide**](docs/DEVELOPER-ADVANCED.md), which is aimed primarily at Ubuntu and macOS environments. -Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.0+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first! +Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.2+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first! ## Setting up Discourse diff --git a/config/initializers/001-redis.rb b/config/initializers/001-redis.rb index 574eb092ea8..a71bb7f7e24 100644 --- a/config/initializers/001-redis.rb +++ b/config/initializers/001-redis.rb @@ -9,7 +9,11 @@ end # upgrade to Sidekiq 6.1 Redis.exists_returns_integer = true -if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0") - STDERR.puts "Discourse requires Redis 6.2.0 or up" - exit 1 +begin + if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0") + STDERR.puts "Discourse requires Redis 6.2.0 or up" + exit 1 + end +rescue Redis::CannotConnectError + STDERR.puts "Couldn't connect to Redis" end