Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Sidekiq Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) on docker-compose

$
0
0

I'm trying to run sidekiq worker with Rails. When I try to docker-compose up worker I get the following error:

worker_1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:332:in `rescue in establish_connection'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:318:in `establish_connection'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:94:in `block in connect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:280:in `with_reconnect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:93:in `connect'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:351:in `ensure_connected'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:208:in `block in process'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:293:in `logging'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:207:in `process'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:113:in `call'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:211:in `block in info'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `block in synchronize'worker_1 | /usr/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `synchronize'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/redis-3.2.2/lib/redis.rb:210:in `info'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:71:in `block in run'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq.rb:84:in `block in redis'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64:in `block (2 levels) in with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `handle_interrupt'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `block in with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `handle_interrupt'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `with'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq.rb:81:in `redis'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:68:in `run'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/bin/sidekiq:13:in `<top (required)>'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `load'worker_1 | /home/app/Nyvur/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>'nyvur_worker_1 exited with code 1

Here's my docker-compose file:

web: &app_base  build: .  ports:    - "80:80"  volumes:    - .:/Nyvur  command: /usr/bin/start_server.sh  links:    - postgres    - mongo    - redis  environment: &app_environment    SIDEKIQ_CONCURRENCY: 50    SIDEKIQ_TIMEOUT: 10    ENABLE_DEBUG_SERVER: true    RACK_ENV: production    RAILS_ENV: productionworker:  build: .  volumes:    - .:/Nyvur  ports: []  links:    - postgres    - mongo    - redis  command: bundle exec sidekiq -c 50postgres:  image: postgres:9.1  ports:    - "5432:5432"  environment:    LC_ALL: C.UTF-8    POSTGRES_DB: Nyvur_production    POSTGRES_USER: postgres    POSTGRES_PASSWORD: 3x1mpl3mongo:  image: mongo:3.0.7  ports:    - "27017:27017"redis:  image: redis  ports:    - "6379:6379"

My Dockerfile:

FROM phusion/passenger-customizableMAINTAINER VodkaMD <support@nyvur.com>ENV RACK_ENV="production" RAILS_ENV="production"SECRET_KEY_BASE="e09afa8b753cb175bcef7eb5f737accd02a4c16d9b6e5d475943605abd4277cdf47c488812d21d9c7117efd489d876f34be52f7ef7e88b21759a079339b198ce"ENV HOME /rootCMD ["/sbin/my_init"]RUN /pd_build/utilities.shRUN /pd_build/ruby2.2.shRUN /pd_build/python.shRUN /pd_build/nodejs.shRUN /pd_build/redis.shRUN /pd_build/memcached.shRUN apt-get update && apt-get install -y vim nano dialog net-tools build-essential wget libpq-dev gitRUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*# RUN mkdir /etc/nginx/ssl# RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crtRUN rm -f /etc/service/nginx/downRUN rm -f /etc/service/redis/downRUN rm -f /etc/service/sshd/downRUN rm -f /etc/service/memcached/downWORKDIR /tmpADD Gemfile /tmp/ADD Gemfile.lock /tmp/RUN mkdir /home/app/NyvurADD . /home/app/NyvurRUN chown -R app:app /home/app/NyvurWORKDIR /home/app/NyvurRUN bundle install --deploymentRUN bundle exec rake assets:precompileRUN rm /etc/nginx/sites-enabled/defaultCOPY config/nginx/nginx_nyvur.conf /etc/nginx/sites-enabled/nginx_nyvur.confADD config/nginx/postgres-env.conf /etc/nginx/main.d/postgres-env.confADD config/nginx/rails-env.conf /etc/nginx/main.d/rails-env.confADD config/nginx/start_server.sh /usr/bin/start_server.shRUN chmod +x /usr/bin/start_server.shRUN mkdir -p /home/app/Nyvur/tmp/pidsRUN mkdir -p /home/app/Nyvur/tmp/socketsRUN mkdir -p /home/app/Nyvur/logRUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*EXPOSE 80 443 9292

I've tried different configurations, I've checked other builds, but the problem still persists, So far, Sidekiq runs well outside of Docker.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>