From 00d90f7692ec8aa27532ca684479d98fe5f997e0 Mon Sep 17 00:00:00 2001 From: "James R. Griffin III" <1443986+jrgriffiniii@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:57:05 -0400 Subject: [PATCH] Ensuring that the ActionCable is mounted for the staging, qa, and production environments. Ensuring that ActionCable uses Redis (#862) Co-authored-by: Hector Correa --- config/application.rb | 1 + config/cable.yml | 15 ++++++++++++--- config/environments/production.rb | 5 ++--- config/environments/qa.rb | 5 ++--- config/environments/staging.rb | 5 ++--- config/routes.rb | 2 ++ 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/application.rb b/config/application.rb index d9f991f6d..6aeb7b8b6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -33,5 +33,6 @@ class Application < Rails::Application Warden::Manager.before_logout do |user, _auth, _opts| user.terminate_mediaflux_session end + config.action_cable.mount_path = "/cable/" end end diff --git a/config/cable.yml b/config/cable.yml index 328839ebc..949fe0855 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -1,10 +1,19 @@ +--- development: adapter: async test: adapter: test -production: +staging: &staging adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: tiger_data_app_production + url: redis://<%= ENV['TIGER_DATA_REDIS_URL'] || 'localhost' %>:<%= ENV['TIGER_DATA_REDIS_PORT'] || '6379' %>/<%= ENV['TIGER_DATA_REDIS_DB'] || 0 %> + channel_prefix: tigerdata_staging + +qa: + <<: *staging + channel_prefix: tigerdata_qa + +production: + <<: *staging + channel_prefix: tigerdata_production diff --git a/config/environments/production.rb b/config/environments/production.rb index 0f53225d9..04e403534 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,9 +42,8 @@ config.active_storage.service = :local # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = "wss://example.com/cable" - # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + config.action_cable.mount_path = "/cable/" + config.action_cable.allowed_request_origins = ["http://localhost", "https://tigerdata-prod.princeton.edu"] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true diff --git a/config/environments/qa.rb b/config/environments/qa.rb index fd37bbcb1..5233c4ae7 100644 --- a/config/environments/qa.rb +++ b/config/environments/qa.rb @@ -42,9 +42,8 @@ config.active_storage.service = :local # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = "wss://example.com/cable" - # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + config.action_cable.mount_path = "/cable/" + config.action_cable.allowed_request_origins = ["http://localhost", "https://tigerdata-qa.princeton.edu"] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 6d2a4dd8e..e6ac7cb53 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -42,9 +42,8 @@ config.active_storage.service = :local # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = "wss://example.com/cable" - # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + config.action_cable.mount_path = "/cable/" + config.action_cable.allowed_request_origins = ["http://localhost", "https://tigerdata-staging.lib.princeton.edu"] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true diff --git a/config/routes.rb b/config/routes.rb index 2bf4a2312..1797bfb3e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -37,4 +37,6 @@ resources :projects, only: [:index] end end + + mount ActionCable.server => "/cable" end