I'm trying to dockerize a ruby project with a separate docker container for all services(web, Redis, and resque) when I initiated with code changes pointing to Redis and resque it is working as expected with the code change below:
config/initializers/resque_configs.rb
if USE_RESQUE require 'resque/server' #require 'resque/status_server' #require 'jobs/generate_result_resque_job' #require 'jobs/generate_result_priority_job' #require 'jobs/background_mailer_job' #require 'jobs/receipt_mailer_job' Resque.redis = 'redis:6379:0' Resque::Server.use(Rack::Auth::Basic) do |user, password| password == "xxxxx" && user == "xxxxx" end
When change it as below setting the environment variable and try to browse the localhost getting the an error Cannot assign requested address - connect(2) for [::1]:6379
:
if USE_RESQUE require 'resque/server' #require 'resque/status_server' #require 'jobs/generate_result_resque_job' #require 'jobs/generate_result_priority_job' #require 'jobs/background_mailer_job' #require 'jobs/receipt_mailer_job' Resque.redis = "#{ENV['REDIS_HOST'] || 'localhost'}:6379:0" Resque::Server.use(Rack::Auth::Basic) do |user, password| password == "xxxxx" && user == "xxxxx" end
Errno::EADDRNOTAVAIL in Site#index
Showing /myapp/app/views/site/index.html.erb where line #57 raised:
Cannot assign requested address - connect(2) for [::1]:6379