Introduction: Beyond Heroku
“How do I deploy my Rails app to a server?” is the inevitable question that comes out of people who have just finished a tutorial on Rails.
Tutorials like Rails Tutorial and The Odin Project only teach their students to deploy to Heroku. Heroku is a great service, but recent changes have required all free apps to have 6 hours of sleep per day. Any newbie expecting round-the-clock traffic to their app would now consider getting a low-cost virtual private server (VPS) rather than the lowest-cost “never sleeping” Heroku tier.
Those considering the VPS route will have some problems, though. To start off, the official Rails site lacks beginner-friendly documentation, providing only links to software. Also, while there are a lot of tutorials out there that teach you how to setup Rails on VPSs, they usually cover only the “How” of deploying and not the “Why”. These tutorials also talk about only one set of technologies; you will have to research on your own if you want to learn other alternatives.
I wrote this book to answer those concerns. At its core, this book is no different from other online tutorials - it will provide you with the steps to deploy your Rails application on an online VPS. In addition, however, I will also try to discuss the reasoning behind all of the steps to avoid the “just do this, trust me” magical thinking trap that many beginners fall into when learning something technical.
This book is split into two parts: the first covers practicing on a local virtual machine up to deploying to a very basic nginx/Passenger server stack. This is the “sample” book that is free to download and read online on Leanpub. The second part covers alternative stacks and more advanced deployment tools. This part is only available for those who have purchased the book.
Who is this book for?
This book targets two main audience groups:
- Beginners to Ruby and Rails web development - whether you’re considering leaving Heroku for a VPS or you’re just curious how Ruby servers are setup, this book is for you.
- System Administrators new to deploying Ruby web apps - you’ve set up dozens of PHP, Java, .NET, etc. servers before and you want to get an idea how things are done in the Ruby ecosystem. This book will help you as long as you don’t mind skimming over long stretches of lessons about things that you already know.
This book assumes that:
- You have basic Rails knowledge. For SysAdmins, basic concepts are enough. For Devs, you should at least complete a basic tutorial like Rails Tutorial.
- You are comfortable with using the terminal or command line. We will be primarily using *nix commands, but Windows users should also be able to run them under MinGW or Git Bash.
- You have a computer that can run a virtual machine i.e. non-netbook with >2GB RAM and ~20GB free hard drive space.
This book is not for the following:
- Experienced Ruby Devs/SysAdmins - I mean, you’re also free to browse the book, but don’t blame me if you feel everything in this book is dumbed down for beginners.
- Devs with a deadline - your company wants to roll out their shiny new project next week/tomorrow/right now but they won’t shell out for Heroku/Engine Yard/a Ruby SysAdmin so they want you, the new guy, to set up the servers for them. Sorry, but this book only covers the basics and shouldn’t be the sole resource for serious deployments. It doesn’t even go into detail about fully securing your severs. I suggest you negotiate for an extension to give yourself time to learn what you need.
- People who won’t touch Linux - we will be using the latest “long term support” version of Ubuntu (14.04) as our target production environment. If you’re strongly anti-Ubuntu but pro *nix, you’ll still learn a lot of things from this book. On the other hand, there’s nothing here for die-hard Windows fans that won’t touch anything other than Windows. If you absolutely have to deploy on Windows, look for JRuby tutorials on how to convert your app to JRuby and deploy them on Java application servers.