DEV Community

Discussion on: Migrating Rails Apps to VPS - worth it?

Collapse
 
drbragg profile image
Drew Bragg

You may want to checkout hatchbox if you're not trying to do this configuration on your own. Chris has done an amazing job with it and has a ton of great information on guides on his site GoRails. He was actually just talking about the difference between Puma and Passenger.

Which should I use? Passenger or Puma?

First, let's take a quick rundown of the difference between the two.

Passenger is an NGINX module that manages and runs your Rails apps. It installs alongside NGINX which means you don't have to manage a separate process for it. If NGINX is running, then Passenger is running.

Puma, on the other hand, is a separate process. It's going to run your Rails app, but you'll have to setup some scripts to manage the service manually and make sure that it gets restarted when it crashes, etc.

Passenger has an open source version as well as a enterprise version you can pay for. Puma is completely free and open source.

I'm sure you're thinking: "Great, but that doesn't help me decide!"

Here's a quick pros and cons list of Puma vs Passenger.

Passenger

Pros
  • Super-fast and managed seamlessly with NGINX
  • Well documented and easy to install
  • Easy debugging when app is broken
  • Supports Python and Node apps too
Cons
  • Multi-threading and other features are expensive

And now for Puma...

Puma

Pros
  • Completely free and open source
  • Supports both multi-process and multi-threading
  • Comes with Rails now by default
Cons
  • Manual setup, and process management required
  • Harder to debug when your app is broken

Passenger also wrote up a comparison between the two that goes into more detail. You can find that here.

Here's the thing:

Puma can be really tricky to learn if you're a first-timer deploying Rails to production. You have to learn SystemD, how process management works, and a fair bit about Linux to get it working reliably. It isn't going to hold your hand if you deploy broken code. Your app will just stop responding and you'll have to know where to look for the logs to figure out what's going wrong.

Passenger's pretty good at alerting you when something goes wrong. It'll display an error page and tell you to check the logs immediately. The direct integration with NGINX makes it easier to work with too as you don't have to learn anything about SystemD to get it running.

For beginners, I always recommend Passenger.
Since Passenger is so easy to use and friendly when errors occur, it's what I recommend to most people. If you're new to running Rails in production on your own servers, it's an easy recommendation.

Unless your site has massive traffic, you'll get along well on Passenger's free version. It's what I use on GoRails.com every day and serves up 2M pageviews a year without breaking a sweat.

And just a quick reminder, you can always change this later on. Just pick one and get your app in production. 👍

Either way you go passenger or puma, self-hosted or using hatchbox, definitely report back on your findings!

Collapse
 
aritdeveloper profile image
Arit Developer

Hi Drew! I decided to stay on Heroku lol. I've updated my blog post to reflect this decision. Thanks for your thorough response - I feel so supported 🤗

Collapse
 
drbragg profile image
Drew Bragg

Absolutely! I remember when we moved from AWS to DigitalOcean. It was super cool to be setting up my own servers but also super scary to being configuring from scratch. First one I did took me a whole day, but I can spin a new one up and have an app deployed in under an hour now. My suggestion is no matter if you're doing it barebones or using a service like Heroku take notes!