From 2e3b7dee1e8bbc7364e962e27e4abbfa7f682d78 Mon Sep 17 00:00:00 2001 From: Janakas <janakas@coding4.coffee> Date: Fri, 29 Dec 2017 19:31:32 +0100 Subject: [PATCH] Check for a running redis in script/server Fixes #5267 closes #7685 --- Changelog.md | 1 + script/server | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 50c2380204..7a94f3c1e7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ ## Bug fixes ## Features +* Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685) # 0.7.2.0 diff --git a/script/server b/script/server index 46b492353a..bcfda9e2d2 100755 --- a/script/server +++ b/script/server @@ -108,7 +108,8 @@ vars=$(bin/bundle exec ruby ./script/get_config.rb \ workers=server.sidekiq_workers \ chat=chat.enabled \ chat_server=chat.server.enabled \ - chat_bosh_proxy=chat.server.bosh.proxy + chat_bosh_proxy=chat.server.bosh.proxy \ + redis_url=environment.redis ) on_failure "Couldn't parse config/diaspora.yml!" eval "$vars" @@ -158,6 +159,19 @@ application, run: bin/rake assets:precompile" fi +# Check if redis is running +if [ "$single_process_mode" = "false" ] +then + if [ -n "$redis_url" ] + then + redis_param="url: '$redis_url'" + fi + if [ "$(bin/bundle exec ruby -e "require 'redis'; puts Redis.new($redis_param).ping" 2> /dev/null)" != "PONG" ] + then + fatal "Can't connect to redis. Please check if it's running and if environment.redis is configured correctly in config/diaspora.yml." + fi +fi + # Check for old curl versions (see https://github.com/diaspora/diaspora/issues/4202) if [ `curl -V | grep AsynchDNS | wc -l` -ne 1 ] then -- GitLab