Rails 7.2

I’m trying to deploy a Ruby on Rails 7.2 app, but I’m getting the following errors:

ERROR [build 3/6] RUN bundle install && bundle exec bootsnap precompile --gemfile && rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*

I’m getting this error on the “Building image with Docker” step. I’m also getting this error as the final output:

failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c bundle install && bundle exec bootsnap precompile --gemfile && rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git" did not complete successfully: exit code: 18

Is fly able to host a Ruby on Rails 7.2 app?

Fly.io is able to deploy Rails 7.2 apps. There likely is something in your Gemfile that has a dependency that is not being met. Can you check your logs for more information and/or post your Gemfile?

Here is my Gemfile. I just did an update from Rails 7.0 to 7.1 and it deployed fine. Now I’m doing an update from 7.1 to 7.2 and I’m getting that error.

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

ruby "3.3.3"

gem "rails", "~> 7.2.0"

gem "bootsnap", require: false
gem "devise"
gem "discard"
gem "faker"
gem "heroicon"
gem "importmap-rails"
gem "jbuilder"
gem "jquery-rails"
gem "pg"
gem "phony_rails"
gem "puma"
gem "ransack"
gem "redis"
gem "sentry-rails"
gem "sentry-ruby"
gem "sprockets-rails"
gem "stimulus-rails"
gem "tailwindcss-rails"
gem "turbo-rails"
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem 'whenever', require: false
gem "will_paginate"

group :development, :test do
  gem "debug", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  gem "annotate"
  gem "dockerfile-rails"
  gem "web-console"
end

Here are the last few lines from the logs:

2024-08-11T23:29:46Z proxy[e784e693a477d8] sjc [info]App esbc-employees has excess capacity, autostopping machine e784e693a477d8. 0 out of 1 machines left running (region=sjc, process group=app)
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info] INFO Sending signal SIGINT to main child process w/ PID 314
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info]- Gracefully stopping, waiting for requests to finish
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info]=== puma shutdown: 2024-08-11 23:29:46 +0000 ===
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info]- Goodbye!
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info]Exiting
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info] INFO Main child exited normally with code: 0
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info] INFO Starting clean up.
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info] WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-08-11T23:29:46Z app[e784e693a477d8] sjc [info][  439.248610] reboot: Restarting system

Are here is a chunk from the logs that is repeated over and over:

2024-08-11T23:24:03Z app[148ee7ea351189] sjc [info] WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-08-11T23:24:03Z app[148ee7ea351189] sjc [info][    2.534494] reboot: Restarting system
2024-08-11T23:24:03Z runner[148ee7ea351189] sjc [info]machine did not have a restart policy, defaulting to restart
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info]2024-08-11T23:24:07.302123187 [01J4M8F6YCG4JWHMHD10YFDH58:main] Running Firecracker v1.7.0
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info][    0.285600] PCI: Fatal: No config space access function found
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info] INFO Starting init (commit: 3dd5d9e)...
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info] INFO starting statics vsock server
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info] INFO Preparing to run: `/rails/bin/docker-entrypoint ./bin/rails server` as rails
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info] INFO [fly api proxy] listening at /.fly/api
2024-08-11T23:24:07Z app[148ee7ea351189] sjc [info]2024/08/11 23:24:07 INFO SSH listening listen_address=[fdaa:2:d6ef:a7b:138:77cc:3d33:2]:22 dns_server=[fdaa::3]:53
2024-08-11T23:24:07Z runner[148ee7ea351189] sjc [info]Machine started in 765ms
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info]=> Booting Puma
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info]=> Rails 7.0.7 application starting in production
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info]=> Run `bin/rails server --help` for more startup options
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info]A server is already running. Check /rails/tmp/pids/server.pid.
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info]Exiting
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info] INFO Main child exited normally with code: 1
2024-08-11T23:24:09Z app[148ee7ea351189] sjc [info] INFO Starting clean up.

There is a bug in Ruby 3.3.3 which will prevent a successful deploy. Can you upgrade to 3.3.4 or downgrade to 3.3.2?

Alternately, you can run bin/rails generate dockerfile to generate a new Dockerfile with a workaround, or you can manually apply the workaround yourself:

I changed the ruby version to 3.3.4, but now I’m getting:

Your Ruby version is 3.2.1, but your Gemfile specified 3.3.4

when I run fly deploy.

Can you check your Dockerfile for this line?

ARG RUBY_VERSION=3.3.4

I ran the bin/rails generate dockerfile command and the deploy was successful. Thank you for all your help and your quick responses.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.