A 1 hour presentation of how GlassFish v3 Prelude provides support for Scripting / Dynamic Languages. Ruby/JRuby/Rails and Groovy/Grails are specifically described.
6. Why Ruby on GlassFish?
⢠GlassFish v3 server is tested platform
> Co-host Java and Rails
> Known Deployment and Management
⢠âGreenâ alternative â One command, One instance,
One process
⢠Multiple Requests by a Single Application
⢠Database Connection Pooling
⢠Not just Rails â Merb, Sinatra...
6
7. More benefits...
⢠No packaging, simple deployment
> asadmin deploy depot/
⢠Deploy as WAR
> warble #creates WAR file
> asadmin deploy depot.war
⢠Tested JRuby runtime at Updatecenter
> bin/updatetool
> No more config needed
⢠Commercially supported by Sun
⢠http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide
7
8. GlassFish v3 Runtime
Grizzly Listener
.
Rails Web . XXX
Adapter Adapter Adapter
.
Rails
Runtime
Pool
JRuby
8
9. Runtime Pool Management
⢠Automatic JRuby runtime pool management
Gem Create
JRuby Rails
Startup Runtime
JRuby
Load Rails
Environment
Add to Rails
Runtime
Pool JRuby
9
10. Configuring JRuby Runtime Pool
⢠On GlassFish v3 Prelude Server
> System properties
â -Djruby.runtime.min : Sets the fewest runtimes to have in the
pool
â -Djruby.runtime : Sets the initial number of runtimes to create
â -Djruby.runtime.max : Sets the maximum number of runtimes to
have active
> Add these system properties as <jvm-options> elements
inside domain.xml
> Or, if using java CLI simply provide it using -D option
â java -Djruby.home=... -Djruby.runtime.max=2 -jar
modules/glassfish.jar
10
11. Configuring JRuby Runtime Pool
⢠GlassFish gem
> CLI options
â -n, --runtimes
â Number of JRuby runtimes to crete initially
â --runtimes-min
â Minimum JRuby runtimes to crete
â --runtimes-max
â Maximum number of JRuby runtimes to crete
> glassfish -n 2 âruntimes-min 1 âruntimes-max 6
â Starts glassfish gem with 2 JRuby runtimes, the minimum pool
size is 1 and maximum size it can grow up to is 6
11
18. Groovy on Grails
⢠An MVC frameworks
⢠Based on Groovy, Spring, Hibernate, SiteMesh
> But hides all the complexity
⢠Adopts Rails paradigms
18
19. Grails â Setup and Installation
⢠Install Grails IPS package using updatetool
> Grails package is installed inside 'glassfish' directory
⢠Grails IPS package
> Provides the following benefits over Grails distributions
found elsewhere
â grails shaed-war
â Lightweight, efficient application WAR
â Less prone to OOM due to lack of PermGen space on hot deployments
â grails run-app
â Runs GlassFish v3 Prelude in embedded mode
â Develop and test your grails app on the same server you would deploy
during production
⢠Set GRAILS_HOME environment variable
> export GRAILS_HOME=glassfish-install/grails
19
20. Groovy on Grails - Updatecenter
⢠glassfish-install/bin/updatetool
20
21. Groovy on Grails
⢠Development and production on the same server
> Develop using GlassFish v3 embedded server
â grails run-app
21
22. Groovy on Grails
⢠Development and production on the same server
> Develop using GlassFish v3 embedded server
â grails run-app
> Production deployment
â asadmin deploy grailsApp.war
22
23. Groovy on Grails
⢠Development and production on the same server
> Develop using GlassFish v3 embedded server
â grails run-app
> Production deployment
â asadmin deploy grailsApp.war
⢠Efficient WAR packaging
> grails shared-war
â Creates smaller WARs ~200KB vs 18MB
â asadmin deploy â-libraries $GRAILS_HOME/lib/glassfish-
grails.jar grailsApp.war
23
24. Groovy on Grails
⢠Development and production on the same server
> Develop using GlassFish v3 embedded server
â grails run-app
> Production deployment
â asadmin deploy grailsApp.war
⢠Efficient WAR packaging
> grails shared-war
â Creates smaller WARs ~200KB vs 18MB
â asadmin deploy â-libraries $GRAILS_HOME/lib/glassfish-
grails grailsApp.war
⢠For details
> http://wiki.glassfish.java.net/Wiki.jsp?page=GrailsGettingStarted
24
25. Groovy on Grails â Screencast
⢠From Zero to Grails in 5 minutes with GlassFish v3 Prelude
> https://slx.sun.com/1179271912
25
26. Jython on Django
⢠Jython 2.5 nearing release
> Jython 2.5 beta out
> Being developed at
â http://www.jython.org/Project/
⢠Currently WAR deployment approach
> Using Django-Jython project
â http://django-jython.googlecode.com/
⢠Native Django application deployment in works
26
30. Scala on Lift
⢠Lifts apps packaged as WAR
> asadmin deploy liftApp.war
⢠For details on developing and deploying Lift
applications see
> http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedWithLiftOnGlassFish
30