We will use Digital Ocean as a VPS server provider, because they have good technology with competitive prices.There are other alternatives like Amazon EC2, OVH, Linode, Dreamhost …. For web applications, deployment means a sequence of steps to enable a feature on the production server after having built it locally.In this article we will cover automated deployment of a Ruby on Rails application to a VPS (Virtual Private Server).We will install a Ubuntu Linux Server (14.04 LTS) and prepare our project for automated deployment with Capistrano 3.It typically involves copying over the source code and optionally, updating system and server configurations, updating the database, restarting the server and services, etc.Capistrano is a program that allows developers to automate the deployment process using a Ruby based script.
I suggest cloning this repository or downloading the zip and copying these files into your project as you read through the following steps.
before 'deploy:setup_config', 'nginx:remove_default_vhost' # reload nginx to it will pick up any modified vhosts from # setup_config after 'deploy:setup_config', 'nginx:reload' # Restart monit so it will pick up any monit configurations # we've added after 'deploy:setup_config', 'monit:restart' And enter the details of the database the app should connect to.
Remember that if you're using Postgres or Mysql, you'll need to create this database first. Return to your local terminal, ensure that you've committed your changes pushed changes to the remote repository and enter: And wait.
In general this will mean renaming (for example appenidng .old) all of the following: if you're upgrading.
You may need to do some of the usual Gemfile juggling if you're updating and there are dependency conflicts.This post explains, with sample code, how to use Capistrano 3 to deploy one or several Rails applications to a VPS.