diff --git a/Dockerfile b/Dockerfile index 31dadc95..4ad1cbb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,6 +78,7 @@ WORKDIR ${APP_PATH} COPY ./Gemfile ./Gemfile.lock ./ RUN bundle config set --local with "${RAILS_ENV}" && \ bundle config set --local without "${BUNDLE_WITHOUT}" && \ + bundle config set --local path "${BUNDLE_PATH}" && \ bundle install && \ gem install aws-sdk-s3 && \ rm -rf ${BUNDLE_PATH}/cache/*.gem && \ @@ -85,7 +86,7 @@ RUN bundle config set --local with "${RAILS_ENV}" && \ find ${BUNDLE_PATH}/ -name "*.o" -delete COPY . . -RUN bundle exec rake assets:precompile && rm .env +RUN rm .env ################################################################################ # Final image for integration/staging/production @@ -102,9 +103,7 @@ ENV RAILS_ENV=${RAILS_ENV} \ # exhibits_cron - .ebextentions/tmp_cleanup.config # localtime adjustment - .ebextentions/system_time.config COPY ./cron/exhibits_cron /etc/cron.d/exhibits_cron -RUN groupadd -r $GROUP && useradd -r -g $GROUP $USER && \ - mkdir -p /home/${USER} && \ - chown ${USER}:${GROUP} /home/${USER} && \ +RUN groupadd -r $GROUP && useradd -mr -g $GROUP $USER && \ chmod gu+rw /var/run && chmod gu+s /usr/sbin/cron && \ crontab -u root /etc/cron.d/exhibits_cron && \ ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 4e2e0884..25514922 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -5,4 +5,5 @@ //= link application_dr-joyce-brothers.css //= link application_blackprint.css //= link application_example.css +//= link application_rmc-legacy.css //= link openseadragon-assets.js diff --git a/app/assets/images/spotlight/themes/rmc-legacy_preview.png b/app/assets/images/spotlight/themes/rmc-legacy_preview.png new file mode 100644 index 00000000..d0e98a62 Binary files /dev/null and b/app/assets/images/spotlight/themes/rmc-legacy_preview.png differ diff --git a/app/assets/stylesheets/application_blackprint.scss b/app/assets/stylesheets/application_blackprint.scss index aa4900e2..5b7d483c 100644 --- a/app/assets/stylesheets/application_blackprint.scss +++ b/app/assets/stylesheets/application_blackprint.scss @@ -133,9 +133,9 @@ a, .page-link { } .page-title { background: image-url('spotlight/themes/blackprint/Swirl5.png') no-repeat; - background-position: 0% 30%; + background-position: 0 0.5rem; + padding-bottom: 1rem; padding-left: 3rem; - height: 60px; } h2 { diff --git a/app/assets/stylesheets/application_dr-joyce-brothers.scss b/app/assets/stylesheets/application_dr-joyce-brothers.scss index f1bd6c70..b37ccb4c 100644 --- a/app/assets/stylesheets/application_dr-joyce-brothers.scss +++ b/app/assets/stylesheets/application_dr-joyce-brothers.scss @@ -30,7 +30,6 @@ body, header { .background-container { background-position: center; - filter: none; height: 180px; border: none; diff --git a/app/assets/stylesheets/application_rmc-legacy.scss b/app/assets/stylesheets/application_rmc-legacy.scss new file mode 100644 index 00000000..933c01c8 --- /dev/null +++ b/app/assets/stylesheets/application_rmc-legacy.scss @@ -0,0 +1,39 @@ +@import 'base'; + +// Theme designed to include a modified version of the original RMC masthead image in larger screen sizes + +.masthead { + .site-title-container { + @media (min-width: breakpoint-max('md')) { + // For larger screen sizes, hide title text (except for screen readers) + height: 180px; + .site-title { + @include sr-only; + } + .site-title-wrapper { + background: none; + } + + } + } + + .background-container { + // Center masthead image + background-position: center; + border: none; + height: 180px; + + @media (max-width: breakpoint-max('md')) { + // For smaller screen sizes, zoom in on solid background color on left side of modified RMC masthead image + background-position: left; + background-size: 600% 100%; + } + } + + .background-container-gradient { + @media (min-width: breakpoint-max('md')) { + // For larger screen sizes, remove background image gradient + display: none; + } + } +} diff --git a/app/assets/stylesheets/exhibits/_header.scss b/app/assets/stylesheets/exhibits/_header.scss index 3e16ff7c..8eba4c31 100644 --- a/app/assets/stylesheets/exhibits/_header.scss +++ b/app/assets/stylesheets/exhibits/_header.scss @@ -120,6 +120,11 @@ header { } } +// Remove default blur filter +.image-masthead .background-container { + filter: blur(0); +} + // Utilities navbar // -------------------- .navbar-toggler { diff --git a/compose.integration.yaml b/compose.integration.yaml index 13cb522b..4fd8d5cf 100644 --- a/compose.integration.yaml +++ b/compose.integration.yaml @@ -1,5 +1,8 @@ # Docker compose file for integration environment -# Run with: docker compose up +# Run with: docker compose -f compose.integration.yaml up +# +# For local development testing of the integration container: +# consider setting up a redis container, instead of connecting to the remote redis host. services: webapp: @@ -18,3 +21,16 @@ services: - PORT=9292 ports: - 9292:9292 + depends_on: + - sidekiq + + sidekiq: + build: + context: . + args: + BUNDLE_WITHOUT: "development test" + RACK_ENV: integration + RAILS_ENV: integration + entrypoint: docker/run_sidekiq.sh + env_file: + - .env diff --git a/compose.production.yaml b/compose.production.yaml index 2e303bdb..851dbfbc 100644 --- a/compose.production.yaml +++ b/compose.production.yaml @@ -1,5 +1,5 @@ # Docker compose file for production environment -# Run with: docker compose up +# Run with: docker compose -f compose.production.yaml up services: webapp: @@ -16,3 +16,16 @@ services: - PORT=9292 ports: - 9292:9292 + depends_on: + - sidekiq + + sidekiq: + build: + context: . + args: + BUNDLE_WITHOUT: "development integration test" + RACK_ENV: production + RAILS_ENV: production + entrypoint: docker/run_sidekiq.sh + env_file: + - .env diff --git a/compose.staging.yaml b/compose.staging.yaml index 8c8417e7..c26520f6 100644 --- a/compose.staging.yaml +++ b/compose.staging.yaml @@ -1,5 +1,5 @@ # Docker compose file for staging environment -# Run with: docker compose up +# Run with: docker compose -f compose.production.yaml up services: webapp: @@ -16,3 +16,16 @@ services: - PORT=9292 ports: - 9292:9292 + depends_on: + - sidekiq + + sidekiq: + build: + context: . + args: + BUNDLE_WITHOUT: "development test" + RACK_ENV: staging + RAILS_ENV: staging + entrypoint: docker/run_sidekiq.sh + env_file: + - .env diff --git a/compose.yaml b/compose.yaml index 2ae1c7f9..0922deba 100644 --- a/compose.yaml +++ b/compose.yaml @@ -22,6 +22,7 @@ services: - mysql - redis - solr + - sidekiq mysql: image: mariadb:10.6 @@ -55,6 +56,16 @@ services: volumes: - redis:/data + sidekiq: + build: + context: . + target: development + entrypoint: docker/run_sidekiq.sh + depends_on: + - redis + env_file: + - .env + volumes: db-data: gems: diff --git a/config/environments/development.rb b/config/environments/development.rb index cccc96a1..31e5688c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -71,7 +71,12 @@ config.active_job.queue_adapter = :sidekiq # config.active_job.queue_name_prefix = "exhibits_#{Rails.env}" - config.debug_logger = Logger.new(Rails.root.join('log', 'debug.log')) + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = ::Logger::Formatter.new + config.logger = ActiveSupport::TaggedLogging.new(logger) + end # provides access to IRB console on exception pages # config.web_console.whitelisted_ips = ENV['IP_WHITELIST'] if ENV['IP_WHITELIST'].present? diff --git a/config/environments/integration.rb b/config/environments/integration.rb index c7f64e07..1a6155b0 100644 --- a/config/environments/integration.rb +++ b/config/environments/integration.rb @@ -94,7 +94,6 @@ logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end - config.debug_logger = Logger.new(Rails.root.join('log', 'debug.log')) # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 31fe49e8..23c12fce 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -96,7 +96,6 @@ logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end - config.debug_logger = Logger.new(Rails.root.join('log', 'debug.log')) # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false diff --git a/config/environments/staging.rb b/config/environments/staging.rb index d5feee6a..6a9c4364 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -94,7 +94,6 @@ logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end - config.debug_logger = Logger.new(Rails.root.join('log', 'debug.log')) # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false diff --git a/config/initializers/spotlight_initializer.rb b/config/initializers/spotlight_initializer.rb index 627f4ff0..488e5183 100644 --- a/config/initializers/spotlight_initializer.rb +++ b/config/initializers/spotlight_initializer.rb @@ -116,7 +116,7 @@ # 'my-local-config': ->(context) { context.my_custom_data_path(context.current_exhibit) } # } -default_themes = %w[default example] +default_themes = %w[default example rmc-legacy] custom_themes = %w[dr-joyce-brothers blackprint] Spotlight::Engine.config.exhibit_themes = default_themes + custom_themes diff --git a/docker/run.sh b/docker/run.sh index 5e39dc83..a5942f2a 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -17,12 +17,14 @@ then fi # Run db migrations -echo "Preparing Database..." +echo "Preparing database..." bundle exec rake db:migrate RAILS_ENV=$RAILS_ENV -echo "Database Migration Done!" +echo "Database migration done!" -# Start sidekiq -bundle exec sidekiq -L log/sidekiq.log -e $RAILS_ENV -C config/sidekiq.yml -d +# Precompile assets +echo "Compiling assets..." +bundle exec rake assets:precompile +echo "Compiling assets done!" # Start the web server mkdir -p ./tmp/pids diff --git a/docker/run_dev.sh b/docker/run_dev.sh index 72ee267d..85cc418b 100755 --- a/docker/run_dev.sh +++ b/docker/run_dev.sh @@ -2,14 +2,14 @@ set -e +# Direct logs to stdout +export RAILS_LOG_TO_STDOUT="1" + # If the database exists, migrate. Otherwise setup (create and migrate) echo "Preparing Database..." bundle exec rake db:migrate 2>/dev/null || bundle exec rake db:environment:set RAILS_ENV=development db:create db:schema:load echo "Database Migration Done!" -# Start sidekiq -bundle exec sidekiq -L log/sidekiq.log -e $RAILS_ENV -C config/sidekiq.yml -d - # Start the web server mkdir -p ./tmp/pids bundle exec puma -C config/puma.rb -e $RAILS_ENV diff --git a/docker/run_sidekiq.sh b/docker/run_sidekiq.sh new file mode 100755 index 00000000..c8559ae7 --- /dev/null +++ b/docker/run_sidekiq.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +# Get environment variables +WORKDIR="/exhibits" +ENVFILE="${WORKDIR}/.env" +if [ ! -f "$ENVFILE" ]; then + ruby docker/get_env.rb $RAILS_ENV $WORKDIR +fi + +# Start sidekiq +echo "Starting up sidekiq..." +bundle exec sidekiq -e $RAILS_ENV -C config/sidekiq.yml + +# Run commands +exec "$@"