diff --git a/.env.template b/.env.template index f089458ed349341ceb517bd5800118f92c38d2f3..e664571004877ba979004a8f64cb9dbadc5d1c04 100644 --- a/.env.template +++ b/.env.template @@ -1,9 +1,16 @@ IN_DOCKER=true +COMPOSE_PROJECT_NAME="reseed-prod" +CONTAINER_IMAGE_TAG="Change_this_on_each_container_image_update" # Common path prefix for all subvolume bind mounts to facilitate backup create and restoration # Note: This path needs to start with either "./" or "/" and needs to end with a "slash". # This is to allow for setting this to an empty string or not defining the variable at all if Docker's standard volume directory should be used. DOCKER_VOLUMES_PATH_PREFIX="./volumes/" +HOST_PORT=3000 +# Note: ${COMPOSE_NETWORK_BRIDGE_NAME} cannot be longer than 15 characters +COMPOSE_NETWORK_BRIDGE_NAME="${COMPOSE_PROJECT_NAME}" +COMPOSE_NETWORK_BRIDGE_IPV4_SUBNET="172.17.42.0/24" +COMPOSE_NETWORK_BRIDGE_IPV6_SUBNET="fd00:0:0:42::/64" # Solr setting SOLR_URL_SCHEME=http @@ -38,7 +45,6 @@ FEDORA_TEST_PORT=8080 # RAILS setting LANG=C.UTF-8 -PORT=3000 RAILS_ENV=production RAILS_LOG_TO_STDOUT=true RAILS_SERVE_STATIC_FILES=true @@ -61,16 +67,6 @@ MATOMO_AUTH_TOKEN= # Hyrax application setting HOST_APP_DATA_PATH=/data/ -# DERIVATIVES_PATH is used by Docker build and is therefore fixed in the resulting Docker image -DERIVATIVES_PATH=/shared/derivatives/ -# FITS_PATH and FITS_VERSION are used by Docker build and are therefore fixed in the resulting Docker image -FITS_PATH=/fits/fits-1.5.5/fits.sh -FITS_VERSION=1.5.5 -# UPLOADS_PATH is used by Docker build and is therefore fixed in the resulting Docker image -UPLOADS_PATH=/shared/uploads/ -# CACHE_PATH is used by Docker build and is therefore fixed in the resulting Docker image -CACHE_PATH=/shared/cache/ -BRAND_PATH=/data/public/branding DEFAULT_DATE_FORMAT=%Y-%m-%d NOTIFICATIONS_EMAIL_DEFAULT_FROM_ADDRESS=no-reply@mailboxer.com USER_MANAGEMENT_EMAIL_FROM_ADDRESS=repo-admin@example.org @@ -83,7 +79,6 @@ IIIF_SEARCH_ENDPOINT= CONFIG_IIIF_IMAGE_ENDPOINT= # If the rails server is configured to serve requests in https, set this to true IIIF_TO_SERVE_SSL_URLS=false -# CRC_FOLDER_IMPORT_PATH is used by Docker build and is therefore fixed in the resulting Docker image CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials @@ -166,8 +161,6 @@ ARK_NAAN= # Download DOWNLOAD_FILES_SIZE_LIMIT=100000000 DOWNLOAD_FILES_COUNT_LIMIT=150 -# DOWNLOAD_PATH is used by Docker build and is therefore fixed in the resulting Docker image -DOWNLOAD_PATH=/shared/downloads # Admin set titles for the workflows RUB_ADMIN_SET_TITLE="RUB publication workflow" diff --git a/.env.template.development b/.env.template.development index 07c478ce02d3587a03796a9a2c204db4cce6731c..d2c7ebd83e0eb818d02a001018abaf9bb282e347 100644 --- a/.env.template.development +++ b/.env.template.development @@ -1,5 +1,12 @@ IN_DOCKER=true +COMPOSE_PROJECT_NAME="reseed-dev" +HOST_PORT=3000 +# Note: ${COMPOSE_NETWORK_BRIDGE_NAME} cannot be longer than 15 characters +COMPOSE_NETWORK_BRIDGE_NAME="${COMPOSE_PROJECT_NAME}" +COMPOSE_NETWORK_BRIDGE_IPV4_SUBNET="172.17.23.0/24" +COMPOSE_NETWORK_BRIDGE_IPV6_SUBNET="fd00:0:0:23::/64" + # Solr setting SOLR_URL_SCHEME=http SOLR_HOST=solr @@ -33,7 +40,6 @@ FEDORA_TEST_PORT=8080 # RAILS setting LANG=C.UTF-8 -PORT=3000 RAILS_ENV=development RAILS_LOG_TO_STDOUT=true RAILS_SERVE_STATIC_FILES=true @@ -59,16 +65,6 @@ MATOMO_AUTH_TOKEN= # Hyrax application setting HOST_APP_DATA_PATH=./data/ -# DERIVATIVES_PATH is used by Docker build and is therefore fixed in the resulting Docker image -DERIVATIVES_PATH=/shared/derivatives/ -# FITS_PATH and FITS_VERSION are used by Docker build and are therefore fixed in the resulting Docker image -FITS_PATH=/fits/fits-1.5.5/fits.sh -FITS_VERSION=1.5.5 -# UPLOADS_PATH is used by Docker build and is therefore fixed in the resulting Docker image -UPLOADS_PATH=/shared/uploads/ -# CACHE_PATH is used by Docker build and is therefore fixed in the resulting Docker image -CACHE_PATH=/shared/cache/ -BRAND_PATH=/data/public/branding DEFAULT_DATE_FORMAT=%Y-%m-%d NOTIFICATIONS_EMAIL_DEFAULT_FROM_ADDRESS=no-reply@mailboxer.com USER_MANAGEMENT_EMAIL_FROM_ADDRESS=repo-admin@example.org @@ -81,7 +77,6 @@ IIIF_SEARCH_ENDPOINT= CONFIG_IIIF_IMAGE_ENDPOINT= # If the rails server is configured to serve requests in https, set this to true IIIF_TO_SERVE_SSL_URLS=false -# CRC_FOLDER_IMPORT_PATH is used by Docker build and is therefore fixed in the resulting Docker image CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials @@ -162,8 +157,6 @@ ARK_NAAN= # Download DOWNLOAD_FILES_SIZE_LIMIT=100000000 DOWNLOAD_FILES_COUNT_LIMIT=150 -# DOWNLOAD_PATH is used by Docker build and is therefore fixed in the resulting Docker image -DOWNLOAD_PATH=/shared/downloads # Admin set titles for the workflows RUB_ADMIN_SET_TITLE="RUB publication workflow" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fc55fa04454369a8e7c566db10d5fca5c4f6c14..fd05c872d766d8e1476decf123cda11f93c8d482 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,9 +25,9 @@ build-job: - apk update && apk upgrade && apk add nodejs curl libarchive-tools build-base libpq-dev sqlite-dev libxml2-dev tzdata - cd hyrax && bundle install --jobs 4 --retry 3 script: - - mkdir -p /fits/fits-1.5.5 - - curl --fail --location "https://github.com/harvard-lts/fits/releases/download/1.5.5/fits-1.5.5.zip" | bsdtar --extract --directory /fits/fits-1.5.5 - - chmod +x "/fits/fits-1.5.5/fits.sh" "/fits/fits-1.5.5/fits-env.sh" "/fits/fits-1.5.5/fits-ngserver.sh" + - mkdir -p /fits + - curl --fail --location "https://github.com/harvard-lts/fits/releases/download/1.5.5/fits-1.5.5.zip" | bsdtar --extract --directory /fits + - chmod +x "/fits/fits.sh" "/fits/fits-env.sh" "/fits/fits-ngserver.sh" - bundle exec rake db:test:prepare test-job: @@ -38,7 +38,6 @@ test-job: - cd hyrax && bundle install --jobs 4 --retry 3 - bundle exec rake db:setup script: - - export FITS_PATH=/fits/fits-1.5.5/fits.sh - if test -f "lib/tasks/test_servers.rake"; then echo 'Running full tests' && bundle exec rake test:servers:start && bundle exec rake rdms:setup_hyrax && bundle exec rspec && bundle exec rake test:servers:stop; else echo "Running limited tests"; bundle exec rspec --exclude-pattern "**/features/*_spec.rb"; fi deploy-job: diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 0000000000000000000000000000000000000000..8184a4817253131c2d2e15c833242dcf874b0c5c --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,138 @@ +networks: + internal: + +services: + fcrepo: + image: ualbertalib/docker-fcrepo4:4.7 + restart: unless-stopped + expose: + - 8080 + depends_on: + - fcrepodb + networks: + internal: + environment: + - CATALINA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -Dfcrepo.home=/data -Dfcrepo.object.directory=/data/objects -Dfcrepo.binary.directory=/data/binaries -Dfcrepo.postgresql.username=$POSTGRES_USER -Dfcrepo.postgresql.password=$POSTGRES_PASSWORD -Dfcrepo.postgresql.host=$POSTGRES_HOST_FCREPO -Dfcrepo.postgresql.port=$POSTGRES_PORT -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-postgresql/repository.json + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}fcrepo:/data + + solr: + image: solr:8 + restart: unless-stopped + expose: + - 8983 + env_file: + - .env + environment: + - OOM=script + healthcheck: + test: ["CMD-SHELL", "wget -O /dev/null http://localhost:8983/solr/"] + interval: 30s + timeout: 5s + retries: 3 + networks: + internal: + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}solr:/var/solr + - ./hyrax/solr/conf:/opt/solr/solr_conf + command: + - sh + - "-c" + - "precreate-core ${SOLR_TEST_CORE} /opt/solr/solr_conf; solr-precreate ${SOLR_CORE} /opt/solr/solr_conf" + + fcrepodb: + image: postgres:13-alpine + restart: unless-stopped + env_file: + - .env + environment: + - POSTGRES_DB=${POSTGRES_DB_FCREPO} + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}db-fcrepo:/var/lib/postgresql/data + networks: + internal: + expose: + - 5432 + healthcheck: + test: ["CMD-SHELL", "POSTGRES_PASSWORD=${POSTGRES_PASSWORD} pg_isready -U ${POSTGRES_USER} -h localhost -d ${POSTGRES_DB_FCREPO}"] + interval: 30s + timeout: 5s + retries: 3 + + appdb: + image: postgres:13-alpine + restart: unless-stopped + env_file: + - .env + environment: + - POSTGRES_DB=${POSTGRES_DB_APP} + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}db-app:/var/lib/postgresql/data + networks: + internal: + expose: + - 5432 + healthcheck: + test: ["CMD-SHELL", "POSTGRES_PASSWORD=${POSTGRES_PASSWORD} pg_isready -U ${POSTGRES_USER} -h localhost -d ${POSTGRES_DB_APP}"] + interval: 30s + timeout: 5s + retries: 3 + + app: &app + build: + context: hyrax + args: + RAILS_ENV: ${RAILS_ENV} + env_file: + - .env + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}file_uploads:/shared/uploads + - ${DOCKER_VOLUMES_PATH_PREFIX}derivatives:/shared/derivatives + - ${DOCKER_VOLUMES_PATH_PREFIX}cache:/shared/cache + - ${CRC_FOLDER_IMPORT_PATH}:/rub-test-data + - ${DOCKER_VOLUMES_PATH_PREFIX}downloads:/shared/downloads + networks: + internal: + + web: + <<: *app + command: bash -c "/bin/docker-entrypoint.sh" + restart: unless-stopped + depends_on: + - appdb + - solr + - fcrepo + - redis + networks: + internal: + aliases: + - web + expose: + - 3000 + + workers: + <<: *app + command: bash -c "bundle install && bundle exec sidekiq" + restart: unless-stopped + depends_on: + - appdb + - solr + - fcrepo + - redis + + redis: + image: redis:6-alpine + command: redis-server --appendonly yes + restart: unless-stopped + networks: + internal: + healthcheck: + test: ["CMD-SHELL", "redis-cli ping"] + interval: 30s + timeout: 5s + retries: 3 + expose: + - 6379 + volumes: + - ${DOCKER_VOLUMES_PATH_PREFIX}redis:/data + diff --git a/docker-compose.development.yml b/docker-compose.development.yml index c8b1b3ab67bfde79f9f3544b7fdbf221299f91b3..ad1e02d94484c3da6092d8cdb5879346ac73d20b 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -1,5 +1,3 @@ -version: '3' - volumes: db: db-fcrepo: @@ -10,11 +8,18 @@ volumes: file_uploads: derivatives: cache: - branding: downloads: networks: internal: + driver_opts: + com.docker.network.bridge.name: ${COMPOSE_NETWORK_BRIDGE_NAME} + enable_ipv6: True + ipam: + driver: default + config: + - subnet: "${COMPOSE_NETWORK_BRIDGE_IPV4_SUBNET}" + - subnet: "${COMPOSE_NETWORK_BRIDGE_IPV6_SUBNET}" services: fcrepo: @@ -28,7 +33,8 @@ services: expose: - 8080 ports: - - 8080:8080 + - "127.0.0.1:8080:8080/tcp" + - "[::1]:8080:8080/tcp" volumes: - fcrepo:/data @@ -47,7 +53,8 @@ services: expose: - 8983 ports: - - 8983:8983 + - "127.0.0.1:8983:8983/tcp" + - "[::1]:8983:8983/tcp" volumes: - solr:/var/solr - ./hyrax/solr/conf:/opt/solr/solr_conf @@ -98,13 +105,6 @@ services: context: hyrax args: RAILS_ENV: ${RAILS_ENV} - UPLOADS_PATH: ${UPLOADS_PATH} - DERIVATIVES_PATH: ${DERIVATIVES_PATH} - CACHE_PATH: ${CACHE_PATH} - FITS_PATH: ${FITS_PATH} - FITS_VERSION: ${FITS_VERSION} - CRC_FOLDER_IMPORT_PATH: ${CRC_FOLDER_IMPORT_PATH} - DOWNLOAD_PATH: ${DOWNLOAD_PATH} env_file: - .env networks: @@ -113,8 +113,6 @@ services: web: <<: *app environment: - - VIRTUAL_HOST=rdms.docker - - VIRTUAL_PORT=3000 - RAILS_FORCE_SSL=false command: bash -c "/bin/docker-entrypoint.sh" depends_on: @@ -129,16 +127,16 @@ services: expose: - 3000 ports: - - 3000:3000 + - "127.0.0.1:${HOST_PORT}:3000/tcp" + - "[::1]:${HOST_PORT}:3000/tcp" volumes: - - file_uploads:${UPLOADS_PATH} - - derivatives:${DERIVATIVES_PATH} - - cache:${CACHE_PATH} - - branding:${BRAND_PATH} + - file_uploads:/shared/uploads + - derivatives:/shared/derivatives + - cache:/shared/cache - ${HOST_APP_DATA_PATH:-/data/}:/data/data - ./hyrax:/data:cached - ${CRC_FOLDER_IMPORT_PATH}:/rub-test-data - - downloads:${DOWNLOAD_PATH} + - downloads:/shared/downloads workers: <<: *app @@ -149,24 +147,24 @@ services: - fcrepo - redis volumes: - - file_uploads:${UPLOADS_PATH} - - derivatives:${DERIVATIVES_PATH} - - cache:${CACHE_PATH} - - branding:${BRAND_PATH} + - file_uploads:/shared/uploads + - derivatives:/shared/derivatives + - cache:/shared/cache - ${HOST_APP_DATA_PATH:-/data/}:/data/data - ./hyrax:/data:cached - ${CRC_FOLDER_IMPORT_PATH}:/rub-test-data - - downloads:${DOWNLOAD_PATH} + - downloads:/shared/downloads redis: - image: redis:6 + image: redis:6-alpine command: redis-server --appendonly yes networks: internal: expose: - 6379 ports: - - 6379:6379 + - "127.0.0.1:6379:6379/tcp" + - "[::1]:6379:6379/tcp" healthcheck: test: ["CMD-SHELL", "redis-cli ping"] interval: 30s diff --git a/docker-compose.yml b/docker-compose.yml index e4982dd554a87f726936e1cf8fc4608622140913..4ecf99c5aff12e63e993f692f4af575967c63756 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,13 @@ -version: '3' - networks: internal: + driver_opts: + com.docker.network.bridge.name: ${COMPOSE_NETWORK_BRIDGE_NAME} + enable_ipv6: True + ipam: + driver: default + config: + - subnet: "${COMPOSE_NETWORK_BRIDGE_IPV4_SUBNET}" + - subnet: "${COMPOSE_NETWORK_BRIDGE_IPV6_SUBNET}" services: fcrepo: @@ -15,8 +21,6 @@ services: internal: environment: - CATALINA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -Dfcrepo.home=/data -Dfcrepo.object.directory=/data/objects -Dfcrepo.binary.directory=/data/binaries -Dfcrepo.postgresql.username=$POSTGRES_USER -Dfcrepo.postgresql.password=$POSTGRES_PASSWORD -Dfcrepo.postgresql.host=$POSTGRES_HOST_FCREPO -Dfcrepo.postgresql.port=$POSTGRES_PORT -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-postgresql/repository.json - ports: - - 8080:8080 volumes: - ${DOCKER_VOLUMES_PATH_PREFIX}fcrepo:/data @@ -25,8 +29,6 @@ services: restart: unless-stopped expose: - 8983 - ports: - - 8983:8983 env_file: - .env environment: @@ -85,40 +87,31 @@ services: retries: 3 app: &app - build: - context: hyrax - args: - RAILS_ENV: ${RAILS_ENV} - UPLOADS_PATH: ${UPLOADS_PATH} - DERIVATIVES_PATH: ${DERIVATIVES_PATH} - CACHE_PATH: ${CACHE_PATH} - FITS_VERSION: ${FITS_VERSION} - DOWNLOAD_PATH: ${DOWNLOAD_PATH} + image: reseed-app:${CONTAINER_IMAGE_TAG} env_file: - .env volumes: - - ${DOCKER_VOLUMES_PATH_PREFIX}file_uploads:${UPLOADS_PATH} - - ${DOCKER_VOLUMES_PATH_PREFIX}derivatives:${DERIVATIVES_PATH} - - ${DOCKER_VOLUMES_PATH_PREFIX}cache:${CACHE_PATH} + - ${DOCKER_VOLUMES_PATH_PREFIX}file_uploads:/shared/uploads + - ${DOCKER_VOLUMES_PATH_PREFIX}derivatives:/shared/derivatives + - ${DOCKER_VOLUMES_PATH_PREFIX}cache:/shared/cache - ${CRC_FOLDER_IMPORT_PATH}:/rub-test-data - - ${DOCKER_VOLUMES_PATH_PREFIX}downloads:${DOWNLOAD_PATH} + - ${DOCKER_VOLUMES_PATH_PREFIX}downloads:/shared/downloads networks: internal: web: <<: *app + image: reseed-web:${CONTAINER_IMAGE_TAG} command: bash -c "/bin/docker-entrypoint.sh" restart: unless-stopped - environment: - - VIRTUAL_HOST=rdms.docker - - VIRTUAL_PORT=3000 depends_on: - appdb - solr - fcrepo - redis ports: - - 3000:3000 + - "127.0.0.1:${HOST_PORT}:3000/tcp" + - "[::1]:${HOST_PORT}:3000/tcp" networks: internal: aliases: @@ -128,6 +121,7 @@ services: workers: <<: *app + image: reseed-workers:${CONTAINER_IMAGE_TAG} command: bash -c "bundle install && bundle exec sidekiq" restart: unless-stopped depends_on: @@ -137,7 +131,7 @@ services: - redis redis: - image: redis:6 + image: redis:6-alpine command: redis-server --appendonly yes restart: unless-stopped networks: @@ -149,8 +143,6 @@ services: retries: 3 expose: - 6379 - ports: - - 6379:6379 volumes: - ${DOCKER_VOLUMES_PATH_PREFIX}redis:/data diff --git a/hyrax/Dockerfile b/hyrax/Dockerfile index f007b701e72f46c9352c5768f8dddd4b1fdb7b95..b1fbc1f1a3ec77ca482d64541a9706e71f21274b 100644 --- a/hyrax/Dockerfile +++ b/hyrax/Dockerfile @@ -2,14 +2,8 @@ FROM ruby:2.7.8-alpine # Setup build variables ARG RAILS_ENV -ARG DERIVATIVES_PATH -ARG UPLOADS_PATH -ARG CACHE_PATH -ARG FITS_VERSION -ARG DOWNLOAD_PATH ENV APP_PRODUCTION=/data/ -ENV CRC_IMPORT_FOLDER_PATH=/rub-test-data # Add backports to apt-get sources # Install libraries, dependencies, java and fits @@ -26,9 +20,9 @@ RUN apk update && \ COPY policy.xml /etc/ImageMagick-7/policy.xml -RUN mkdir -p /fits/fits-$FITS_VERSION \ - && curl --fail --location "https://github.com/harvard-lts/fits/releases/download/$FITS_VERSION/fits-$FITS_VERSION.zip" | bsdtar --extract --directory /fits/fits-$FITS_VERSION \ - && chmod +x "/fits/fits-$FITS_VERSION/fits.sh" "/fits/fits-$FITS_VERSION/fits-env.sh" "/fits/fits-$FITS_VERSION/fits-ngserver.sh" +RUN mkdir -p /fits \ + && curl --fail --location "https://github.com/harvard-lts/fits/releases/download/1.5.5/fits-1.5.5.zip" | bsdtar --extract --directory /fits \ + && chmod +x "/fits/fits.sh" "/fits/fits-env.sh" "/fits/fits-ngserver.sh" # copy gemfiles to production folder COPY Gemfile Gemfile.lock $APP_PRODUCTION @@ -44,11 +38,11 @@ RUN cd $APP_PRODUCTION \ && mv Gemfile.lock Gemfile.lock.built_by_docker # create a folder to store derivatives, file uploads and cache directory -RUN mkdir -p $DERIVATIVES_PATH -RUN mkdir -p $UPLOADS_PATH -RUN mkdir -p $CACHE_PATH -RUN mkdir -p $CRC_IMPORT_FOLDER_PATH -RUN mkdir -p $DOWNLOAD_PATH +RUN mkdir -p "/shared/derivatives" +RUN mkdir -p "/shared/uploads" +RUN mkdir -p "/shared/cache" +RUN mkdir -p "/rub-test-data" +RUN mkdir -p "/shared/downloads" # copy the application COPY . $APP_PRODUCTION diff --git a/hyrax/app/helpers/download_helper.rb b/hyrax/app/helpers/download_helper.rb index ffd48ae308937a729863128cfc2fbb984a7ed257..9184ce8a225d5aed631791cd71f743a221224e7e 100644 --- a/hyrax/app/helpers/download_helper.rb +++ b/hyrax/app/helpers/download_helper.rb @@ -49,19 +49,19 @@ module DownloadHelper end def base_download_dir - File.join(ENV.fetch('DOWNLOAD_PATH', '/shared/downloads'), work.id) + File.join("/shared/downloads", work.id) end def zip_file_path - File.join(ENV.fetch('DOWNLOAD_PATH', "/shared/downloads"), "#{work.id}.zip") + File.join("/shared/downloads", "#{work.id}.zip") end def shell_file_path - File.join(ENV.fetch('DOWNLOAD_PATH', "/shared/downloads"), "#{work.id}.sh") + File.join("/shared/downloads", "#{work.id}.sh") end def ts_file_path - File.join(ENV.fetch('DOWNLOAD_PATH', "/shared/downloads"), "#{work.id}.txt") + File.join("/shared/downloads", "#{work.id}.txt") end def create_or_modify_ts_file diff --git a/hyrax/app/helpers/hyrax_helper.rb b/hyrax/app/helpers/hyrax_helper.rb index a56140a5d87bc60a5b0333b843e0147bbc01e517..7fe2706384eae26eb3f6e4216a662def8399f561 100644 --- a/hyrax/app/helpers/hyrax_helper.rb +++ b/hyrax/app/helpers/hyrax_helper.rb @@ -190,7 +190,7 @@ module HyraxHelper def latest_varification_report_details(entry) # Define the file pattern and search path - download_path = ENV.fetch('DOWNLOAD_PATH', '/shared/downloads') + download_path = "/shared/downloads" report_pattern = "analysis_report_#{entry.importerexporter_id}_#{entry.id}_*.csv" matching_files = Dir.glob(File.join(download_path, report_pattern)) diff --git a/hyrax/app/helpers/search_download_helper.rb b/hyrax/app/helpers/search_download_helper.rb index c432715fbac80a2cfdb17eaafb02475fceb2ab56..b2940fdd746f5231033a831b9bce436f32a1ec9c 100644 --- a/hyrax/app/helpers/search_download_helper.rb +++ b/hyrax/app/helpers/search_download_helper.rb @@ -29,7 +29,7 @@ module SearchDownloadHelper end def shell_file_path - @shell_file_path ||= File.join(ENV.fetch('DOWNLOAD_PATH', "/shared/downloads"), "users/#{shell_file_name}") + @shell_file_path ||= File.join("/shared/downloads", "users/#{shell_file_name}") end def shell_file_name diff --git a/hyrax/app/services/verify_crc_dataset_import.rb b/hyrax/app/services/verify_crc_dataset_import.rb index f4e5eb39132d0c33c8664818fab25850813b07d3..a472625fabc285f0b3ef60b8adb7750543a040ad 100644 --- a/hyrax/app/services/verify_crc_dataset_import.rb +++ b/hyrax/app/services/verify_crc_dataset_import.rb @@ -22,7 +22,7 @@ class VerifyCRCDatasetImport # prepare csv report report_name = "analysis_report_#{import_id}_#{entry_id}_#{Time.now.strftime("%Y-%m-%dT%H-%M-%S")}_#{ verification_status ? "success" : "failure"}.csv" - report_path = File.join(ENV.fetch('DOWNLOAD_PATH', '/shared/downloads'), report_name) + report_path = File.join("/shared/downloads", report_name) headers = %w(id status message) CSV.open(report_path, "w") do |csv| diff --git a/hyrax/config/initializers/hyrax.rb b/hyrax/config/initializers/hyrax.rb index 086eb2eb0e9196e22a7135e9bab3167edf59ac48..4936f467794f8405e8143cd7572b12418ff34c90 100644 --- a/hyrax/config/initializers/hyrax.rb +++ b/hyrax/config/initializers/hyrax.rb @@ -79,7 +79,7 @@ Hyrax.config do |config| # config.redis_namespace = "hyrax" # Path to the file characterization tool - config.fits_path = ENV['FITS_PATH'] || "/fits/fits-1.5.5/fits.sh" + config.fits_path = "/fits/fits.sh" # Path to the file derivatives creation tool # config.libreoffice_path = "soffice" @@ -175,12 +175,12 @@ Hyrax.config do |config| # Temporary paths to hold uploads before they are ingested into FCrepo # These must be lambdas that return a Pathname. Can be configured separately - config.upload_path = ->() { ENV.fetch('UPLOADS_PATH', Rails.root.join('tmp', 'uploads')) } - config.cache_path = ->() { ENV.fetch('CACHE_PATH', Rails.root.join('tmp', 'uploads', 'cache')) } + config.upload_path = ->() { '/shared/uploads' } + config.cache_path = ->() { '/shared/cache' } # Location on local file system where derivatives will be stored # If you use a multi-server architecture, this MUST be a shared volume - config.derivatives_path = ENV.fetch('DERIVATIVES_PATH', Rails.root.join('tmp', 'derivatives')) + config.derivatives_path = '/shared/derivatives' # Should schema.org microdata be displayed? # config.display_microdata = true @@ -192,7 +192,7 @@ Hyrax.config do |config| # Location on local file system where uploaded files will be staged # prior to being ingested into the repository or having derivatives generated. # If you use a multi-server architecture, this MUST be a shared volume. - config.working_path = ENV.fetch('UPLOADS_PATH', Rails.root.join('tmp', 'uploads')) + config.working_path = config.upload_path # Should the media display partial render a download link? # config.display_media_download_link = true diff --git a/hyrax/config/puma.rb b/hyrax/config/puma.rb index ed10558b9b402f384cd07025e512bde876e3c08f..83ed4d32853420cbe248973769d4dcddd036d3b4 100644 --- a/hyrax/config/puma.rb +++ b/hyrax/config/puma.rb @@ -7,10 +7,6 @@ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. -# -port ENV.fetch("PORT") { 3000 } - # Specifies the `environment` that Puma will run in. # environment ENV.fetch("RAILS_ENV") { "development" } diff --git a/hyrax/docker-entrypoint.sh b/hyrax/docker-entrypoint.sh index fcb33560123e8e348e34559e3ed7c75070bcb601..585cb2c5baddacac5238b0479f4d278840318e57 100644 --- a/hyrax/docker-entrypoint.sh +++ b/hyrax/docker-entrypoint.sh @@ -68,4 +68,4 @@ bundle exec rake rdms:setup_hyrax["seed/setup.json"] # echo "--------- Starting Hyrax in ${RAILS_ENV} mode ---------" rm -f /tmp/hyrax.pid -bundle exec rails server -p 3000 -b '0.0.0.0' --pid /tmp/hyrax.pid +bundle exec rails server -p 3000 -b '[::]' --pid /tmp/hyrax.pid