Question

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

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?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted 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

Tools

  • 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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel