Configure and Deploy Rails 7.1 to Kinsta

In this guide, we walk you through the process of setting up and configuring an initial Ruby on Rails version 7.1 application to be deployed and hosted on Kinsta. Whether you are a beginner or an experienced Ruby on Rails developer, this step-by-step tutorial will help you get started with your application deployment on Kinsta.


Before diving into this guide, we assume that you have a basic understanding of Git and Ruby on Rails, including installing Ruby, Rails, and the necessary dependencies on your local development machine.

Step 1: Set up a Kinsta Hosting Account

Visit the Kinsta website and create a new account if you don’t have one already. Configure your domain name or use an assigned Kinsta URL that is provided when deploying.

Step 2: Create a New Ruby on Rails Application

Open your terminal and navigate to the directory where you want to create your new Rails application. Run the following command to create it:

rails new myapp --database=postgresql --javascript=esbuild --css=tailwind

This command creates a new Rails application named myapp with PostgreSQL as the database adapter, esbuild for compiling our Javascript, and Tailwind CSS framework.

Feel free to replace myapp with your desired application name.

For a complete list of available options to configure from the rails new command run:

rails new --help

Step 3: Configure Your Rails Application

Change to the application directory:

cd myapp

Ensure that when bundling your Rails app that configuration is also adding the Linux platform as this is the OS used for deployment. Enter the following command in the terminal:

bundle lock --add-platform x86_64-linux

Web Process Script

Add a file to the bin directory of the app. This ensures that the server starts your application and runs the necessary commands to boot and update the database before running. In your terminal, create the file by entering:

touch bin/

Inside this file add the following:


bundle exec rails db:prepare
bundle exec rails server

Show Me Home

And to give us a Hello World, create a Home page for the app. In your terminal, enter:

create  app/controllers/home_controller.rb
route    get 'home/index'
invoke  erb
create  app/views/home
create  app/views/home/index.html.erb
invoke  test_unit
create  test/controllers/home_controller_test.rb
invoke  helper
create  app/helpers/home_helper.rb
invoke  test_unit

Open app/views/home/index.html.erb, and replace its contents with:

 <h1>Hello, Kinsta! </h1></code></pre>

Setting the Application Home Page

Open config/routes.rb, and add the following root route to the top of the Rails.application.routes.draw block:

Rails.application.routes.draw do
  root "home#index"

  get "/home", to: "home#index"

Now when we run our application locally, we see our new Home page. As we have generated our new application with the addition of esbuild, we have a simplified command to help us boot our application. By running the following command, Rails starts the server and watches for both CSS and Javascript changes with live reload: