Ruby Selector

We have the ability to deploy Ruby applications via application server. Ruby Selector uses mod_passenger to host Ruby.

This feature is available for CloudLinux 6 or later. It supports only cPanel servers.

You can find a list of supported alt-ruby versions using the following commands.

yum grouplist | grep alt-ruby

Ruby Selector Installation

Note

The instructions below are suitable only for EasyApache 3 and EasyApache 4. You should follow this instruction if you use LiteSpeed.

To use Ruby Selector install alternative Ruby packages:

yum groupinstall alt-ruby 

To use MySQL database you should install alt-python27-devel package:

yum install alt-python27-devel

Note

After installation, please make sure that you have unmarked appropriate checkboxes in VE Manager Options tab to show Ruby App in web-interface. Find the instructions on the link.

Note

Adding Ruby modules requires executing permissions to gcc/make binaries. Please enable compilers in Compiler Access section of WHM, then run: cagefsctl --force-update

End User Access

  1. In Software/Services area choose Select Ruby Environment.

  1. Create project form will appear. Choose interpreter version for your application, application folder name (project path) and URI for accessing your application. Click “Create project” to create an application.

After a little while a new application entry will be appended to the web-page.

  1. You can edit path (folder name of the project in the home directory, for example, /home/clman1/project_name), uri for application, wsgi handler. If you click Edit - the value is converted to input field and thus becomes editable. When editing is complete, click Save .

  1. Wsgi entry is to specify python wsgi application entry point. It must be specified as filename, must be callable and separated by colon. If your app is running from file flask/run.py by calling callable app, set flask/run.py:app.

  1. When Show control is clicked, python extensions section will be expanded. It gives the ability to add or remove python modules. When start typing in input field, appropriate hints are shown in drop-down list. Choose the entry you want from drop-down and click Add .

If you click Delete, the corresponding module entry will disappear.

In addition to setting path, uri and wsgi, the interpreter version can be changed as well by changing the value in select drop-down.

  1. No changes are applied to application environment until Update button is clicked. Before the Update button is clicked, all changes can be reverted with Reset button.

The newly created application will be supplied with stub only. A real application ought to be put into application folder. After application is placed into application folder, the wsgi parameter can be set.

Click Remove to delete the application - the application folder itself will remain unmoved.

Note

For LVE Manager version 0.9-10 and higher

When creating an application you can use the key --domain, which attaches application to domain. If --domain key is not specified, then the main users domain will be used by default.

To create application run:

/usr/bin/selectorctl --interpreter=<ruby> --version=VERSION[--user=USER] [--domain=DOMAIN] [--print-summary] [--json]–-create-webapp <FOLDER_NAME> <URI>
When changing application URI, `--domain` key can be used simultaneously, in this case not only URI will be changed, but also the application domain.

To change application URI run:

/usr/bin/selectorctl --interpreter=<ruby> [--user=USER][--domain=NEW_DOMAIN] [--print-summary] [--json] --transit-webapp<FOLDER_NAME> <NEW_URI> 
The possibility to choose domain when creating an application was added to web interface as well.

Also, you can run simple commands from web interface (e.g. you can install packages from specific repositories or control web applications by means of django -admin).

Command Line

All the actions mentioned in Deploy and Settings section can be performed from the command line:

To create application run:

/usr/bin/selectorctl --interpreter=ruby --version=VERSION [--user=USER] [--print-summary] [--json] --create-webapp <FOLDER_NAME> <URI>
To delete application:
/usr/bin/selectorctl --interpreter=ruby [--user=USER] [--print-summary] [--json] --destroy-webapp <FOLDER_NAME>
To change application folder name:
/usr/bin/selectorctl --interpreter=ruby [--user=USER] [--print-summary] [--json] --relocate-webapp <FOLDER_NAME> <NEW_FOLDER_NAME>

To change application URI :

/usr/bin/selectorctl --interpreter=ruby [--user=USER] [--print-summary] [--json] --transit-webapp <FOLDER_NAME> <NEW_URI>

To change application interpreter version:

/usr/bin/selectorctl --interpreter=ruby [--user=USER] [--print-summary] [--json] --set-user-current --version=<NEW VERSION> <FOLDER_NAME>

To restart application:

selectorctl --interpreter ruby --user cltest1 --domain cltest1.com --restart-webapp testapp
To choose Ruby version:
selectorctl --interpreter=ruby --user=$USER -v 2.0

Hide Ruby Selector Icons

It is possible to hide or show Ruby Selector icon by marking or unmarking proper checkboxes in LVE Manager Options tab.

The same result can be accomplished in CLI by running:

cloudlinux-config set --json --data '{"options":{"uiSettings":{"hideRubyApp":false}}}'

Note

If you are using cPanel/WHM, you can also configure hide/show CloudLinux Ruby Selectors in WHM | Feature Manager. For that, you’d need to first uncheck Hide Ruby App in web-interface in the LVE Manager. This will make the menu appear for all accounts. After that, you are free to disable this app in WHM | Feature Manager for the required feature lists.

Deploying Redmine using Ruby Selector

Note

Provided instructions are valid for older Redmine version 2.6.0. New versions guide could be found at http://kb.cloudlinux.com/2016/12/how-to-run-redmine-with-ruby-selector/

  1. In cPanel create MySQL database and add user to it. In the example given, the databace redminet_redmine was created and user redminet_redmine was added.

  2. In Setup Ruby App section create an application.

App Directory is the directory where all static files will be placed ( e.g. redmine). App URI is web-interface URL ( e.g. redmine web-interface will be located in YOUR_DOMAIN/redmine).

  1. After the application was created, add the following modules: bundle, i18n#0.6.11, builder#3.0.4, rails#3.2.19, mime-types#1.25.1, mocha#1.0.0, jquery-rails#3.1.2, coderay, fastercsv, request_store, rbpdf, mysql2, selenium-webdriver, rmagick, shoulda#3.3.2, ruby-openid#2.3.0, request_store#1.0.5, capybara#2.1.0, net-ldap#0.3.1, rack-openid, shoulda-matchers#1.4.1, redcarpet#2.3.0, yard, rake#10.4.2, bigdecimal.

Note : If error occurs while installing rmagic module, then you need to install ImageMagick-devel package on your server:

yum install ImageMagick-devel
The installation process takes quite along time, about 7-8 minutes. When done, click Restart button to restart the application.

3.1 Alternatively, after the application was created, you can add only one module - bundle .

  1. Enter the server via SSH, using your cPanel account.

Download the application http://www.redmine.org/projects/redmine/wiki/Download .

In the description given, the latest version Redmine (2.6.0) is assumed.

http://www.redmine.org/releases/redmine-2.6.0.tar.gz tar xzf redmine-2.6.0.tar.gz

Hereinafter 'redmine' is App Directory meaning which was specified while setting Ruby application.

cp -R ~/redmine-2.6.0/* ~/redmine
cd ~/redmine/config
cp database.yml.example database.yml
Edit config/database.yml - add MySQL database connection settings to Production section.
cp -R ~/redmine/public/* ~/public_html/redmine/
cd ~/public_html/redmine
cat htaccess.fcgi.example >> .htaccess
cp dispatch.fcgi.example dispatch.fcgi
Go to cd ~/redmine directory.

Add gem "bigdecimal" line into Gemfile file.

Run alternately:

source ~/rubyvenv/redmine/2.1/bin/activate
~/rubyvenv/redmine/2.1/bin/bundle install
(if running the alternative installation)
~/rubyvenv/redmine/2.1/bin/rake generate_secret_token
RAILS_ENV=production ~/rubyvenv/redmine/2.1/bin/rake db:migrate
- Database migration;

RAILS_ENV=production ~/rubyvenv/redmine/2.1/bin/rake redmine:load_default_data

  • Loading default data into database.

EasyApache 4

Since cPanel/WHM version 66 provides ea-ruby24-mod_passenger (more information on the link), this allows creating Ruby applications with cPanel application manager.

CloudLinux already has Python and Ruby Selector , which allows creating applications with ea-apache24-mod-alt-passenger . However, it does not allow using cPanel application manager .

It is not correct to install both of those packages on the server because they contain the same passenger module for Apache web server.

The new ea-ruby24-mod_passenger is available for download from our updates-testing (beta) repository which allows you to run applications via cPanel application manager and Ruby Selector.

To install run:

# yum install lvemanager alt-python-virtualenv
# yum install ea-ruby24-mod_passenger --enablerepo=cl-ea4-testing