Oracle GlassFish Server 3.0.1 Scripting Framework Guide

Deploying and Running a Rails Application

There are two general ways to deploy a Rails application on GlassFish Server:

The reminder of this section explains how to deploy a Rails application to GlassFish Server as a directory. For more information about running Rails applications using GlassFish v3 Gem, see To Run a Rails Application on GlassFish v3 Gem.


Note –

These procedures provide only the most basic deployment instructions. For comprehensive information about deploying applications to GlassFish Server, refer to the Oracle GlassFish Server 3.0.1 Application Deployment Guide.


ProcedureTo Deploy a Rails Application as a Directory Using the asadmin Command

The following procedure explains how to use the asadmin command to deploy the sample hello application as a directory within a GlassFish Server domain, and how to access the application from your web browser. You can also use these same instructions to deploy any Rails application to GlassFish Server.

Before You Begin

These instructions build upon the example hello application described in Creating a Simple Rails Application.

  1. Start the GlassFish Server domain to which you want to deploy the application:


    asadmin start-domain domain-name
    
  2. Change to the directory where you created the sample application.

    For example:


    cd /apps/jruby-apps/hello
    
  3. Deploy the hello application with asadmin command:


    as-install/bin/asadmin deploy hello
    
    • If you want to use a different JRuby instance than the update installation or the instance you configured with the configure-jruby-container command, you can use the following deploy-time option:


      asadmin deploy --property jruby-home=jruby-install
      
  4. Run the hello application using the following URL in your browser:


    http://localhost:8080/hello/

ProcedureTo Run a Rails Application From the GlassFish Server autodeploy Directory

As with the instructions in To Deploy a Rails Application as a Directory Using the asadmin Command, this procedure builds upon the example hello application described in Creating a Simple Rails Application.

  1. Copy the entire hello application directory to the as-install/glassfish/domains/domain-dir/autodeploy directory.

    For example:


    cp -r /apps/jruby-apps/hello glassfishv3/glassfish/domains/domain1/autodeploy
    
  2. Run the hello application using the following URL in your browser:


    http://localhost:8080/hello/