Unofficial Content
  • This documentation is valid for:

The recommended platform for Ruby applications deploy is linux using Apache Web Server (which supports Rack).

The purpose of this document is to explain the linux environment setup for running Rack Ruby applications (Phusion Passenger and Apache Web Server). This is done generally when the application is ready to production.

For more information about GeneXus Rack Ruby applications see sac #25698.

Steps to follow

1. Install Ruby 1.9.1 for GX Evoution 1 applications, and Ruby 1.9.3 for GX Evolution 2 applications.

Download and install mod_rack (Phussion Passenger: http://www.modrails.com/install.html). Additional software requirements are specified while installing Passenger.

2. Edit your Apache configuration file (apache2.conf or httpd.conf), and add these lines (depending on your installation):

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.11
PassengerRuby /usr/local/bin/ruby

3. Configure the virtual directory.

You need to copy all the files from the data model directory (where you were prototyping in windows, ie: "c:\mykb\RubyModel\web") to the linux file system.

The following explains how to transform the directory where you copy the application from windows, into an Apache Rack virtual directory.

You need to do the following:

A. Phusion Passenger assumes that Rack application directories have a certain layout. Suppose that you want to deploy your GeneXus application in "/webapps/rackapp". Then that folder must contain at least three entries:

config.ru  --> a Rackup file for starting the Rack application. This file must contain the complete logic for initializing the application (is provided in GeneXus Ruby standard files).  

public/,

tmp/,

So /webapps/rackapp must, at minimum, look like this:

/webapps/rackapp
  |
  +-- config.ru  (is provided in GeneXus Ruby standard files)
  |
  +-- public/    (has to be created)
  |
  +-- tmp/       (has to be created)


You should copy all the files from the data model directory  to "rackapp" directory.

So, to deploy your application copy all <KbnowledgeBase_directory>\rubymodel (.rb, .html, configuration files, and subdirectories) content under "rackapp" directory ("rackapp" is the name of the directory in our example).

B. One way of configuring the virtual directory in Apache2 is by editing the file under sites-enabled directory and adding the following under

<VirtualHost *> entry:

        ServerAdmin webmaster
        ServerName example
        DocumentRoot /webapps/rackapp/public

Important

The web application name ("rackapp" in the example) must be the same as the one configured in the GeneXus WebRoot property (it corresponds to the value after the last "/", for example:"http://server/rackapp/" ). 

The web application name value can be changed also in the gxconfig.yaml file (where the webroot is specified).

4. Ruby gems have to be installed on linux.

There are Ruby gems, required by the generator. These gems are distributed by GeneXus, and it provides a script which installs them.

You need to transfer all files in folder <GX_DIRECTORY>\gxruby\linux and <GX_DIRECTORY>\gxruby\generic to a linux working directory. 

Afterwards, execute "installgems.bash" (located in linux directory) in order to install the necessary gems to run Ruby generated applications.

Note:

The more tested platforms were Ubuntu and Debian (32 bits both).

Additional Information

http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_analysis_and_system_maintenance_tools
http://www.modrails.com/documentation/Users%20guide.html#_deploying_a_rack_based_ruby_application

See also 

Setting up centOS environment for running GX Ruby applications

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant