Ruby overview

ruby.png

 

Version Management

RVM is used as a standard version manager. RVM is responsible for configuring the current version of Ruby in each container. Currently, Jelastic supports the following Ruby versions:

  • 1.9.2-p320
  • 1.9.3-p429
  • 2.0.0-p195

All of these versions are pre-installed in each Ruby container.

Switching between different versions is performed via the Jelastic dashboard by executing

rvm use ${ruby_version}

When a user switches the versions from one to another, Jelastic also performs resolving dependencies.

Jelastic will update all Ruby instances automatically in the case a new minor version of Ruby becomes available (e.g. appears new patch level 2.0.0-p196) via self-patching feature. All new environments will be created automatically with the new version of Ruby.

Dependency Management

Dependency management is provided by Bundler. You only need to specify the list of required gems in Gemfile and Bundle and this will resolve all dependencies.

 

By default Ruby in Jelastic comes with a list of the most popular/widespread Ruby gems for all supported Ruby versions. They are cached locally in each ruby container for fast environment creation.

When you deploy your application, Bundler performs dependency resolving by searching gems at http://rubygems.org/and installing the latest version of all gems if needed.

If you use a non strict versions declaration in your Gemfile (e.g. gem version will have to be greater than specific "jquery-rails", "~> 2.0.2") - Bundler will download and install the latest version of the corresponding gem on each deployment.

If your application uses any special (non-public) dependency, you need to specify its repository URL in Gemfile and Bundler will also download and install this gem.

Jelastic supports all standard deployment types of Ruby applications:

  • production
  • development
  • testing

Production is the default deployment type. You can switch between deployment types at any time via the Jelastic Dashboard.

Bundler performs dependency resolving in the following cases:

  • Deploying application
  • Switching between Ruby versions
  • Changing deployment type

 

Post Deploy Configuration

Jelastic can perform post deployment application configuration via rake. This is usually needed to finalize configuration of complex applications, to run additional applications or specific steps for application configuration like db:migrate.

To do this we've introduced a new file called rake_deploy. It is located in the application root and contains a list of the commands that have to be passed to rake. Each command has to be located in a separate line. Commands are executed successively.

Jelastic executes commands from rake_deploy with each restart of the apache/nginx service and deletes them right after successful execution. As a result, if you need to bypass different commands to rake on each deploy you need to create arake_deploy file each time and put the correct commands there.

Jelastic puts the output of each rake_delpoy into a corresponding log file which is available via "Logs" view in the Jelastic Dashboard.

Syntaxis of rake_deploy file:

$COMMAND_NAME_1
$COMMAND_NAME_2
...
$COMMAND_NAME_N

And Jelastic will execute the following scripts:

rake $COMMAND_NAME_1
rake $COMMAND_NAME_2
...
rake $COMMAND_NAME_N

In case of Redmine rake_deploy looks like the following:

generate_secret_token
db:migrate
redmine:load_default_data

Note: To freeze gems you need to add this command to rake_deploygems:unpack

 

Vertical Scaling

Automatic vertical scaling of Ruby applications are provided by:

  • Virtualization technology used in Jelastic
  • Updating PassengerMemLimit parameter in the httpd.conf file respectively to the actual cloudlet limit that the user set for the application server

 

Horizontal Scaling and High Availability

Http session replication is provided by all Active components of replication. Replication isolation of containers from different environments is provided by unique secret tokens.

 

Log files

Jelastic makes available the following log files:

  • access_log.log
  • error_log.log
  • rake_deploy.log
  • bundle_install.log

 

Configuration available via Jelastic File Manager

Jelastic makes the following files and folders available for CRUD operations:

  • /var/www/webroot/ - directory for application files
  • /etc/httpd/conf and /etc/httpd/conf.d/ - directory with web server config files

 

Available frameworks

Jelastic supports ANY Ruby framework: you just need to add the corresponding dependency in Gemfile. Among the most popular are:

  • Ruby on Rails
  • Sinatra
  • Rack
  • therubyracer
  • Ramaze
  • ExecJS
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.