0

On my project we are using Docker, Rails, Sidekiq and the hyrax and bulkrax gems. But after submitting a job we are seeing errors like this in the logs.

[ActiveJob] [Bulkrax::ImportWorkJob] [c51d6569-3b0e-46f0-be44-e84a0224448e] Error performing Bulkrax::ImportWorkJob (Job ID: c51d6569-3b0e-46f0-be44-e84a0224448e) from Sidekiq(import) in 1633.9ms: LoadError (Unable to autoload constant Hyrax::Actors::OptimisticLockValidator, expected /usr/local/bundle/gems/hyrax-3.4.1/app/actors/hyrax/actors/optimistic_lock_validator.rb to define it):

It appears that it cannot find the files to the hyrax gem. I verified they do in fact exist inside the container.

docker-compose.yml

version: '3.4'
# used for local testing
services:
  hyrax:
    build: 
      context: ./
      dockerfile: Dockerfile
    container_name: hyrax
    command: bash -c "rm -f tmp/pids/server.pid ; rm -rf tmp/cache ; bundle exec rails s -p 3000 -b 0.0.0.0"
    env_file:
      - './env/.env.dev.hyrax'       
    restart: on-failure           
    depends_on:
      - db
      - fcrepo
      - memcached
      - postgres
      - redis
      - solr       
    ports:
      - 3000:3000
    volumes:
      - ./hyrax:/home/hyrax
      - ./scripts:/home/hyrax/scripts
      - ./hyrax-exports/:/home/hyrax/imports
      - bundle_data:/usr/local/bundle     
      - hyrax_tmp:/home/hyrax/tmp
    networks:
      - hyrax   

  sidekiq:
    container_name: sidekiq
    build: 
      context: ./
      dockerfile: Dockerfile
    command: bundle exec sidekiq -C config/sidekiq.yml
    env_file:
      - './env/.env.dev.hyrax'     
    restart: always      
    volumes_from:
      - hyrax              
    depends_on:
      - redis
    networks:
      - hyrax     

  memcached:
    image: bitnami/memcached
    container_name: memcached
    ports:
      - "11211"
    networks:
      - hyrax

  redis:
    image: redis:alpine
    container_name: redis
    command: redis-server
    ports:
      - "6379"
    volumes:
      - redis:/var/lib/redis/data
    networks:
      - hyrax
    restart: unless-stopped  
    healthcheck:
      test: redis-cli -h redis ping
      interval: 30s
      timeout: 3s
      retries: 3                                

  fcrepo:
    image: ghcr.io/samvera/fcrepo4:4.7.5
    container_name: fcrepo
    restart: on-failure    
    volumes:
      - fcrepo:/data:cached
    ports:
      - "8080:8080"
    networks:
      - hyrax 
      
  solr:
    container_name: solr  
    image: solr:8.11.1
    restart: on-failure
    ports:
      - "8983"
    command:
      - sh
      - "-c"
      - "precreate-core hyrax_test /opt/solr/server/configsets/hyraxconf; solr-precreate hyrax_dev /opt/solr/server/configsets/hyraxconf"
    volumes:
      - solr:/var/solr/data:cached
      - ./hyrax/solr/conf:/opt/solr/server/configsets/hyraxconf
    networks:
      - hyrax 

  db:
    container_name: db
    image: postgres:14-alpine
    ports:
      - "5432"
    env_file:
      - './env/.env.dev.db'       
    volumes:
      - postgres:/var/lib/postgresql/data
    restart: unless-stopped
    healthcheck:
        test: pg_isready -U postgres -h postgres
        interval: 30s
        timeout: 3s
        retries: 3
    networks:
      - hyrax 

volumes:
  hyrax_tmp:
  bundle_data:
  postgres:
  fcrepo:
  redis:
  solr:

networks:
  hyrax:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: br-hyrax 

Dockerfile

ARG RUBY_VERSION=2.7.6
FROM ruby:$RUBY_VERSION

ENV LANG C.UTF-8
ENV NODE_VERSION 12
ENV NODE_ENV production
ENV INSTALL_PATH /home/hyrax

RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends nodejs postgresql-client yarn build-essential vim

RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH

COPY ./hyrax/Gemfile ./hyrax/Gemfile.lock ./
RUN gem install bundler
RUN bundle install

ADD ./hyrax $INSTALL_PATH

RUN rm -rf tmp

RUN useradd -Ms /bin/bash api -u 1001
RUN chown -R api:api /home/hyrax /usr/local/bundle
USER root

Gemfile

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.6'

# Rails Dependencies
# =====================================================
gem 'rails', '~> 5.2.6'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
gem 'rubyzip'

# Application Specific
# =================================================================

# background jobs
# =====================================================
gem 'sidekiq'
gem "sidekiq-cron"
gem 'sidekiq-failures'

# Health Check
# =====================================================
gem 'okcomputer'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Hydra Dependencies
# =====================================================
gem 'hydra-role-management'
gem 'hydra-editor'

# Hyrax Dependencies
# =====================================================
gem 'hyrax'
gem 'rsolr', '>= 1.0', '< 3'

gem 'bootstrap-sass', '~> 3.0'
gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
gem 'jquery-rails'
gem 'riiif', '~> 2.1'

# Bulk Import
# =====================================================
gem 'bulkrax'

# authentication
# =====================================================
gem 'devise'
gem 'devise-guests', '~> 0.6'

group :development, :test do
  gem 'solr_wrapper', '>= 0.3'

  gem 'fcrepo_wrapper'
  gem 'rspec-rails'

  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'simplecov', group: :test
  gem "simplecov-json" # For CodeClimate
  gem 'simplecov-console'  
  gem 'webdrivers', '~> 3.0'  
end

Thanks for any suggestions you may have

Tracy McCormick
  • 401
  • 1
  • 7
  • 18

0 Answers0