Fishwife

Description

A hard working threaded HTTP 1.1 Rack server for JRuby using Jetty 7.x or 9.x. Fishwife deploys and operates like other Ruby HTTP servers/rack handlers such as Mongrel or Puma. No Java legacy war files (e.g. warbler) required.

As compared to similar projects, most notably Mizuno from which it was originally forked, Fishwife offers the following unique features:

  • Depends on the rjack-jetty gem which closely tracks the upstream Jetty project, currently for versions 7.x and 9.x. You can test and control the version of Jetty you use, for example via Bundler, independent of the Fishwife release.

  • Fishwife may itself be embedded in your own custom server/launcher where you have total control over JVM options like heap size, number of threads, and other initialization/configuration details. For an example, see: boxed-geminabox and notes in #6.

  • Logging is unified across Jetty, Fishwife, and your application via rjack-slf4j and on to any supported output adapter. (See Logging below)

  • Rack output streaming is optimized in a custom java extension.

  • Simple foreground server. Compatible with several real process monitors (See Process Monitoring below)

Synopsis

To use Fishwife with your Rack app and config.ru:

gem install fishwife
cd /path/to/my/rack/app

Then:

fishwife

-or-

rackup -s Fishwife

See also:

  • Fishwife::HttpServer::new supported options

  • example/config.ru

  • Notes below on Logging and Process Monitoring

Logging

Fishwife requires rjack-slf4j which provides a unified interface for Java/Ruby logging. Jetty auto-detect SLF4J’s presence and logs there. A logging output provider must also be loaded. The fishwife script will load rjack-logback if found or otherwise fall back to ‘rjack-slf4j/simple`. If you are starting Fishwife through some other means than the fishwife script, you will need to load an output provider (see linked docs and notes in #6).

Process Monitoring

We assume this isn’t your only production ruby server and don’t include any one-off, half-baked process control and monitoring features. Note that Unix-like fork(2) is not safe on the JVM and thus from JRuby so its not practical to support a fishwife –daemon flag. Fishwife simply logs to STDERR by default. Instead consider using:

  • Bluepill or God (MRI Ruby) process monitors support self-forking of foreground processes, for example ‘rackup` or `fishwife`.

  • The Iyyov (JRuby) process monitor supports self-daemonizing via the hashdot launcher. Your app can also be packaged/updated as a gem if desired. For an example see: boxed-geminabox.

  • Linux systemd

All options also support redirecting log output (including any JVM-level errors) to a file. Iyyov supports log rotation internally. Unix-like logrotate(8) may be used with the former process monitors.

License

Copyright © 2011-2016 David Kellum

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mizuno

Copyright © 2010-2011 Don Werve

Licensed under the Apache Public License, version 2.0.

Jetty

Jetty is dual-licensed under the Eclipse and Apache open-source licenses, and its development is hosted by the Eclipse Foundation.