Deploy a Ruby on Rails App

This is a Hello World Rails 5.2 application that you can use as a starting point for your own Rails project on Render.

The sample app is deployed at

  1. Create a new PostgreSQL database on Render.
  2. Fork render-examples/rails and create a new Web Service, giving Render permission to access your forked repo.
  3. Use the following values during creation:

    Build Command: ./

    Here are the contents of the build script:

    #!/usr/bin/env bash
    bundle install
    bundle exec rake assets:precompile
    bundle exec rake assets:clean
    bundle exec rake db:migrate

    It’s simply executing commands needed to build a Rails site.

    Start Command: ./

    Here are the contents of the start script:

    #!/usr/bin/env bash
    bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

    It starts puma with 5 threads and uses PORT and RACK_ENV which are environment variables automatically set by Render.

    Under the Advanced section, add three new environment variables:
    SECRET_KEY_BASEA sufficiently strong secret. You can generate a secret locally by running bundle exec rake secret
    DB_URLThe internal connection string for the database you created above.

    You can add additional environment variables under the Environment tab after creating your service.

That’s it! Your web service will be live on your Render URL as soon as the build finishes.

A note on Ruby versions

By default, Render uses the latest LTS version of Ruby.

It can also automatically detect and install the version of Ruby specified in .ruby-version at the root of your project, or in your Gemfile.

This is the relevant snippet from the Gemfile in this repo:

ruby '2.5.3'