Skip to content

Commit

Permalink
Merge pull request #701 from cul-it/dev
Browse files Browse the repository at this point in the history
Merge dev to main
  • Loading branch information
ebtoner authored Dec 5, 2024
2 parents 9d0fc3a + 0d39771 commit 6190f5c
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 22 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ 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 && \
find ${BUNDLE_PATH}/ -name "*.c" -delete && \
find ${BUNDLE_PATH}/ -name "*.o" -delete

COPY . .
RUN bundle exec rake assets:precompile && rm .env
RUN rm .env

################################################################################
# Final image for integration/staging/production
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/assets/stylesheets/application_blackprint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/application_dr-joyce-brothers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ body, header {

.background-container {
background-position: center;
filter: none;
height: 180px;
border: none;

Expand Down
39 changes: 39 additions & 0 deletions app/assets/stylesheets/application_rmc-legacy.scss
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
5 changes: 5 additions & 0 deletions app/assets/stylesheets/exhibits/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ header {
}
}

// Remove default blur filter
.image-masthead .background-container {
filter: blur(0);
}

// Utilities navbar
// --------------------
.navbar-toggler {
Expand Down
18 changes: 17 additions & 1 deletion compose.integration.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
15 changes: 14 additions & 1 deletion compose.production.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
15 changes: 14 additions & 1 deletion compose.staging.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
11 changes: 11 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
- mysql
- redis
- solr
- sidekiq

mysql:
image: mariadb:10.6
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
1 change: 0 additions & 1 deletion config/environments/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/spotlight_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/run_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docker/run_sidekiq.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"

0 comments on commit 6190f5c

Please sign in to comment.