Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Support to use Reel with rack applications #3

Merged
merged 9 commits into from
Aug 5, 2012

Conversation

afcapel
Copy link
Contributor

@afcapel afcapel commented Aug 4, 2012

The server simply delegates rack request to a pool of Reel::RackWorkers which include Celluloid, and so each operates in its own thread.

I've also added a simple option parser to change server configuration from the command line. These are the implemented options:

reel <options> <rackup file>
    -p, --port PORT                  Define what port TCP port to bind to (default: 3000)
    -a, --address HOST               bind to HOST address (default: 0.0.0.0)
    -q, --quiet                      Quiet down the output
    -e, --environment ENVIRONMENT    The environment to run the Rack app on (default: development)
    -t, --threads NUM                The number of worker threads (default: 10)
    -r, --rackup FILE                Load Rack config from this file (default: config.ru)
    -h, --help                       Show help

To use with rails, just add the reel gem to your Gemfile and start the server with

rails s reel

@travisbot
Copy link

This pull request fails (merged d948d06 into 3f56084).

Fixes specs in rbx-2.0.0-dev.
@travisbot
Copy link

This pull request passes (merged 748b2e5 into 3f56084).

class Configuration
attr_reader :options

DEFAULT_RACKUP =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to specify a value here for DEFAULT_RACKUP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that's an old constant I no longer use, the default value is already in DEFAULT_OPTIONS.

I've just removed it.

Thanks Ryan!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I just reviewed the pull request. Looks great!

@travisbot
Copy link

This pull request passes (merged 50bd5c4 into 3f56084).

@travisbot
Copy link

This pull request passes (merged 26ebe4e into 3f56084).

@travisbot
Copy link

This pull request passes (merged 5163b4d into 3f56084).

@travisbot
Copy link

This pull request passes (merged fa4e0ff into 3f56084).

@travisbot
Copy link

This pull request passes (merged 74571d0 into 3f56084).

@tarcieri
Copy link
Member

tarcieri commented Aug 5, 2012

Looks good to me! I'll see if I can get it merged today

@tarcieri tarcieri merged commit 74571d0 into celluloid:master Aug 5, 2012
@tarcieri
Copy link
Member

tarcieri commented Aug 6, 2012

Thanks!

@afcapel
Copy link
Contributor Author

afcapel commented Aug 6, 2012

My pleasure, it's an awesome project!

I am working on fixing the specs and will do a pull request later.

@tarcieri
Copy link
Member

tarcieri commented Aug 6, 2012

Cool, I did some refactoring last night and that's why they're broken. Perhaps they could use a mock connection object for the tests?

@jridgway
Copy link

jridgway commented Nov 4, 2012

I'm able to start my app with rails s reel, but the first request never finishes and after a few more requests everything just hangs. I am also not able to shut down the server without forcibly killing. I tested this on a new/blank rails app and I had the same outcome, though the new rails app did shut down with Ctrl+C after a long time. Is rack support not ready yet? What's missing that I might help with? Thanks! I'm pretty excited to give this a shot.

@tarcieri
Copy link
Member

tarcieri commented Nov 5, 2012

Running Rails on top of Reel is probably a bad idea, at least until Ruby 2.0. This is because Celluloid uses Fibers and they have small stacks (4kB) whereas Rails and the Rack middleware it uses expects big stacks.

Ruby 2.0 will bring with it configurable fiber stack sizes, at which point Fibers on Rails might be a slightly less bad idea ;)

That said, yes the Rack adapter is a bit half-baked and I expect it has some bugs.

@jridgway
Copy link

jridgway commented Nov 5, 2012

Thanks, that really helps. I look forward to Ruby 2.0! :)

digitalextremist added a commit that referenced this pull request Dec 12, 2013
kenichi pushed a commit to kenichi/reel that referenced this pull request Aug 4, 2016
Basic Session Handler API (work in progress)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants