Deploying and Running a Rails Application
As described in JRuby on Rails, the Sun GlassFish Enterprise Server v3 Prelude, and the GlassFish v3 Gem, you have two
ways to deploy your Rails application on the Sun GlassFish:
This section shows you how to deploy the hello application you created
in the previous section natively and with the GlassFish v3 Gem and how to
run the application in your web browser. You can also use these same instructions
to deploy a legacy Rails application.
Deploying a Rails Application as a Directory
You can use directory-based deployment to deploy any Rails application
natively to the Sun GlassFish Enterprise Server. To natively deploy the hello application to the Enterprise Server:
-
Set JRUBY_HOME property value to the path to
your JRuby installation as the last line in one of the following files, located
in the config directory of Enterprise Server your installation:
-
Save the file.
-
Edit <AS_INSTALL>/domains/domain1/config/domain.xmland
add this entry inside element:
<java-config>
...
<jvm-options>-Djruby.home=<JRUBY_HOME></jvm-options>
...
</java-config>
Note –
If GlassFish v3 JRuby IPS package was installed using update tool,
then there is no need to set the jruby.home system property
-
Start the server.
-
Go to <JRUBY_HOME>/samples.
-
Deploy the hello application with asadmin command from your Enterprise Server installation:
<AS_INSTALL>/bin/asadmin deploy hello
-
Run the hello application using the following
URL in your browser:
http://localhost:8080/hello/home/index
Deploying a Rails Application to the GlassFish v3
Gem
-
Go to <JRUBY_HOME>/samples.
-
Deploy the hello application:
jruby -S glassfish_rails helloV3
When the GlassFish instance is finished launching, you should see output
similar to the following:
INFO: Rails instance instantiation took : 37754ms
-
Run the application using the following URL in your web browser:
http://localhost:3000/home/index
You should now see the following message in your browser window:
Welcome to JRuby on Rails on the Sun GlassFish Enterprise Server!
Notice that the GlassFish v3 Gem runs on port 3000, not 8080.