This page is located at /public/zoo-index.html

Click on this link to open web console. Please use this console to run all Ruby commands on your application as these commands will be applied to this application environment. Helicon Zoo is designed to run multiple environments on a single server and all application dependencies are installed into the application's web site directory. If you use the provided web console to install gems they will be installed into GEM_HOME folder of this web site, so all dependencies will ship with your application if you decide to move or deploy it. If you use Windows console to run Ruby commands you may be actually calling quite different instance or version of Ruby (depends on your system set up) and installing gems in locations not related to this application at all.

The web console will only work for local or authenticated requests and external access is restricted for security reasons. You can enable remote access to web console by setting up any authentication method for /console/ directory of the web site.

This template is configured by default to run Ruby 1.9 Rack applications using FastCGI protocol. Please review web.config file for more details. There are commented out sections for Ruby 1.8 Rack over FastCGI and Ruby 1.9 Rack over HTTP.

The deploy_sample.rb script in the root folder is a sample deploy script. Rename this file to deploy.rb and Helicon Zoo will execute it as a deploy task upon next request to the application. After execution is completed Helicon Zoo will rename this file to deploy_done.rb to prevent further execution. Rename it to deploy.rb if you need to start deployment process again. This script is useful when you deploy application to production server running Helicon Zoo and need to execute database migrations, gem updates, etc. You can read more about deployment scripts in Helicon Zoo documentation.

Below please find step-by-step instructions to run some common Ruby configurations:

Generic Rack application

This template project is already configured to run Rack applications with Ruby 1.9 engine. The URL Rewrite rule set to rewrite index page requests to show this welcome page, but once config.ru file is present in the root the Rack application will start.

If you have existing Ruby Rack application simply put it's files into this web site folder. Please do not remove or overwrite web.config file provided with this template. Helicon Zoo application will not work without proper configuration in web.config file.

Ruby on Rails

  1. Open web console and type:
    gem install rails

    Wraning: this operation takes looooong time, please be patient. This will install latest version of Rails into GEM_HOME. To install other version of Rails you can use:

    gem install rails --version 4.0.0.beta1
    gem install rails --version 3.2.13
    gem install rails --version 2.3.11
  2. Run rails command to generate application files:
    • For Rails 3:
      rails new .
    • For Rails 2:
      rails .
    • If you have multiple Rails versions you can specify the one you want to use as follows:
      rails _3.1.1_ new .
      rails _2.3.11_ .

Some useful commands:

Ruby 1.9 Rack over HTTP with Thin

Thin is an asynchronnous Rack to HTTP Ruby web server based on EventMachine. Use this configuration if your application needs long polling or comet support or other asynchronous operations.

  1. Open web console and type:
    gem install thin
  2. Edit root web.config file as follows:
    • In the <handlers> section comment out two lines that follows
      <!-- Ruby 1.9 over FastCGI -->
    • Uncomment two lines that follows
      <!-- Ruby 1.9 over HTTP, using Thin as a back-end application server -->
    • In the <environmentVariables> section uncomment line
      <!-- Use this APP_WORKER with HTTP Ruby engine and Thin. Thin need to be installed.
      <add name="APP_WORKER" value="GEM_HOME\bin\thin start" />
      -->
  3. Create config.ru file and put your Rack application into the web site folder.

Sinatra

  1. Open web console and type:
    gem install sinatra
  2. Create config.ru file with the following content:
    require './app'
    run Sinatra::Application
  3. Create app.rb file with the following content:
    require 'sinatra'
    get '/' do
        "<h1>Hello from Sinatra!</h1>"
    end

Goliath

  1. Open web console and type:
    gem install goliath
  2. Uncomment line with APP_WORKER in web.config:
    <add name="APP_WORKER" value="%APPL_PHYSICAL_SHORT_PATH%\app.rb" />
  3. Uncomment handler mappings for http applications over Thin in web.config:
    <!-- Ruby 1.9 over HTTP, using Thin or other back-end application server -->
    <add name="ruby.project#x86" scriptProcessor="ruby.1.9.http"
          path="*" verb="*" modules="HeliconZoo_x86"
          preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
    <add name="ruby.project#x64" scriptProcessor="ruby.1.9.http"
          path="*" verb="*" modules="HeliconZoo_x64"
          preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
    
  4. Create config.ru file with the following content:
    require './app'
  5. Create app.rb file with the following content:
    require 'goliath'
    
    class Hello < Goliath::API
      def response(env)
        [200, {}, "Hello World from Goliath"]
      end
    end