Do you think you could make an updated tutorial on Rails deployment with postgresql, nginx, rails, and unicorn or similar?

January 31, 2017 229 views
Nginx Ruby on Rails Deployment Ubuntu 16.04

I've been following your tutorials for Ubuntu 14.04, and I use 16.04 because I prefer latest standards and security, but many sections are of course 2 years old and much has changed. Following your tutorials to the letter still gives me errors such as permissions, 403, 503, 404, and more. Some things are outdated such as the transition from upstart to systemd(incorrect spelling). So could you update tutorials for Ubuntu 16.04, or simply recommend a good setup between Nginx/Apache, PostgreSQL/MySQL/SQLite3, Capistrano, Puma/Unicorn?

1 Answer

Okay, for anyone who had the same issues I did. After some looking I found an article by Ralf Ebert at the beginning of 2017(for anyone seeing this at a later date). Read this article via This Link


  • DigitalOcean VM: Their cheapest server VM is $5/month which is sufficient for hosting a small Rails application and great for trying things out. You can get your Ruby on Rails server running in under a minute using the nice and clean administration interface. If you sign-up here, you’ll get $10 in credit so you can try out setting up a VM for free.

  • Ubuntu 16.04 Long Term Support: Ubuntu is the most commonly used Linux distribution for servers and 16.04 LTS (Xenial Xerus) will be supported with security updates until 2021.

  • Ruby and Rails: This tutorial uses the latest stable versions at time of writing - Ruby 2.4.0 and Rails 5.0.1. It was also tested and is known to work with Ruby 2.3 and Rails 4.

  • Ruby Version Manager to manage multiple Ruby versions on the same server (rvm has the advantage over rbenv of being easier to install because it knows which Ubuntu packages are needed to build Ruby and it hooks into the shell using /etc/profile.d/).

  • Bundler to manage the Ruby Gems for the application.

  • Deployment from a Git repository so that the deployment process is independent from the local environment. I use Bitbucket to set up a private repository because their free plan allows private repositories for up to 5 users. The application is cloned using a SSH deployment key directly from the repository during the deployment process.

  • Mina is used to handle the Ruby on Rails deployment. It is very fast because it generates a deployment script locally and runs it on the server. It automatically updates the bundles, migrates the database and generates the assets on the server side and it is clever about only running these tasks when needed.

  • PostgreSQL: PostgreSQL is the most commonly used database for Rails apps. It can authenticate users based on Linux user accounts so you don’t need extra passwords for the database.

  • unicorn + nginx: For every application there will be a unicorn process that runs under a separate user account with a single nginx HTTP server forwarding requests. This setup doesn’t require any web server modules and supports running different Ruby versions at the same time.

Have another answer? Share your knowledge.