Ruby

To use our example repositories, you must create a MyKinsta account. 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

  1. In MyKinsta, click Applications > Add application > select Git repository > Public repository, and complete as follows:
  2. Enter an Application name and choose a Data center location. Leave all other settings as default and click Continue on each step.
  3. On the Summary step, click Deploy now.

During deployment, Kinsta automatically detects the Start command for the web process from the Procfile in the repository and installs dependencies defined in your gemfile file. The app is available as soon as the deployment 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. In MyKinsta, click Applications > Add application > select Git repository > Public repository, and complete as follows:
  2. Enter an Application name and choose a Data center location. Leave all other settings as default and click Continue.
  3. On the Build environment step, select Use Dockerfile to set up a container image and click Continue > all other settings can remain as default, click Continue > Deploy now.

The Dockerfile must contain the Start command either in a CMD line or ENTRYPOINT instruction. The app is available as soon as the deployment 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.

  1. In MyKinsta, click Applications > Add application > select Git repository > Public repository, and complete as follows:
  2. Enter an Application name and choose a Data center location. Leave all other settings as default and click Continue on each step.
  3. On the Summary step, click Deploy now.

During deployment, Kinsta automatically detects the Start command for the web process from the Procfile in the repository and installs dependencies defined in your gemfile file. The app is available as soon as the deployment 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?