hyku icon indicating copy to clipboard operation
hyku copied to clipboard

Docker containers unsuccessful due to old Ruby version in base image

Open sxflynn opened this issue 1 year ago • 2 comments

Descriptive summary

I'm attempting to run the docker containers locally on my machine. I followed the directions in the readme and after running docker compose up web the initialize_app service logs in Docker Desktop showed this error, which due to the dependencies preventing the rest of the containers from spinning up.

hyrax-5.0.0.rc2 requires ruby version >= 3.2, which is incompatible with the current version, 2.7.7

Rationale

The documentation states that Ruby 2.7 is recommended, but if a later version is needed, then this and any troubleshooting steps should be addressed in documentation.

Expected behavior

Docker containers should spin up after running docker compose up web

Actual behavior

initialize-app docker service fails to start due to an error message about requiring ruby >=3.2

Steps to reproduce the behavior

  1. run ruby -v to verify your version. Mine was 3.3.0
  2. Clone the repo
  3. Ensure Docker Desktop is downloaded, installed and running.
  4. cd into the repo
  5. run gem install dory and dory up then docker compose up web
  6. As long as you don't run in detached mode, you should see the error below, and if you inspect the docker logs for the initialize_app service you should see the error message above.

service "initialize_app" didn't complete successfully: exit 5` and

Additional info

The 2.7.7 ruby version comes from the ghcr.io/samvera/hyku/base:latest image. I used ruby -v inside that image to find that.

  1. Run docker run -it ghcr.io/samvera/hyku/base:latest /bin/bash
  2. While in the docker exec mode, run ruby -v to verify version 2.7.7

In addition, if you open the inspector for the initialize-app docker service, you'll see these lines:

"RUBY_MAJOR=2.7", "RUBY_VERSION=2.7.7", "RUBY_DOWNLOAD_SHA256=b38dff2e1f8ce6e5b7d433f8758752987a6b2adfd9bc7571dbc42ea5d04e3e4c",

and the ghcr.io/samvera/hyku/base:latest image has Ruby 2.7 set in the layers

I'd be happy to work on a first PR to fix this, but was wondering if anyone could point me in the right direction.

sxflynn avatar Jan 23 '24 04:01 sxflynn

We're in the process of working through Ruby, Rails, and Hyrax versions.

It also sounds like you might be running against main; Consider running against v5.1.0. The main branch is not considered stable.

jeremyf avatar Jan 24 '24 18:01 jeremyf

Thanks @jeremyf !

Wasn't sure if this should be posted as an issue or just a support question. I checked out the v5.1.0 tag, and successfully spun up the web docker service. I entered a repo name and the browser is requesting a login. I tried [email protected] and testing123 as found in the environment variables, and I tried various *@example.com but none of them work. Anything I'm missing?

Edit: Found it in app/controllers/application_controller.rb

username: samvera passwordhyku

# Extra authentication for palni-palci during development phase
    def authenticate_if_needed
      # Disable this extra authentication in test mode
      return true if Rails.env.test?
      if (is_hidden || is_staging) && !is_api_or_pdf
        authenticate_or_request_with_http_basic do |username, password|
          username == "samvera" && password == "hyku"
        end
      end
    end

I'll add a PR to clarify this in the README

sxflynn avatar Jan 26 '24 14:01 sxflynn