Appendix C. Deploying web apps
In chapter 8, we looked at tools to deploy Ruby (both web and off-the-web) applications. Here, we’ll look at specifics and the architecture for deploying web applications. There is certainly no shortage of options. So which deployment method is right for you?
We’ll start by briefly reviewing the available options, then narrow it down to one particular architecture that works best across the board, from local use during development to deploying for production on a server farm. We’ll show you how to deploy for this architecture using Apache 2 and Nginx as frontend web servers and Thin and Mongrel as backend application servers.
The original model for deploying applications behind web servers was CGI. When using CGI, the web server starts a new process to handle each incoming request. That may be good enough for simple and oft-used scripts, but if you’re using a web framework or opening database connections, the cost of setting these up for each request will quickly bring your server to its knees. Since most web applications fall into the latter category, we’ll turn our attention to better-performing options.