rubygems-update requires Ruby version >= 3.0.0

Hey all. I am trying to deploy my app and am getting the following error about rubygems-update requiring Ruby 3+. This is not a gem which I have installed nor is it a dependancy of one of my gems.

My Docker file does set Ruby to 2.7.1.

ARG RUBY_VERSION=2.7.1

Has something changed in how the build system works? Did I miss a deprecation? Do I need to upgrade my app’s version of ruby to get around this?

Any insight into why this is happening would be appreciated!

==> Verifying app config
Validating /Users/randywilander/Developer/Projects/personal/registerbc/app/fly.toml
Platform: machines
✓ Configuration is valid
--> Verified app config
==> Building image
Remote builder fly-builder-holy-lake-8609 ready
Remote builder fly-builder-holy-lake-8609 ready
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 18.3s (18/27)                                                                                                            
 => [internal] load build definition from Dockerfile                                                                             0.1s
 => => transferring dockerfile: 32B                                                                                              0.1s
 => [internal] load .dockerignore                                                                                                0.1s
 => => transferring context: 35B                                                                                                 0.1s
 => resolve image config for docker.io/docker/dockerfile:experimental                                                            0.5s
 => CACHED docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa4  0.0s
 => [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:2.7.1-jemalloc-slim                                                0.3s
 => [base 1/6] FROM quay.io/evl.ms/fullstaq-ruby:2.7.1-jemalloc-slim@sha256:9bf347162343dbcff69d7418a7535116ac9d5c76bbecf45697f  0.0s
 => [internal] load build context                                                                                                0.1s
 => => transferring context: 24.16kB                                                                                             0.1s
 => CACHED [base 2/6] RUN mkdir /app                                                                                             0.0s
 => CACHED [base 3/6] WORKDIR /app                                                                                               0.0s
 => CACHED [base 4/6] RUN mkdir -p tmp/pids                                                                                      0.0s
 => CACHED [base 5/6] RUN curl https://get.volta.sh | bash                                                                       0.0s
 => CACHED [base 6/6] RUN volta install node@14.13.0 yarn@1.22.18                                                                0.0s
 => CACHED [build_deps 1/1] RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=cache  0.0s
 => ERROR [gems 1/3] RUN gem update --system --no-document &&     gem install -N bundler -v 2.1.4                               17.2s
 => CACHED [stage-4 1/8] RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=cache,i  0.0s
 => CACHED [node_modules 1/3] COPY package*json ./                                                                               0.0s
 => CACHED [node_modules 2/3] COPY yarn.* ./                                                                                     0.0s
 => [node_modules 3/3] RUN yarn install                                                                                         15.0s
------                                                                                                                                
 > [gems 1/3] RUN gem update --system --no-document &&     gem install -N bundler -v 2.1.4:                                           
#0 16.92 ERROR:  Error installing rubygems-update:                                                                                    
#0 16.92        There are no versions of rubygems-update (= 3.5.4) compatible with your Ruby & RubyGems                               
#0 16.92        rubygems-update requires Ruby version >= 3.0.0. The current ruby version is 2.7.1.83.                                 
#0 16.92 ERROR:  While executing gem ... (NoMethodError)                                                                              
#0 16.92     undefined method `version' for nil:NilClass
#0 17.20 Updating rubygems-update
------
Error: failed to fetch an image or build from source: error building: failed to solve: executor failed running [/bin/bash -o pipefail -c gem update --system --no-document &&     gem install -N bundler -v ${BUNDLER_VERSION}]: exit code: 1

It looks like I may need to update my ruby version. If someone knows a way around this temporarily that would be very useful.

Try deleting that one line in your Dockerfile.

If that doesn’t work, try generating a whole new Dockerfile: GitHub - fly-apps/dockerfile-rails: Provides a Rails generator to produce Dockerfiles and related files.

Try deleting that one line in your Dockerfile.

Hey @rubys the thing I am worried about here is that it will install using a different version of Ruby, which could break my app. Or am I miss understanding what setting the RUBY_VERSION environment variable does. I assume this is the version that my app will run on when deployed.

Sorry, I wasn’t clear. The above line is the one I suggest removing. It is causing you problems, and may not be necessary - it isn’t necessary with modern versions of Ruby, but I’m not certain about 2.7. It isn’t present in the Dockerfiles that we now suggest (or the one that Rails 7.1 provides).

Thanks for the clarification. Ill give this a try.

Hey @rubys that worked but now I am running into anther issue. It looks like I am over my usage on Redis commands.

I am curious if you have any advice on how to debug why this may be, or how I can look into what may be causing this?

Thanks again for the help!

I was looking at Managing Redis rate limits on Sidekiq and Rails and it looks like depending on my concurrency the checks that sidekiq makes for more items in the Redis instance may be too high.

Here are my configs:

Sidekiq

:concurrency: <%= ENV["SIDEKIQ_MAX_THREADS"] || 8 %>
:timeout: 8

:queues:
  - ["high", 6]
  - ["default", 4]
  - ["mailer", 2]
  - ["low", 1]

max_retries: 0

I have made the following updates based on what @jsierles suggested in the post I linked above:

config/initializers/sidekiq.rb

Sidekiq.configure_server do
  Sidekiq::BasicFetch::TIMEOUT = 15
end

config/sidekiq.yml

:concurrency: <%= ENV["SIDEKIQ_MAX_THREADS"] || 1 %>
:timeout: 8

:queues:
  - ["high", 6]
  - ["default", 4]
  - ["mailer", 2]
  - ["low", 1]

max_retries: 0

And then I set my SIDEKIQ_MAX_THREADS environment variable to 1.

This is what I think is happening:

My concurrency is too high for the needs of my system. This is leading to too many commands being sent to Redis to check for items to process. This would explain why Bandwidth, Storage and Cost numbers in my Redis dashboard are so low while Commands are through the roof.

Something that might be worth exploring: Migrating from Sidekiq to Solid Queue | Kyle Keesling

Thanks. I will take a look see.

So I updated my SIDEKIQ_MAX_THREADS to 1 for the time being and made Sidekiq::BasicFetch::TIMEOUT = 15. I then trued to deploy my app again, which worked.

I am going to monitor the commands and my sidekiq throughput/latency and see how my config changes may have helped.

What I am curious about is the following:

Is this true and if so why did I get an error saying that I need to upgrade if the free trier is capped on bandwidth and not commands.