Manage Ruby Applications
Enable Ruby for your Web Site
To enable Ruby for your web site, go to Websites & Domains > Ruby and click Enable Ruby.
The Ruby interpreter of the selected version will be enabled for your web site, and the version number will be displayed at the Websites & Domains page near the Ruby icon.
Deploy a Ruby Application
Upload your application’s files (for example, using the File Manager) as follows:
- Create a subdirectory named
/<application name>/public
in the website home directory, where<application name>
is the name of your Ruby application. - Upload the application files (including the
config.ru
file) into the/<application name>
directory. - 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:
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.
-
Application URL. This is the URL of the web site where the application is running. Click the URL to open the web site.
-
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.
-
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.
All the gems will be installed to the vendor/bundle
directory in the
application structure.
After the progress dialog shows that the installation has completed successfully, the application will be deployed to your web site 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
.
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, click Ruby, and then click Restart App. Alternatively, click the Restart App button next to the name of the application at the Websites & Domains page.
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.
Click a file name to edit its content, make the necessary changes, and click OK.
Disable Ruby
To disable Ruby for your domain, go to Websites & Domains, click Ruby, and then click Disable Ruby.