Download presentation
Presentation is loading. Please wait.
Published byMelinda McDonald Modified over 8 years ago
1
GlassFish Gem Vivek Pandey Sun Microsystems, Inc. Vivek.Pandey@Sun.COM
2
2 What is gem? > Ruby packaging system > Standard format for distributing Ruby programs and libraries > An easy to use tool for managing the installation of gem packages ● gem install > You can serve Ruby gem from your own server
3
3 Overview of Glassfish gem > Based on GlassFish v3 Kernel > Lightweight: 3.4 MB > Easy installation ● gem install glassfish > Run any Rack based Ruby application ● Rails, Merb, Sinatra, Ramaze... > http://glassfishgem.rubyforge.org/
4
4 By Default... > One command ● glassfish > Deploy a Rails, Merb, or Sinatra app ● With the root in the current directory ● On port 3000 ● With context root '/' ● In the development environment ● Logging to./log/glassfish.log ● Using a single JRuby runtime > Normally fine for most things
5
5 Let's start changing things! > -c, --contextroot PATH > -p, --port PORT > -e, --environment ENV ● One of development, test, or production > --log-level, control how much log you want to see > -l, log file to log message to
6
How Can You Be In Two Places At Once? > -n, --runtimes NUMBER ● Activates the JRuby runtime pool for non-threadsafe applications ● Automatically creates and manages multiple Rails instances for your application ● Control size with --runtimes-min and --runtimes-max ● Normally safe to use 1 and the limit of your server ● Not applicable with config.threadsafe! or thread-safe frameworks ● Option is ignored
7
Daemons in the Deep! > -d, --daemon ● Enter daemon mode (Unix and Linux only) > -P, --pid FILE ● file to store PID information for daemonized gem ● Defaults to tmp/pids/glassfish.pid
8
In Case Something Goes Wrong > -l, --log FILE ● file to write the server log to ● Defaults to./log/glassfish.log ● -l or --log with no arguments logs to console > --log-level {0-7} ● Sets the log level ● Higher levels will generate more logging ● Default 3 (INFO)
9
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
10
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
11
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
12
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
13
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
14
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld
15
Anatomy of a GlassFish > glassfish -c /helloworld/ -p 80 -e production -n 2 --runtimes-min 1 --runtimes-max 4 -d -P /home/jacob/rails/helloworld/pid -l /home/jacob/rails/helloworld/server.log --log-level 1 /home/jacob/rails/helloworld > Somewhat contrived
16
I'm Not Typing That Every Time! > --config FILE ● Reads configuration data from a file ● Generate a template file using “gfrake config” ● yml format
17
17 gfrake > GlassFish rake command ● gfrake -T > Create glassfish.yml file ● gfrake config > Clean GlassFish temporary files ● gfrake clean > Clean inactive PID files ● rake tmp:pids:clear
18
So, what does this mean? > Can replace Mongrel/Thin in both development and production > Equivalent or faster speed > Fully threaded implementation ● Pooled Rails instances ● Threadsafe Rails ● Minimal locking
19
What else does this mean? > Same environment in development and production > Proven stability and engineering ● Same code and web server as GlassFish V3
20
When Should I use Gem? > You want the stability and power of GlassFish without having to set up a full app server > You want a Ruby-like way of doing things > You don't need the other capabilities of a full GlassFish server
21
But I want Automated Management! > GlassFish Gem works with Capistrano ● GlassFish server does too > Only minimal changes needed, can be a drop-in replacement in existing scripts and deployments ● Each Capistrano task is just a remapping of an existing command > Example scripts available at http://blogs.sun.com/Jacobkessler/entry/capistrano_ and_glassfish_now_with
22
Vivek Pandey Vivek.Pandey@Sun.COM
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.