Rails 7 API Deployment

Hey folks,

Having a few issues with a Rails 7 deployment, and looking for some insight.

Project details:

  • Deploying from monorepo, and have set the root directory to api/

I am getting this error:

Oct 18 10:09:47 AM  Could not find gem 'bundler'.
Oct 18 10:09:47 AM  Did you mean builder?
Oct 18 10:09:47 AM  ==> Build failed 😞

Earlier in the build, though, I see this:

Oct 18 10:09:36 AM  ==> Detected Ruby version 3.1.2
Oct 18 10:09:45 AM  Updating rubygems-update
Oct 18 10:09:45 AM  Successfully installed rubygems-update-3.3.24
Oct 18 10:09:45 AM  Installing RubyGems 3.3.24
Oct 18 10:09:45 AM    Successfully built RubyGem
Oct 18 10:09:45 AM    Name: bundler
Oct 18 10:09:45 AM    Version: 2.3.24
Oct 18 10:09:45 AM    File: bundler-2.3.24.gem
Oct 18 10:09:45 AM  Bundler 2.3.24 installed
Oct 18 10:09:45 AM  RubyGems 3.3.24 installed
Oct 18 10:09:45 AM  Regenerating binstubs
Oct 18 10:09:45 AM  Regenerating plugins

Here’s my render-build.sh file:

#!/usr/bin/env bash
# exit on error
set -o errexit

bundle update -- bundler
bundle install
bundle exec rake assets:precompile
bundle exec rake assets:clean
bundle exec rake db:migrate
bundle exec rake db:seed

And here is my render.yaml :

  - name: waldo_prod
    databaseName: waldo_prod
    user: waldo_prod

  - type: web
    name: waldo_backend
    env: ruby
    buildCommand: "./bin/render-build.sh"
    startCommand: "bundle exec puma -C config/puma.rb"
      - key: DATABASE_URL
          name: waldo_prod
          property: connectionString
      - key: RAILS_MASTER_KEY
        sync: false

Some input would be helpful, thanks!

I solved my problem:

Render has since added a rootDir option under the services section in the render.yaml - adding this to my project solved all my issues: reverting to Ruby 2.6, not installing any gems, unable to find bundler errors.

Trying to maintain the setting via the web GUI was not working for me.

After setting the rootDir option via render.yaml I was able to remove the extra bundle commands in my build script, which was also causing errors.

That sounds like you may have set it in the Dashboard UI and then when the render.yaml is applied the rootDir is cleared out - specifying it in the render.yaml is definitely required here.

John B

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