„Screw it! — Moving my Rails app to production takes more time than developing it!“
Your Rails application is the heart of your business. Built with the utmost care, adhering to best practices, and tested extensively. You trust your codebase and you can hardly await your first customers.
But before you can lean back and monitor your dashboard for incoming sales, there is an intermediate step you postponed for as long as possible: Moving your application from your development machine into the wild.
You already tried hosting your application with a PaaS like Heroku, EngineYard, or Ninefold only to find out that they do not quite cut it for you:
For serious apps, they are awfully expensive.Don't let their free tier lure you into thinking that they are offering a great deal: While their smallest offerings are enough for hobby projects or a shortcut to quickly test a production app in the wild, a PaaS is going to cost you a lot of money as soon as your application needs background jobs, caching or monitoring. They even charge you for more database rows.
They make you worry about data integrity.With new leaks being exploited every other day, having your valuable customer data stored on someone else's server does not contribute to a peaceful sleep. Neither does having to rely on someone else to apply the latest patch to a system library.
They prevent you from becoming a better developer.No specific Ruby versions, no cutting-edge application servers, no exotic database — only what the service provides. This shields you from operations — a topic serious developers must not neglect — and prevents learning new marketable skills which will become more and more important in the future.
You are on a point where you have outgrown hosting with a PaaS and realize that rolling your own infrastructure is the way to go.
But there is a wealth of information to digest before you are even able to provision a Rails stack and a lot of questions need to be answered.
„Moving to production defeats Rails' agility in minutes.“
Picture yourself having all the needed information to spin up a server from the ground up — without needing to hunt down every tiny drip of wisdom scattered around the web — plus a dedicated workflow to turn this information into a blueprint to apply to any bare naked machine:
You spin up a Rails server in minutes.Setting up and configuring a Rails server requires a lot of steps, but you only have to worry about them once: When you build your server's blueprint which will make provisioning of every future machine a no-brainer — be it in your staging or production environment.
You deploy your app with a single command.Worry-free deployments mean that you can push new releases as soon as they are ready. Not having to rely on some highly opinionated deployment tool means that you can tweak each of your applications' deployment process to be most efficient.
You learn marketable skills no tool can replace.Rails is based on Rack — and so are many other great Ruby web frameworks. Why not use your knowledge to host and deploy your Sinatra/Hanami/Camping apps the same way?
Your application development reaches a whole new level:
„There will no longer be a difference between running your app locally and serving it to your customers.“
The problem is gathering all the necessary knowledge, most of which is buried inside of half-assed blog posts and outdated tutorials. Finding and evaluating this information is demoralizing and takes days, weeks or even months of trial-and-error — time you would rather spend on developing awesome products for your customers.
Unfortunately, up until a few years ago there has not been a single resource providing you with distilled information on how to efficiently build your environment this way.
Then there was. And now it is back in its awesome third edition.
More than 19 years of Rails operations experience squashed into a book
Efficient Rails DevOps is the result of more than a decade of experience releasing Rails applications and reliably running them in production.
It covers the most efficient approach to serving Rails applications for small businesses, bootstrappers, and enthusiasts.
This third edition of Efficient Rails DevOps is a complete rewrite of the already refined second edition, teaching the process that has served me perfectly as long as I can think of in powering every Ruby-based web application I built in the last 19 years.
It incorporates valuable feedback from readers as well as recent changes and additions to the Rails world and covers (among other things):
Provisioning a Rails server in a repeatable waySetup a battle-tested Rails stack (rbenv, nginx, Puma, and MariaDB/PostgreSQL) on CentOS or Ubuntu using Ansible, a popular and very easy to grasp configuration management tool. Gain the knowledge to swap out and reconfigure any component to suit your app's demands.
Securing your machineProtect your production box against the evil in this world by applying best practices to your firewall, webserver, file permissions, and SELinux. Learn how to serve your application encrypted using an SSL certificate from Let's Encrypt at no additional cost.
Deploying your applicationMaster the steps needed to cold deploy your app and push new releases in a matter of seconds, with a single command.
By building a reusable and versioned playbook you'll be able to seamlessly switch between staging and production environments, allowing you to test out new features of your application in an isolated environment to eliminate the fear of breaking something when pushing to production.
Along the way, you'll demystify the inner workings of a Rails server. Knowing exactly what needs to be done makes switching technologies easy — every hosting approach builds on this knowledge after all (no matter if it involves a physical server, a virtual machine, or a container).
You'll free up precious time to concentrate on building awesome products for your customers instead of constantly struggling with deceptive error messages or unexplainable HTTP 500s.
Don't take my word for it.
I spent years making Efficient Rails DevOps the definitive guide on the subject, so I'm quite biased. Fortunately, you do not have to believe me that this book will forever change your view on Rails operations.
Years ago, I spent 2 weeks and literally thousands of dollars of productive time learning by trial and error (many, many errors!) how to automate our server provisioning and Rails application deployment with Ansible.
If Michael had written his book sooner, I could have set up the same automation in an afternoon …
If you’re looking on migrating away from expensive black box PaaS or from wonky shell scripts, get this book.
Gabriel Fortuna
This book was instrumental in helping our company effectively use Ansible to automate and orchestrate all our client's infrastructure. It's an invaluable resource, and has paid dividends many times over.
Unreservedly recommended!
Wayne Hiner
Thanks for a great book!
I've read it cover-to-cover already. I've been deploying Rails applications for 3 years and I have picked up a bunch of tricks, both large and small, that I hadn't learned on my own.
Gergana Dimova Marketing wizard
To me, it's clear that this book will save developers HOURS of time and TONS of frustration, trying to figure out what they did wrong. I especially like how you tackled all security issues and explained why you did what you did. Top that with the fact that this is a bulletproof, foolproof process that's been refined over the course of 10 years and you've got a robust sure-fire method for deploying Rails apps.
This book is a piece of gold and a must-have for anyone doing DevOps. You need to get that into the hands of the people who actually need it.
It was easy to follow and concise. It helped me greatly in automating some of our infrastructure setup and gave very helpful practical examples of how to use Ansible.
I think it provides a much needed resource for a neglected area of tech.
It's been great for me getting a client off Heroku. It's in such great detail, which is helpful for me as a complete DevOps beginner.
Efficient Rails DevOps comes in 2 editions
Complete edition
$ 6999.-
The book 217 pages, DRM-free PDF. Carefully handcrafted, including a working table of contents and navigatable outline.
Free updates Minor and major updates for life.
Code repository Dedicated commits for each chapter — as starting point or to track your progress.
Book only
$ 4999.-
The book 217 pages, DRM-free PDF. Carefully handcrafted, including a working table of contents and navigatable outline.
Free updates Minor and major updates for life.
In order to be PCI compliant (and to provide maximum security for your transaction), it is required that you enable JavaScript — it is not possible to buy the book from this page with JavaScript disabled.
Efficient Rails DevOps is not about developing Rails applications (so your Rails developing experience does not matter) — it is about operating them. In this regard, it is cool if you are an absolute DevOps beginner — minimal Linux knowledge is enough to work through the book.
When you should grab a copy:
You want to know exactly which steps are necessary to make a Rails application run on a server.
You are fed up with managing your environment with scripts needing your constant attention.
You have already wasted too much of your precious time messing around with configuration files, permissions and untraceable errors.
When you should leave quickly:
You absolutely loathe Linux and its command line.
You are willing to make the final layer between your application and your customers someone else's responsibility.
You rather spend more than the book's price on one month of hosting a single app with a PaaS.
Frequently asked questions
Is this book up-to-date?Well, kind of. It uses Rails 5.2 and Ansible 2.5, as well as Centos 7 and Ubuntu 18. It's tradition that I completely rewrite the book everytime a major Rails version comes out. Version 4 of the book is currently in the making and around the corner. It will feature the latest versions of Rails and Ruby.
Do I need the code repository?Not necessarily. Every piece of code is in the book for you to copy and paste (or better: to transscribe). However, as the code repository holds the book's code in a one-commit-per-chapter way, it makes it dead-easy to compare your own playbook to the one we build and to use it as a starting point for your own projects.
Which formats are supported?The book comes as DRM-free PDF. There may be a .mobi version sometime in the future, but for now PDF works best. A lot of effort went into the book's layout (to make it easy to work with) which unfortunately is near impossible to reproduce on other formats.
Why does the book not support my favourite … ?Two choices for operating system, Ruby version manager, webserver and database makes 16 different combinations in total — impossible to handle in a coherent way within the boundaries of a book. Instead, you'll learn how all these components work together under the hood. This will enable you to build the stack of your choice once you're through.
Still not convinced?
Join my email list and I will send you a free sample chapter (including the book's table of contents) which will help you to decide whether this book is for you or not.
If anything else is holding you back, just drop me a line — I'll be happy to answer all your questions.
Got it, thanks a lot!
Please check your emails for the confirmation request I just sent you. After clicking the link therein, you'll be able to download the sample chapter.
About the author
My name is Michael Trojanek and I have been building Rails applications as well as managing Linux servers in my dayjob for 21 years.
I maintain a mailing list with hundreds of members receiving content on Rails DevOps and Bootstrapping and I am a most-viewed writer on Quora.