From 4368e371a469f098693ed8e376cef22be6ea2c72 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 13 Jan 2020 12:37:07 -0800 Subject: [PATCH] refactor to use REDIS_URL instead of REDIS_CACHE_STORE * pin sidekiq to version * to retain compatibility with redis 3.x (latest sidekiq requires redis 4.0+) --- .env.sample | 2 +- Gemfile | 2 +- Gemfile.lock | 2 +- config/cable.yml | 2 +- config/environments/development.rb | 2 +- config/environments/production.rb | 2 +- config/environments/staging.rb | 2 +- config/initializers/sidekiq.rb | 6 +++--- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index a68823d68..229faae69 100644 --- a/.env.sample +++ b/.env.sample @@ -28,7 +28,7 @@ LOGIN_GOV_OPENID_CERT_URL='https://idp.int.identitysandbox.gov/api/openid_connec NEW_RELIC_KEY=YOUR-NEW-RELIC-KEY-HERE # Redis cache store -REDIS_CACHE_STORE=redis://localhost:6379/1 +REDIS_URL=redis://localhost:6379/1 # For image uploads S3_AWS_ACCESS_KEY_ID= diff --git a/Gemfile b/Gemfile index 45f3319b8..98e611875 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'pg', '>= 0.18', '< 2.0' gem 'puma' gem 'rack-cors', require: 'rack/cors' gem 'sass-rails' -gem 'sidekiq' +gem 'sidekiq', '>= 4.2' gem 'uglifier' gem 'json-jwt' # Use Redis to cache Touchpoints in all envs diff --git a/Gemfile.lock b/Gemfile.lock index 1622e80b9..22900d6cb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -359,7 +359,7 @@ DEPENDENCIES rspec_junit_formatter sass-rails selenium-webdriver - sidekiq + sidekiq (>= 4.2) tzinfo-data uglifier web-console (>= 3.3.0) diff --git a/config/cable.yml b/config/cable.yml index e8ab3f3fb..9e794eb46 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,5 +7,5 @@ test: *redis production: adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + url: <%= ENV.fetch("REDIS_URL") %> channel_prefix: touchpoints_production diff --git a/config/environments/development.rb b/config/environments/development.rb index 457348de9..74a36cfc6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,7 +10,7 @@ # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. Rails.application.configure do - config.cache_store = :redis_cache_store, { url: ENV["REDIS_CACHE_STORE"] } + config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] } end # Store uploaded files on the local file system (see config/storage.yml for options) diff --git a/config/environments/production.rb b/config/environments/production.rb index 752688cf2..7244c8aae 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -59,7 +59,7 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store Rails.application.configure do - config.cache_store = :redis_cache_store, { url: ENV["REDIS_CACHE_STORE"] } + config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] } end # Use a real queuing backend for Active Job (and separate queues per environment) diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 2e3e14fd6..17856fe03 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -59,7 +59,7 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store Rails.application.configure do - config.cache_store = :redis_cache_store, { url: ENV["REDIS_CACHE_STORE"] } + config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] } end # Use a real queuing backend for Active Job (and separate queues per environment) diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index bd9de52ad..2bfccf757 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,7 +1,7 @@ Sidekiq.configure_server do |config| - config.redis = { url: ENV["REDIS_CACHE_STORE"], namespace: "touchpoints_sidekiq_#{Rails.env}" } + config.redis = { url: ENV["REDIS_URL"], namespace: "touchpoints_sidekiq_#{Rails.env}" } end Sidekiq.configure_client do |config| - config.redis = { url: ENV["REDIS_CACHE_STORE"], namespace: "touchpoints_sidekiq_#{Rails.env}" } -end \ No newline at end of file + config.redis = { url: ENV["REDIS_URL"], namespace: "touchpoints_sidekiq_#{Rails.env}" } +end