Skip to content

Distribute your rack apps across the network automatically with bonjour

Notifications You must be signed in to change notification settings

dsturnbull/rackjour

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation
+------------
| gem install rackjour

Usage
+-----
| in your config.ru, use Rackjour::Master
| 
| on your app servers, run 'rackjour' (takes -d for daemon mode)
| 
| rackjour will distribute your app to each host running rackjour,
| and run each rack app in your rackup config on the least loaded host
| 

Example
+-------
| in rackjour/spec/fixtures/example_app/
| $ rackup
| 
| in another terminal
| $ rackjour
| 

Details
+-------
| 09:09 <dav> so basically... you run 'rackjour' on some host, and it advertises itself as a rackjour worker, via
|             bonjour
| 09:09 <dav> when you run a rack app that uses Rackjour::Master, it starts a thread that looks for these rackjour
|             workers
| 09:10 <dav> when it does, it tars itself and sends itself to the other host, and then runs each rack app on there
| 09:10 <julio> ok... so instead of deploying to multiple hosts
| 09:10 <julio> you use that
| 09:10 <dav> yes
| 09:10 <dav> when a request comes in to the rack app, when it gets to Rackjour::Master#call, it looks at @servers for
|             valid hosts and sends the request there
| 09:10 <dav> by "sends the request there" i mean
| 09:10 <julio> yeah, sends the environment
| 09:10 <julio> parsed by rack
| 09:11 <dav> it iterates over all rack apps configured, calling each one in turn
| 09:11 <dav> in the example, it's "use Rackjour::Master; use Pokey; use Geokit; run Example"
| 09:11 <dav> so Rackjour::Master#send: @servers.random.call(Example, @servers.random.call(Geokit,
|             @servers.random.call(Pokey, env)))
| 09:11 <dav> basically
| 09:12 <dav> it's not actually hardcoded like that
| 09:12 <julio> so theres 2 things its doing there
| 09:12 <julio> 1) its sparing me from having to deploy because its copying my app
| 09:12 <julio> 2) it distributes requests
| 09:12 <julio> ?
| 09:12 <dav> yeah you just run rackup
| 09:12 <dav> and it deploys
| 09:12 <dav> and load balances
| 09:12 <dav> although the load balancing is not actually in the code yet
| 09:12 <dav> it's really just @servers.first.call
| 

About

Distribute your rack apps across the network automatically with bonjour

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages