Skip to content

Commit

Permalink
Ensuring that the ActionCable is mounted for the staging, qa, and pro…
Browse files Browse the repository at this point in the history
…duction environments. Ensuring that ActionCable uses Redis (#862)

Co-authored-by: Hector Correa <[email protected]>
jrgriffiniii and hectorcorrea authored Jul 30, 2024
1 parent 6bd133e commit 00d90f7
Showing 6 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 12 additions & 3 deletions config/cable.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions config/environments/qa.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -37,4 +37,6 @@
resources :projects, only: [:index]
end
end

mount ActionCable.server => "/cable"
end

0 comments on commit 00d90f7

Please sign in to comment.