Prev | Current Page 476 | Next

Brad Ediger

"Advanced Rails"

It takes a configuration file, which specifies how many Mongrels
to run, with a range of port numbers to expose to the load balancer. The cluster servers
can then be started and stopped at once with the simple commands:
mongrel_rails cluster::start
mongrel_rails cluster::stop
mongrel_rails cluster::restart
Figure 10-8. Serving a Rails application with FastCGI
Apache/
Lighty +
mod_fastcgi
FastCGI
worker
FastCGI
worker
FastCGI
worker
Internet FastCGI
Rails Deployment | 321
Capistrano
Once you have a server set up and running smoothly, you need a way to deploy your
application from the repository to the server. The na??ve process of sshing into the
server, updating the code, and restarting the server process gets old very quickly, and
it is error-prone.
Enter Capistrano (http://capify.org/): a framework for scripting interaction with
remote machines. Capistrano started out as a deployment framework (it was originally
called SwitchTower). As people started using it for wider and more varied purposes,
it evolved into a general framework for executing commands in parallel on a
set of remote servers. In version 2.0, deployment is only a subset of the functionality
available through Capistrano, and the deployment tools must be explicitly loaded.
Capistrano, like the rest of Rails, follows the convention over configuration paradigm.
In general, the more ???mainstream??? your situation, the less configuration you
will have to write.


Pages:
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488