Redis Server Problems...Unable to Connect localhost:6379

rails
redis
circle.yml

#1

Hello Everyone,

Just joined CircleCI yesterday to trial before we get a couple of servers to do full scale testing. We don’t have much customization when it comes to our app. We use Elasticsearch and Redis along with Sidekiq 4.

App Details:
Ruby 2.2.2
Rails 4.2

Issue:
Here is my issue. Most of the time when we fire up a test in Circle it fails because it can’t find the Redis server (Please See Pics). It works maybe 1 out of 10.

Local Box:
Tests run fine

Troubleshooting:
I placed a test to see if the redis is running when our tests start to run but it doesn’t detect that the Redis server is running. Am I configuring something wrong or is this possibly a bug?


#2


#3

Just to show that redis is being detected by YML


#4

Figured it out…Had to install my own version of Redis and kick it off manually.

Here is what my final Circle YML looked like


#5

We’re seeing this too, intermittently. Some containers just don’t seem to start Redis properly in 14.04.


#6

@MatthewSuttles thanks for the solution, I think a better approach may be to just have a script that checks to make sure redis is running and if not start it up before running the tests. This will prevent the overhead of having to install redis each time.

For example, you can have a script called wait-for-redis.sh

until bash -c "sudo service redis-server status"; do
  >&2 echo "Redis not running, trying to kick start it"
  bash -c "sudo service redis-server start"
  sleep 1
done

Best,
Lev


How to run Redis 3.2
Redis flakiness
#7

Here’s a typed out version of the manual redis setup by @MatthewSuttles

dependencies:
  pre:
    - gem install bundler --pre
    - wget http://download.redis.io/releases/redis-3.2.0.tar.gz
    - tar xzf redis-3.2.0.tar.gz
    - cd redis-3.2.0 && make
  cache_directories:
    - redis-3.2.0
test:
  pre:
    - sudo service redis-server --port 6391 start


#8

We have just rolled out an update to our 14.04 image that addresses this issue.

Please let us know if you continue to see issues with redis not starting up properly.


#9