Deploying Rails: Automate, Deploy, Scale, Maintain, and Sleep at Night
Anthony Burns and Tom Copeland (Pragmatic Bookshelf, paperback)
Maybe you have been studying Ruby and Rails and now feel ready for the next big step. Perhaps you are already on a job where a Rails application needs to be deployed and running on a server ASAP. Or, maybe you manage a team that must deploy and support a Rails app, and you want to understand more of what they actually must accomplish to get the app up and running – and keep it running.
Deploying Rails is a very good guide to the decisions that must be made and to the tools and best practices essential for success. The two writers are both professional Rails developers with strong backgrounds.
Their 217-page book, they note, “is “centered around an example social networking application called MassiveApp. While MassiveApp may not have taken the world by storm just yet, we’re confident that it’s going to be a winner, and we want to build a great environment in which MassiveApp can grow and flourish. This book will take us through that journey.”
That “journey” is organized into 10 chapters and two appendices, all well written and illustrated with code examples.
- Chapter 1: Introduction – (including choosing a hosting location)
- Chapter 2: Getting Started with Vagrant – (setting up and managing a virtual server and virtual machines)
- Chapter 3: Rails on Puppet – (“arguably the most popular open source server provisioning tool.…”)
- Chapter 4: Basic Capistrano – (“the premier Rails deployment utility….”)
- Chapter 5: Advanced Capistrano – (deals with making deployments faster and also easier when “deploying to multiple environments.”)
- Chapter 6: Monitoring with Naigos – (monitoring principles and how to apply them to Rails apps. Also, how to perform several types of checks.)
- Chapter 7: Collecting Metrics with Ganglia – (how to gather a Rails app’s important metrics from an infrastructure level and an application level.)
- Chapter 8: Maintaining the Application – (how to handle “the ongoing care and feeding of a production Rails application.”)
- Chapter 9: Running Rubies with RVM – (using the Ruby enVironmental Manager [RVM] in development and deployment.)
- Chapter 10: Special Topics – (“We’ll sweep through the Rails technology stack starting at the application level and proceed downward to the operating system, hitting on various interesting ideas as we go.”)
The two appendices cover (1) “a line-by-line review of a Capistrano deployment file” and (2) “deploying MassiveApp to an alternative technology stack consisting of nginx and Unicorn.”
A key focus of the book is building a set of configuration files and keeping the latest versions stored in Git, so deployment of a new or updated app can go smoother.
Deploying a Rails app involves making many different choices, and the process can go wrong quite easily if not set up properly.
“The most elegant Rails application,” the authors caution, “can be crippled by runtime environment issues that make adding new servers an adventure, unexpected downtime a regularity, scaling a difficult task, and frustration a constant.
“Good tools do exist for deploying, running, monitoring, and measuring Rails applications, but pulling them together into a coherent whole is no small effort.”
Deploying Rails can significantly ease the complicated process of getting a new Rails application running on a server. Equally important, Rails experts Anthony Burns and Tom Copeland can show you how to keep the app running smoothly and configured for growth as it gains users, functionality, and popularity.
— Si Dunn