UPDATE: Michael Trojanek has kindly offered readers of this blog a 20% discount by using the coupon code “iftheshoefritz” when buying the book.
Who should read Efficient Rails Devops?
You stand to gain something if:
- you’re new to Rails hosting and deployment, and tools that do the work for you (think Engine Yard or Heroku) won’t cut it.
- you’re interested in learning how deployment can be automated
- you’re sheltered from the deployment process and your lack of knowledge is holding you back. Maybe the “deployment gal/guy” on your team has become a bottleneck, or it’s hard for you to debug production issues.
If you fall into one of these categories, I recommend Efficient Rails Devops by Michael Trojanek (ERDO for short) as an introduction.
I’m pretty pleased with my purchase of ERDO. It’s a great resource for someone in the situation I was in a few years back: no devops experience, and suddenly I needed to do automated Rails deployments without tools like Heroku.
ERDO shows you how to roll your own automated deployment process for a simple Rails app. For all but the smallest projects you will have go further than this book, but if you don’t know what it takes to deploy to production from scratch, it’s a great starting point.
My motivation for finding the book was that I loved Heroku’s automation that I had just been told to do without. I didn’t want to go back to an error-prone manual deployment process. I had visions of vital command line options left off one command in a long list and someone losing money because of me. Or a server crashing in the middle of the night and having to set up a new one in a hurry, unable to remember exactly what I did last time to make it work. Heroku ruined me: I couldn’t leave without an automated process to replace it.
Ultimately I learned how to replicate the hosting and deployment features that I needed from this book, while improving my knowledge of web hosting and related topics (e.g. linux user management and security). I learned about automating configuration with Ansible. This knowledge served me well moving into a new job where a lot of effort was going into working out how to do devops well. There were a lot of other people in the room with good (better) knowledge, but I was able to keep up thanks to the projects where I used what ERDO taught me. And speaking of those projects, I did manage to cut another client’s hosting bill by 85% by moving from Heroku to AWS. Not bad.
So What’s Actually in the Book?
ERDO gives detailed instructions (you can copy code word for word) on how to build an automated production deployment process for a simple Rails app. You trigger everything with a single command on your local machine to configure a server that can be anywhere on the Internet.
For most of the book (125 pages) you’re practising on a virtual machine created using Vagrant and VirtualBox from a minimal CentOS image. The OS and necessary software (git, Nginx, Ruby, Unicorn, MySQL, etc.) are installed and configured using Ansible from outside the VM. If you’ve never used it before, you can think of Ansible as a way of scripting these sorts of chores (and a lot more) in a way that they can be run many times over on many different machines, without ever logging in to them yourself.
At this point you have a set of easy to read, cross platform (mostly), and declarative Ansible files that you can check into version control just like your other code. You can configure an “empty” box remotely with one Ansible command, and deploy new versions of your app with another. The basics of security are covered.
The book then makes an elegant switch from your virtual staging server to a real production server. This takes very little effort because of the power of your new Ansible project. There are a small number of changes for things that you might not bother with on a staging server that are covered in the remaining 40 pages.
What’s Not Covered in ERDO?
This book is not concerned with how you obtain your server; it does not go into how to create or rent them from a hosting provider. And it assumes that when you have the machines, they will work with what has been prepared in the book. It’s mostly correct. For my own app on AWS I did have to do some alterations to get this configuration working. That’s more to do with decisions Amazon has taken than a problem with the book. I’ve conversed with Michael and he does have plans for a future edition that covers deployment to AWS with Docker.
It’s also (of necessity) only looking at deployment of a very simple app. There’s a single server that hosts the app, assets, and database. It only covers installation of MySQL. That said, it was easy for me to change recipes to install PostgreSQL instead, and then later on point the app to Amazon RDS.
If you’re wanting load balancing and auto scaling, you’re out of luck. Actually, congratulations on having a product with real users. If you know nothing and you need this stuff it’s probably time to compare the cost of a cloud provider with what it would cost to pay someone with a lot of experience.
Finally, while the book is very good at showing the steps necessary for automated deployment, it is not a reference for each individual piece that needs to be configured. For instance, it covers how to use Ansible to configure SELinux, but does not go into detail on what SELinux is. References to SELinux are scattered throughout, but they’re not packed together coherently because SELinux is not the focus.
What I Gained from Reading ERDO
I shared earlier about saving clients money. Obviously I’m pleased with that, but I’m even more please with the knowledge gained. It’s been helpful understanding other configuration management tools like Chef and Terraform that I encountered later. It’s also given me a some idea about what’s going on under the hood in PaaS technologies like Heroku and Engineyard. There’s a lot of debugging effort saved when you understand what the tool you’re using is supposed to do.
subscribe via RSS