• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Ruby
  • License
    Other
  • Created about 16 years ago
  • Updated about 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mongrel

Mongrel: Simple Fast Mostly Ruby Web Server

DEPRECATED

Please use Unicorn instead.

Description

Mongrel is a small library that provides a very fast HTTP 1.1 server for Ruby web applications. It is not particular to any framework, and is intended to be just enough to get a web application running behind a more complete and robust web server.

What makes Mongrel so fast is the careful use of an Ragel extension to provide fast, accurate HTTP 1.1 protocol parsing. This makes the server scream without too many portability issues.

See mongrel.rubyforge.org for more information.

License

Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed under the Ruby license and the GPL2. See the include LICENSE file for details.

Quick Start

The easiest way to get started with Mongrel is to install it via RubyGems and then run a Ruby on Rails application. You can do this easily:

$ gem install mongrel

Now you should have the mongrel_rails command available in your PATH, so just do the following:

$ cd myrailsapp
$ mongrel_rails start

This will start it in the foreground so you can play with it. It runs your application in production mode. To get help do:

$ mongrel_rails start -h

Finally, you can then start in background mode:

$ mongrel_rails start -d

And you can stop it whenever you like with:

$ mongrel_rails stop

All of which should be done from your application’s directory. It writes the PID of the process you ran into log/mongrel.pid.

There are also many more new options for configuring the rails runner including changing to a different directory, adding more MIME types, and setting processor threads and timeouts.

Install

It doesn’t explicitly require Camping, but if you want to run the examples/camping/ examples then you’ll need to install Camping 1.2 at least (and redcloth I think). These are all available from RubyGems.

The library consists of a C extension so you’ll need a C compiler or at least a friend who can build it for you.

Finally, the source includes a setup.rb for those who hate RubyGems.

Usage

The examples/simpletest.rb file has the following code as the simplest example:

require 'mongrel'

class SimpleHandler < Mongrel::HttpHandler
   def process(request, response)
     response.start(200) do |head,out|
       head["Content-Type"] = "text/plain"
       out.write("hello!\n")
     end
   end
end

h = Mongrel::HttpServer.new("0.0.0.0", "3000")
h.register("/test", SimpleHandler.new)
h.register("/files", Mongrel::DirHandler.new("."))
h.run.join

If you run this and access port 3000 with a browser it will say “hello!”. If you access it with any url other than “/test” it will give a simple 404. Check out the Mongrel::Error404Handler for a basic way to give a more complex 404 message.

This also shows the DirHandler with directory listings. This is still rough but it should work for basic hosting. *File extension to mime type mapping is missing though.*

Contact

E-mail the Mongrel list at rubyforge.org/mailman/listinfo/mongrel-users and someone will help you. Comments about the API are welcome.

More Repositories

1

has_many_polymorphs

An ActiveRecord plugin for self-referential and double-sided polymorphic associations.
Ruby
202
star
2

bleak_house

A Ruby library for finding memory leaks
Ruby
189
star
3

ultrasphinx

Ruby on Rails configurator and client to the Sphinx full text search engine
Ruby
170
star
4

peep

A heap inspector for live memcached instances.
Ruby
104
star
5

echoe

A Rubygems packaging tool that provides Rake tasks for documentation, extension compiling, testing, and deployment
Ruby
82
star
6

interlock

A Rails plugin for maintainable and high-efficiency caching
Ruby
75
star
7

ccsv

A pure-C CSV parser for Ruby
Ruby
64
star
8

raspell

A Ruby binding for the Aspell spelling checker
C
59
star
9

sweeper

A Ruby script to automatically tag your music collection with metadata from Last.fm
Ruby
32
star
10

thrift-rb

Ruby bindings for Thrift, with patches.
Ruby
18
star
11

allison

A modern, pretty RDoc template
Ruby
11
star
12

sinatra-jar

Sample monolithic dependency-free Sinatra JAR
Ruby
11
star
13

heroku-hello-world-tests

Ruby
9
star
14

kirby

A super-clean IRC bot with sandboxed Ruby evaluation, repository watching, and link-logging to del.icio.us
Ruby
9
star
15

benchmark_unit

Machine-independent benchmark assertions for your Ruby unit tests
Ruby
7
star
16

fftw3

Gem version of T. Horinouchi's ruby-fftw3.
C
7
star
17

rv

A little init.d system for running Camping apps
Ruby
6
star
18

twist

A Ruby script for logging your system events to Twitter
Ruby
6
star
19

mysqlconfs

MySQL configuration examples
5
star
20

charm_http

A parallel EC2 driver for running the hummingbird HTTP load testing tool against Heroku.
Ruby
4
star
21

shadow

A zero-configuration RESTful ActiveRecord server
Ruby
3
star
22

autobench-grapher

Ruby
2
star
23

wordpress_importer

Script that can import a homegrown blog into WXR format for WordPress.com.
Ruby
1
star
24

cloudbur.st

Cloudbur.st static assets
HTML
1
star
25

js-node

JavaScript
1
star
26

bax

A hacky blog engine that runs via recursive SSI includes
Ruby
1
star
27

scala-finagle

Scala
1
star
28

search_benchmark

Ruby
1
star
29

stub

A stub gem, including C extension.
Ruby
1
star