Fishwife¶ ↑
Description¶ ↑
A hard working threaded HTTP 1.1 Rack server for JRuby using Jetty 9. 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. 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).
-
Includes Rack 1.5 Hijacking support for asynchronous response (after headers) streaming via Jetty’s (Servlets 3.1) asynchronous implementation.
-
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 or Java server and don’t include any one-off or 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:
-
Linux systemd, which supports foreground processes (Type=simple), and via socket activation, zero-downtime restarts. See the Guppy Sample Application and its configuration for systemd.
-
Bluepill or God (MRI Ruby) process monitors support foreground processes.
Building from Source and Contributing¶ ↑
You’ll need a working Java 8+ JDK (with javac) and recent JRuby 1.7.x or 9.x on your PATH. Then:
jruby -S gem install rjack-tarpit -v'~> 2.1' jruby -S gem install bundler jruby -S bundle install jruby -S bundle exec rake test
This above is intentionally pedantic to hopefully minimize any confusion.
License¶ ↑
Copyright © 2011-2018 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.