Skip to content

Commit

Permalink
feat: several fixes for production environment
Browse files Browse the repository at this point in the history
  • Loading branch information
wpramio committed Jan 31, 2024
1 parent 5f15301 commit 11e15f3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
rescue_from ActionController::RoutingError, with: :on404
rescue_from ActiveRecord::RecordNotFound, with: :on404
rescue_from ActionController::UnknownFormat, with: :on406
rescue_from ApplicationController::InvalidAuthenticityToken, with: :on406
rescue_from ActionController::InvalidAuthenticityToken, with: :on406
end

protect_from_forgery with: :exception
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/apps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@

class AppsController < ApplicationController
before_action :print_parameters if Rails.configuration.developer_mode_enabled
# skip Rails default verify auth token - we use our own strategies
skip_before_action :verify_authenticity_token

# verified oauth, etc
# launch into lti application
def launch
# Make launch request to LTI-APP
tool = RailsLti2Provider::Tool.where(uuid: params[:oauth_consumer_key]).last
lti_launch = RailsLti2Provider::LtiLaunch.find_by(nonce: params[:oauth_nonce])

# add the oauth key to the data of this launch
message = lti_launch.message
message.custom_params['oauth_consumer_key'] = params[:oauth_consumer_key]

lti_launch.update(tool_id: tool.id, message: message.to_json)
lti_launch.update(message: message.to_json)

redirector = "#{lti_app_url(params[:app])}?#{{ launch_nonce: lti_launch.nonce }.to_query}"
logger.info("redirect_post to LTI app url=#{redirector}")
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
reconnect_attempts: 1, # Defaults to 0

error_handler: lambda { |method:, returning:, exception:|
config.logger.warn("Support: Redis cache action #{method} failed and returned '#{returning}': #{exception}")
Rails.logger.warn("Support: Redis cache action #{method} failed and returned '#{returning}': #{exception}")
}, },]
else
[:file_store, Rails.root.join('tmp/cache_store')]
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,24 @@ services:
env_file:
- ./.env
environment:
DISABLE_DATABASE_ENVIRONMENT_CHECK: 1
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:password@postgres:5432/lti_broker}
RAILS_ENV: production
REDIS_URL: redis://:BCsy8zMwZay669ii@broker_redis:6379/0
MCONF_REDIS_HOST: broker_redis
MCONF_REDIS_PASSWORD: BCsy8zMwZay669ii
MCONF_REDIS_PORT: 6379
MCONF_REDIS_DB: 0
PROMETHEUS_EXPORTER_HOST: prod_exporter
PROMETHEUS_EXPORTER_PORT: 9394
WEB_CONCURRENCY: 1
PUMA_WORKERS: 1
LOGRAGE_ENABLED: 1
volumes:
- .:/usr/src/app
ports:
- "3000:3000"
links:
- postgres
depends_on:
- postgres
- broker_redis
- prod_exporter

Expand Down

0 comments on commit 11e15f3

Please sign in to comment.