I’ve spent a couple hours trying to get my first deploy of an existing rails app (running on Heroku) to deploy on Fly.io, but seem to keep getting stuck:
My cmd in the fly.toml is just
cmd = 'bin/rails server -p $PORT -e $RAILS_ENV'
(same as the Procfile for heroku)
but it just fails with:
Your Ruby version is 2.7.0, but your Gemfile specified 3.1.0
I think my real issue is that the builder and buildpacks don’t have access to the env vars or secrets, so I’ll need to find a way to inject them into the [build.args section]
I’m glad you got it working! Unfortunately that’s the best way to handle missing secrets during a build. We deliberately don’t leak secrets to flyctl because of the security risk, and you probably don’t want connections opening to your prod db anyway.
I’m seeing the exact same ruby mismatch error with the heroku/buildpacks:20 buildback!
My app is deployed and running just fine, but I need to run a one-off rake process (seeding the db with data), and so I ssh in with fly ssh console (which works), then I cd app, but I can’t run anything in the bin folder of my rails project! I’m getting these confusing errors:
# bin/rails console
Your Ruby version is 2.7.0, but your Gemfile specified 3.0.2
# bin/bundle exec rails console
bundler: command not found: rails
Install missing gem executables with `bundle install`
# bundle -v
/bin/sh: 6: bundle: not found
Maybe I am just new to Docker, but how is it that my app is running just fine and yet when I SSH in the container, bundler isn’t installed, nor rails, nor the proper version of ruby? Any links to resources where I can learn more about this aspect of Docker would also be appreciated.
Or even just tips on how to run a rake db:seed task as a one-off. Thank you!