Enable Ruby for Your Website

  1. Go to Websites & Domains > your domain.

  2. On the “Get Started” tab, click Ruby.

    image 76933

  3. Click Enable Ruby.

The Ruby interpreter of the selected version will be enabled for your website, and the version number will be displayed at the Websites & Domains page near the Ruby icon.

image 76934

Deploy a Ruby Application

Upload your application’s files (for example, using the File Manager) as follows:

  1. Create a subdirectory named /<application name>/public in the website home directory, where <application name> is the name of your Ruby application.
  2. Upload the application files (including the config.ru file) into the /<application name> directory.
  3. Go to Websites & Domains, click Hosting Settings and set the Document root value to /<application name>/public.

Then, go to Websites & Domains > Ruby. If Ruby is enabled, Plesk will detect your application, and the Ruby page will display the information about it:

image 76935

The following information is displayed:

  • Ruby Version. This is the version of Ruby enabled for your domain. You can change the version by clicking the version number and selecting one of the available Ruby versions.

  • Application Mode. Ruby applications can run in several modes that are defined in the application code. Usually, the following modes are used: ‘development’, ‘test’, and ‘production’. Each of them has its specific features. For example, the ‘development’ mode produces some debug information in the log files, and the ‘production’ mode can activate caching. Click the current Application Mode value to select a different mode or to define a custom mode.

    image 76498

  • Application URL. This is the URL of the website where the application is running. Click the URL to open the website.

  • Application Root. This is the home directory of the application. Click the link to view the directory in File Manager.

  • Custom environment variables. Here you can define the list of custom environment variables for your application. This can be used, for example, for switching the debug mode or for storing a password in a variable instead of hardcoding it. Click the [specify] link to add or remove the variables.

    image 76500

  • Ruby app type. Plesk automatically detects if the application was built using the Ruby on Rails framework – in this case, it will have the Ruby on Rails application type. Otherwise, the Rake application type will be displayed.

An application may contain a Gemfile listing the gems and their versions required by the application. In this case, for application deployment, you need to install these gems using the Bundler utility. Go to Websites & Domains, click Ruby and then click Bundle install.

image 76501

All the gems will be installed to the vendor/bundle directory in the application structure.

image 76502

After the progress dialog shows that the installation has completed successfully, the application will be deployed to your website and restarted.

If your application requires a database, add it in Plesk (refer to Website Databases).

Note: If you need to execute Rake tasks with your application via the command line interface and want to use the same Ruby version and the same gems set as your application has, use the bundle command. For example: RAILS_ENV=production bundle exec rake db:migrate.

Note: To use Ruby applications inside CageFS, install the passenger-cagefs package and follow the instructions in its README file.

Restart the Application

In some cases, it could be necessary to restart the application (for example, if the application is running in the production mode and a new version of code has been deployed). Go to Websites & Domains > your domain, click Ruby, and then click Restart App.

image 76936

The application should be restarted if you have changed its configuration files, application code, or added or removed custom environment variables.

Access to Configuration Files

Plesk provides you with quick links to the most used configuration files of the application. You can edit these files to define custom settings. For example, you can edit the Gemfile listing the gems required by the application.

To see the application configuration files detected by Plesk, go to Websites & Domains and click Ruby.

image 76937

Click a file name to edit its content, make the necessary changes, and click OK.

image 76938

Disable Ruby

To disable Ruby for your domain, go to Websites & Domains > your domain, click Ruby, and then click Disable Ruby.