Presentation is loading. Please wait.

Presentation is loading. Please wait.

Know Your GlassFish Gem Jacob Kessler. Overview ● Fast, simple, easy – gem install glassfish – glassfish. ● Everything from GlassFish to serve a Ruby.

Similar presentations


Presentation on theme: "Know Your GlassFish Gem Jacob Kessler. Overview ● Fast, simple, easy – gem install glassfish – glassfish. ● Everything from GlassFish to serve a Ruby."— Presentation transcript:

1 Know Your GlassFish Gem Jacob Kessler

2 Overview ● Fast, simple, easy – gem install glassfish – glassfish. ● Everything from GlassFish to serve a Ruby on Rails application in Gem form ● Production-ready

3 By Default... ● Default 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

4 Let's start changing things! ● -c, --contextroot PATH ● -p, --port PORT ● -e, --environment ENV – One of development, test, or production ● Change some basic things about the server – Self-explanatory

5 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

6 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

7 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)

8 You Can't Get There From Here... ● Final token is the path to the application to deploy – Defaults to current directory (glassfish.) – glassfish /home/jacob/rails/helloworld

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 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

18 What else does this mean? ● Same environment in development and production ● Proven stability and engineering – Same code and web server as GlassFish V3

19 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

20 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_a nd_glassfish_now_with

21 Capistrano


Download ppt "Know Your GlassFish Gem Jacob Kessler. Overview ● Fast, simple, easy – gem install glassfish – glassfish. ● Everything from GlassFish to serve a Ruby."

Similar presentations


Ads by Google