diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index a63955a2..de419e4b 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -51,6 +51,7 @@ def create if @page.save redirect_to pages_url, notice: 'Page was successfully created.' + Rails.logger.info "#{@page.created_at} user, email #{current_user.email} and ID #{current_user.id}, created a page \"#{@page.name}\" with ID #{@page.id}." else render :new end @@ -59,6 +60,8 @@ def create # PATCH/PUT /pages/1 def update if @page.update(page_params) + now = Time.zone.now + Rails.logger.info "#{now} user with email #{current_user.email} and ID #{current_user.id} has updated a page called \"#{@page.name}\" with ID #{@page.id}." redirect_to pages_url, notice: 'Page was successfully updated.' else render :edit @@ -67,6 +70,8 @@ def update # DELETE /pages/1 def destroy + now = Time.zone.now + Rails.logger.info "#{now} user, email #{current_user.email} and ID #{current_user.id}, deleted a page called \"#{@page.name}\" with ID #{@page.id}." @page.destroy redirect_to pages_url, notice: 'Page was successfully destroyed.' end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 685a0a49..7a8bf4af 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -10,6 +10,8 @@ def create redirect_to unknown_user_path and return false end + now = Time.zone.now + Rails.logger.info "#{now} login email requested for #{params[:session][:email].downcase}" UserMailer.login_email(user: user).deliver_later # Allow the login page to display in the bookmarklet iframe response.headers.delete "X-Frame-Options" @@ -21,6 +23,8 @@ def token if user[:expired] redirect_to expired_token_path(user[:user].id) else + now = Time.zone.now + Rails.logger.info "#{now} user with email #{user.email} and ID #{user.id} has successfully authenticated." cookies.signed[:user_id] = { value: user.id, expires: 7.days.from_now, httponly: true, same_site: :none, secure: true } redirect_to root_path end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ac20f440..4cfeb270 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -30,6 +30,7 @@ def create if @user.save UserMailer.welcome_email(user: @user, invited_by: current_user).deliver_later + Rails.logger.info "#{@user.created_at} user, email #{current_user.email} and ID #{current_user.id}, created another user with email #{@user.email} with ID #{@user.id}." redirect_to users_url, notice: 'User was successfully created.' else render :new @@ -44,6 +45,8 @@ def update end if @user.update(user_params) + now = Time.zone.now + Rails.logger.info "#{now} user with email #{current_user.email} and ID #{current_user.id} has updated a user with email #{@user.email} with ID #{@user.id}." redirect_to users_url, notice: 'User was successfully updated.' else render :edit @@ -57,6 +60,8 @@ def destroy return false end + now = Time.zone.now + Rails.logger.info "#{now} user, email #{current_user.email} and ID #{current_user.id}, deleted a user with email #{@user.email} and ID #{@user.id}." @user.subscriptions.destroy_all @user.destroy redirect_to users_url, notice: 'User was successfully deleted.' diff --git a/cfn/configs/klaxon-scheduled-task/dev/us-east-1/config.yml b/cfn/configs/klaxon-scheduled-task/dev/us-east-1/config.yml index 8f5cc642..fe91cc8c 100644 --- a/cfn/configs/klaxon-scheduled-task/dev/us-east-1/config.yml +++ b/cfn/configs/klaxon-scheduled-task/dev/us-east-1/config.yml @@ -53,9 +53,9 @@ context: APP_HOST: klaxon-dev.news-engineering.aws.wapo.pub. RACK_ENV: production RAILS_ENV: production - HOST_URL: "sandbox.washpost.arcpublishing.com" + HOST_URL: "klaxon-dev.news-engineering.aws.wapo.pub" SECRET_KEY_BASE: "{{resolve:secretsmanager:/klaxon/prod/secret-key:SecretString:secret_key_base}}" - KLAXON_COMPILE_ASSETS: true + KLAXON_COMPILE_ASSETS: false SMTP_PROVIDER: SES SES_ADDRESS: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:address}}" SES_DOMAIN: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:domain}}" diff --git a/cfn/configs/klaxon-scheduled-task/prod/us-east-1/config.yml b/cfn/configs/klaxon-scheduled-task/prod/us-east-1/config.yml index 17903da5..bca88302 100644 --- a/cfn/configs/klaxon-scheduled-task/prod/us-east-1/config.yml +++ b/cfn/configs/klaxon-scheduled-task/prod/us-east-1/config.yml @@ -53,9 +53,9 @@ context: APP_HOST: klaxon-prod.news-engineering.aws.wapo.pub. RACK_ENV: production RAILS_ENV: production - HOST_URL: "washpost.arcpublishing.com" + HOST_URL: "klaxon-prod.news-engineering.aws.wapo.pub" SECRET_KEY_BASE: "{{resolve:secretsmanager:/klaxon/prod/secret-key:SecretString:secret_key_base}}" - KLAXON_COMPILE_ASSETS: true + KLAXON_COMPILE_ASSETS: false SMTP_PROVIDER: SES SES_ADDRESS: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:address}}" SES_DOMAIN: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:domain}}" diff --git a/cfn/configs/klaxon/dev/us-east-1/config.yml b/cfn/configs/klaxon/dev/us-east-1/config.yml index cea41e46..a054bf49 100644 --- a/cfn/configs/klaxon/dev/us-east-1/config.yml +++ b/cfn/configs/klaxon/dev/us-east-1/config.yml @@ -416,9 +416,9 @@ context: APP_HOST: klaxon-dev.news-engineering.aws.wapo.pub. RACK_ENV: production RAILS_ENV: production - HOST_URL: "sandbox.washpost.arcpublishing.com" + HOST_URL: "klaxon-dev.news-engineering.aws.wapo.pub" SECRET_KEY_BASE: "{{resolve:secretsmanager:/klaxon/prod/secret-key:SecretString:secret_key_base}}" - KLAXON_COMPILE_ASSETS: true + KLAXON_COMPILE_ASSETS: false SMTP_PROVIDER: SES SES_ADDRESS: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:address}}" SES_DOMAIN: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:domain}}" diff --git a/cfn/configs/klaxon/prod/us-east-1/config.yml b/cfn/configs/klaxon/prod/us-east-1/config.yml index 5fa939f4..20b5b160 100644 --- a/cfn/configs/klaxon/prod/us-east-1/config.yml +++ b/cfn/configs/klaxon/prod/us-east-1/config.yml @@ -419,9 +419,9 @@ context: APP_HOST: klaxon-prod.news-engineering.aws.wapo.pub. RACK_ENV: production RAILS_ENV: production - HOST_URL: "washpost.arcpublishing.com" + HOST_URL: "klaxon-prod.news-engineering.aws.wapo.pub" SECRET_KEY_BASE: "{{resolve:secretsmanager:/klaxon/prod/secret-key:SecretString:secret_key_base}}" - KLAXON_COMPILE_ASSETS: true + KLAXON_COMPILE_ASSETS: false SMTP_PROVIDER: SES SES_ADDRESS: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:address}}" SES_DOMAIN: "{{resolve:secretsmanager:/klaxon/ses-prod/smtp-user-credentials:SecretString:domain}}" diff --git a/config/environments/production.rb b/config/environments/production.rb index f65165cc..b37570c2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -60,6 +60,9 @@ # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Logs work locally but won't appear in the ECS console or CloudWatch without this: + config.logger = Logger.new(STDOUT) + # Use a different cache store in production. # config.cache_store = :mem_cache_store diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index bb8409c0..064e9cc6 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,9 +1,5 @@ # Be sure to restart your server when you modify this file. -# Precompiles SVG so that org logo will display in deployed app -Rails.application.config.assets.precompile += %w( '.svg' ) -Rails.application.config.assets.css_compressor = :sass - # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' @@ -12,4 +8,8 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( search.js ) +# addition of '.svg' allows custom logo to display +Rails.application.config.assets.precompile += %w( search.js '.svg') + +# css_compressor needed for svg to display according to: https://stackoverflow.com/a/36992492 +Rails.application.config.assets.css_compressor = :sass \ No newline at end of file