Ruby

The following are examples of how to set up a Ruby on Rails application and a Ruby on Rails application with a Dockerfile to deploy on Kinsta’s Application Hosting services from a GitHub repository.

Ruby on Rails

During the deployment process, Kinsta automatically installs dependencies defined in your gemfile.

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Ruby on Rails Starter.
  2. In MyKinsta, add an application with the Ruby on Rails Starter repository. The Start command can be left blank for the web process as Kinsta automatically detects the required command from the Procfile in the repository.

The app is available as soon as the build finishes, and the Kinsta Welcome page loads at your application’s URL.

Kinsta Welcome page after successful deployment of Ruby on Rails.
Kinsta Welcome page after successful deployment of Ruby on Rails.

Prefer to watch the video version?

Web Server Setup

Start Command

When you deploy an application and include a Procfile in the repository, Kinsta automatically creates a web process based on the Procfile in the root of the repository. Use this command in your Procfile to run your web server:

web: rails server

Ruby on Rails With a Dockerfile

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Dockerfile – Rails
  2. In MyKinsta, add an application with the Hello World Dockerfile Rails repository. Make sure you select Use Dockerfile to set up a container image.
  3. The Start command can be left blank as you add the application.
    Note: The Dockerfile needs to include the start command either in a CMD line or ENTRYPOINT instruction.

The app is available as soon as the build finishes, and the default Rails page confirming successful installation loads at your application’s URL.

Successful installation of Ruby on Rails.
Successful installation of Ruby on Rails.

Deployment Lifecycle

When you first create the app, Kinsta creates a process from the ENTRYPOINT instruction in the Dockerfile:

ENTRYPOINT ["entrypoint.sh"]

If you change this command in the repository after deploying the application, the process is not automatically updated in MyKinsta, so you must also edit the Start command in your application’s Processes.

Jekyll

This is an example of how to set up a static site with Jekyll on Kinsta’s Application Hosting services from a GitHub repository. A workaround using GitHub actions to deploy Jekyll on Static Site Hosting is also available.

Jekyll is an open-source static site generator that uses dynamic React components to produce a customized static site without the need for a database. More information is available on the Jekyll website.

Kinsta automatically installs dependencies defined in your Gemfile file during the deployment process.

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Static Site With Jekyll.
  2. In MyKinsta, add an application with the Hello World Jekyll repository. The Start command can be left blank for the web process as Kinsta automatically detects the required command from the Procfile in the repository.

The app is available as soon as the build finishes, and the Kinsta Welcome page loads at your application’s URL.

Kinsta Welcome page after successful installation of Jekyll.
Kinsta Welcome page after successful installation of Jekyll.

Web Server Setup

Port

Kinsta automatically sets the PORT environment variable. You should not define it yourself or hard-code it into the application.

Start Command

When you deploy an application and include a Procfile in the repository, Kinsta automatically creates a web process based on the Procfile in the root of the repository. Use this command in your Procfile to run your web server:

web: bundle exec jekyll build && ruby -run -e httpd _site

Deployment Lifecycle

Whenever a deployment is initiated (through creating an application or re-deploying due to an incoming commit), the bundle install command is run.

Was this article helpful?