Tutorial

Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma

Published on June 3, 2015
authorauthor

Sheharyar Naseer and Tammy Fox

Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma

Introduction

Rails is an open source web application framework written in Ruby. It follows the Convention over Configuration philosophy by making assumptions that there is the ‘best’ way of doing things. This allows you to write less code while accomplishing more without having you go through endless config files.

Nginx is a high performance HTTP server, reverse proxy, and a load balancer known for its focus on concurrency, stability, scalability, and low memory consumption. Like Nginx, Puma is another extremely fast and concurrent web server with a very small memory footprint but built for Ruby web applications.

Capistrano is a remote server automation tool focusing mainly on Ruby web apps. It’s used to reliably deploy web apps to any number of remote machines by scripting arbitrary workflows over SSH and automate common tasks such as asset pre-compilation and restarting the Rails server.

In this tutorial we’ll install Ruby and Nginx on a DigitalOcean Ubuntu Droplet and configure Puma and Capistrano in our web app. Nginx will be used to capture client requests and pass them over to the Puma web server running Rails. We’ll use Capistrano to automate common deployment tasks, so every time we have to deploy a new version of our Rails app to the server, we can do that with a few simple commands.

Prerequisites

To follow this tutorial, you must have the following:

  • Ubuntu 14.04 x64 Droplet
  • A non-root user named deploy with sudo privileges (Initial Server Setup with Ubuntu 14.04 explains how to set this up.)
  • Working Rails app hosted in a remote git repository that’s ready to be deployed

Optionally, for heightened security, you can disable root login via SSH and change the SSH port number as described in Initial Server Setup with Ubuntu 14.04.

Warning: After disabling root login, make sure you can SSH to your Droplet as the deploy user and use sudo for this user before closing the root SSH session you opened to make these changes.

All the commands in this tutorial should be run as the deploy user. If root access is required for the command, it will be preceded by sudo.

Step 1 — Installing Nginx

Once the VPS is secure, we can start installing packages. Update the package index files:

  1. sudo apt-get update

Then, install Nginx:

  1. sudo apt-get install curl git-core nginx -y

Step 2 — Installing Databases

Install the database that you’ll be using in your Rails app. Since there are lots of databases to choose from, we won’t cover them in this guide. You can see instructions for major ones here:

Also be sure to check out:

Step 3 — Installing RVM and Ruby

We won’t be installing Ruby directly. Instead, we’ll use a Ruby Version Manager. There are lots of them to choose from (rbenv, chruby, etc.), but we’ll use RVM for this tutorial. RVM allows you to easily install and manage multiple rubies on the same system and use the correct one according to your app. This makes life much easier when you have to upgrade your Rails app to use a newer ruby.

Before installing RVM, you need to import the RVM GPG Key:

  1. gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Then install RVM to manage our Rubies:

  1. curl -sSL https://get.rvm.io | bash -s stable

This command uses curl to download the RVM Installation script from https://get.rvm.io. The -sSL option is composed of three flags:

  • -s tells curl to download the file in ‘silent mode’
  • -S tells curl to show an error message if it fails
  • -L tells curl to follow all HTTP redirects while retrieving the installation script

Once downloaded, the script is piped to bash. The -s option passes stable as an argument to the RVM Installation script to download and install the stable release of RVM.

Note: If the second command fails with the message “GPG signature verification failed”, that means the GPG Key has changed, simply copy the command from the error output and run it to download the signatures. Then run the curl command for the RVM Installation.

We need to load the RVM script (as a function) so we can start using it. We then need to run the requirements command to automatically install required dependencies and files for RVM and Ruby to function properly:

  1. source ~/.rvm/scripts/rvm
  2. rvm requirements

We can now install the Ruby of our choice. We’ll be installing the latest Ruby 2.2.1 (at the time of writing) as our default Ruby:

  1. rvm install 2.2.1
  2. rvm use 2.2.1 --default

Step 4 — Installing Rails and Bundler

Once Ruby is set up, we can start installing Rubygems. We’ll start by installing the Rails gem that will allow your Rails application to run, and then we’ll install bundler which can read your app’s Gemfile and automatically install all required gems.

To install Rails and Bundler:

  1. gem install rails -V --no-ri --no-rdoc
  2. gem install bundler -V --no-ri --no-rdoc

Three flags were used:

  • -V (Verbose Output): Prints detailed information about Gem installation
  • --no-ri - (Skips Ri Documentation): Doesn’t install Ri Docs, saving space and making installation fast
  • --no-rdoc - (Skips RDocs): Doesn’t install RDocs, saving space and speeding up installation

Note: You can also install a specific version of Rails according to your requirements by using the -v flag:

  1. gem install rails -v '4.2.0' -V --no-ri --no-rdoc

Step 5 — Setting up SSH Keys

Since we want to set up smooth deployments, we’ll be using SSH Keys for authorization. First shake hands with GitHub, Bitbucket, or any other Git Remote where the codebase for your Rails app is hosted:

  1. ssh -T git@github.com
  2. ssh -T git@bitbucket.org

Don’t worry if you get a Permission denied (publickey) message. Now, generate a SSH key (a Public/Private Key Pair) for your server:

  1. ssh-keygen -t rsa

Add the newly created public key (~/.ssh/id_rsa.pub) to your repository’s deployment keys:

If all the steps were completed correctly, you should now be able to clone your git repository (over the SSH Protocol, not HTTP) without entering your password:

  1. git clone git@example.com:username/appname.git

If you need a sample app for testing, you can fork the following test app specifically created for this tutorial: Sample Rails App on GitHub

The git clone command will create a directory with the same name as your app. For example, a directory named testapp_rails will be created.

We are cloning only to check if our deployment keys are working, we don’t need to clone or pull our repository every time we push new changes. We’ll let Capistrano handle all that for us. You can now delete this cloned directory if you want to.

Open a terminal on your local machine. If you don’t have a SSH Key for your local computer, create one for it as well. In your local terminal session:

  1. ssh-keygen -t rsa

Add your local SSH Key to your Droplet’s Authorized Keys file (remember to replace the port number with your customized port number):

  1. cat ~/.ssh/id_rsa.pub | ssh -p your_port_num deploy@your_server_ip 'cat >> ~/.ssh/authorized_keys'

Step 6 — Adding Deployment Configurations in the Rails App

On your local machine, create configuration files for Nginx and Capistrano in your Rails application. Start by adding these lines to the Gemfile in the Rails App:

Gemfile

group :development do
    gem 'capistrano',         require: false
    gem 'capistrano-rvm',     require: false
    gem 'capistrano-rails',   require: false
    gem 'capistrano-bundler', require: false
    gem 'capistrano3-puma',   require: false
end

gem 'puma'

Use bundler to install the gems you just specified in your Gemfile. Enter the following command to bundle your Rails app:

  1. bundle

After bundling, run the following command to configure Capistrano:

  1. cap install

This will create:

  • Capfile in the root directory of your Rails app
  • deploy.rb file in the config directory
  • deploy directory in the config directory

Replace the contents of your Capfile with the following:

Capfile
# Load DSL and Setup Up Stages
require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

This Capfile loads some pre-defined tasks in to your Capistrano configuration files to make your deployments hassle-free, such as automatically:

  • Selecting the correct Ruby
  • Pre-compiling Assets
  • Cloning your Git repository to the correct location
  • Installing new dependencies when your Gemfile has changed

Replace the contents of config/deploy.rb with the following, updating fields marked in red with your app and Droplet parameters:

config/deploy.rb

# Change these
server 'your_server_ip', port: your_port_num, roles: [:web, :app, :db], primary: true

set :repo_url,        'git@example.com:username/appname.git'
set :application,     'appname'
set :user,            'deploy'
set :puma_threads,    [4, 16]
set :puma_workers,    0

# Don't change these unless you know what you're doing
set :pty,             true
set :use_sudo,        false
set :stage,           :production
set :deploy_via,      :remote_cache
set :deploy_to,       "/home/#{fetch(:user)}/apps/#{fetch(:application)}"
set :puma_bind,       "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state,      "#{shared_path}/tmp/pids/puma.state"
set :puma_pid,        "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log,  "#{release_path}/log/puma.access.log"
set :ssh_options,     { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, true  # Change to false when not using ActiveRecord

## Defaults:
# set :scm,           :git
# set :branch,        :master
# set :format,        :pretty
# set :log_level,     :debug
# set :keep_releases, 5

## Linked Files & Directories (Default None):
# set :linked_files, %w{config/database.yml}
# set :linked_dirs,  %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :puma do
  desc 'Create Directories for Puma Pids and Socket'
  task :make_dirs do
    on roles(:app) do
      execute "mkdir #{shared_path}/tmp/sockets -p"
      execute "mkdir #{shared_path}/tmp/pids -p"
    end
  end

  before :start, :make_dirs
end

namespace :deploy do
  desc "Make sure local git is in sync with remote."
  task :check_revision do
    on roles(:app) do
      unless `git rev-parse HEAD` == `git rev-parse origin/master`
        puts "WARNING: HEAD is not the same as origin/master"
        puts "Run `git push` to sync changes."
        exit
      end
    end
  end

  desc 'Initial Deploy'
  task :initial do
    on roles(:app) do
      before 'deploy:restart', 'puma:start'
      invoke 'deploy'
    end
  end

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      invoke 'puma:restart'
    end
  end

  before :starting,     :check_revision
  after  :finishing,    :compile_assets
  after  :finishing,    :cleanup
  after  :finishing,    :restart
end

# ps aux | grep puma    # Get puma pid
# kill -s SIGUSR2 pid   # Restart puma
# kill -s SIGTERM pid   # Stop puma

This deploy.rb file contains some sane defaults that work out-of-the-box to help you manage your app releases and automatically perform some tasks when you make a deployment:

  • Uses production as the default environment for your Rails app
  • Automatically manages multiple releases of your app
  • Uses optimized SSH options
  • Checks if your git remotes are up to date
  • Manages your app’s logs
  • Preloads the app in memory when managing Puma workers
  • Starts (or restarts) the Puma server after finishing a deployment
  • Opens a socket to the Puma server at a specific location in your release

You can change all options depending on your requirements. Now, Nginx needs to be configured. Create config/nginx.conf in your Rails project directory, and add the following to it (again, replacing with your parameters):

config/nginx.conf

upstream puma {
  server unix:///home/deploy/apps/appname/shared/tmp/sockets/appname-puma.sock;
}

server {
  listen 80 default_server deferred;
  # server_name example.com;

  root /home/deploy/apps/appname/current/public;
  access_log /home/deploy/apps/appname/current/log/nginx.access.log;
  error_log /home/deploy/apps/appname/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

Like the previous file, this nginx.conf contains defaults that work out-of-the-box with the configurations in your deploy.rb file. This listens for traffic on port 80 and passes on the request to your Puma socket, writes nginx logs to the ‘current’ release of your app, compresses all assets and caches them in the browser with maximum expiry, serves the HTML pages in the public folder as static files, and sets default maximum Client Body Size and Request Timeout values.

Step 7 — Deploying your Rails Application

If you are using your own Rails app, commit the changes you just made, and push them to remote from your Local Machine:

  1. git add -A
  2. git commit -m "Set up Puma, Nginx & Capistrano"
  3. git push origin master

Note: If this is the first time using GitHub from this system, you might have to issue the following commands with your GitHub username and email address:

  1. git config --global user.name 'Your Name'
  2. git config --global user.email you@example.com

Again, from your local machine, make your first deployment:

  1. cap production deploy:initial

This will push your Rails app to the Droplet, install all required gems for your app, and start the Puma web server. This may take anywhere between 5-15 minutes depending on the number of Gems your app uses. You will see debug messages as this process occurs.

If everything goes smoothly, we’re now ready to connect your Puma web server to the Nginx reverse proxy.

On the Droplet, Symlink the nginx.conf to the sites-enabled directory:

  1. sudo rm /etc/nginx/sites-enabled/default
  2. sudo ln -nfs "/home/deploy/apps/appname/current/config/nginx.conf" "/etc/nginx/sites-enabled/appname"

Restart the Nginx service:

  1. sudo service nginx restart

You should now be able to point your web browser to your server IP and see your Rails app in action!

Normal Deployments

Whenever you make changes to your app and want to deploy a new release to the server, commit the changes, push to your git remote like usual, and run the deploy command:

  1. git add -A
  2. git commit -m "Deploy Message"
  3. git push origin master
  4. cap production deploy

Note: If you make changes to your config/nginx.conf file, you’ll have to reload or restart your Nginx service on the server after deploying your app:

  1. sudo service nginx restart

Conclusion

Okay, so by now you would be running a Rails app on your Droplet with Puma as your Web Server as well as Nginx and Capistrano configured with basic settings. You should now take a look at other docs that can help you optimize your configurations to get the maximum out of your Rails application:

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Category:
Tutorial

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
67 Comments
Leave a comment...

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!

This comment has been deleted

    what is ‘your_port_num’ how do I set that?

    It’s the Port you’re using for SSH-ing into your droplet. By default, it’s 22, but you should change it to something else.

    I had luck just deleting that argument.

    Hi sheharyar I have just deployed my app, but I can’t running on my browser

    “We’re sorry, but something went wrong. If you are the application owner check the logs for more information.”

    Please check my git repository https://github.com/marcus02219/kidsart.git

    How can I fix it? How can I see error logs? Please HELP ME !!!

    I have the same issue, app deployed, but 502 bad gateway when accessing over browser.

    Anyone have a solution for it?

    Can any one public a video tuts with how to deploy rails app , just tried over and over its sucks !!! i want to deploy rails up easy and fast not annoying with copy-past text !!! i even don’t see that this tutorial is that useful cuz its just doesn’t work !!!

    This comment has been deleted

      Hello! I have done the entire tutorial, the last message on terminal is:

      bash: line 1: 30225 Aborted ( RAILS_ENV=production /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile ) rake stderr: Nothing written

      On the app directory doesn’t have the “current” dir, can you help me with this?

      In case you didn’t figure it out, look at my recent comment

      Hi, after I run the ‘cap production deploy:initial’ command, the console ask me for the passphrase for my public key, I enter that but after that nothing happens, can anyone help me ?

      Exactly the same situation here, and so far I haven’t found a solution. EDIT : Found out it’s related to SSH settings in deploy.rb. Will update when and if I find a solution

      This particular StackOverflow answer was the only thing that could get me past the annoying “Enter the passphrase” stage : https://stackoverflow.com/a/38277697/243709

      My ruby set up is with rbenv but this example is with rvm. I am currently getting this error when I run cap production deploy:initial:

      cap aborted! SSHKit::Runner::ExecuteError: Exception while executing on host : rvm exit status: 127 rvm stdout: bash: /home/user/.rvm/bin/rvm: No such file or directory rvm stderr: Nothing written

      There is rbenv instead of rvm on my server. Is the setting basically the same with no modifications if I am using rbenv?

      Please advice. Thanks.

      Have you changed capistrano-rvm to capistrano-rbenv?

      So what the solution ? I am having the same issue.

      Nice tutorial !

      There something I miss : is puma installed as a daemon with Upstart Script ?

      Yes i also getting same issue puma sock file not found

      No, upstart configuration for puma isn’t being done. You’ll have to do that yourself. Currently, this only provides you with capistrano-puma commands (that you can run on your local machine to affect the server):

      • cap production puma:status
      • cap production puma:start
      • cap production puma:stop
      • cap production puma:restart

      etc.

      cap aborted!
      Don't know how to build task 'start'
      

      I am finding this error. I can’t see start defined in the config/deploy.rb

      where are you binding puma ??? In deploy.rb

      set :puma_bind,       "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
      set :puma_state,      "#{shared_path}/tmp/pids/puma.state"
      set :puma_pid,        "#{shared_path}/tmp/pids/puma.pid"
      

      but its not generating puma.pid or #{fetch(:application)}-puma.sock files also my PUMA is not running although i got this in my log

      DEBUG [4151b0ca] 	Puma starting in single mode...
      DEBUG [4151b0ca] 	
      DEBUG [4151b0ca] 	* Version 2.13.4 (ruby 2.2.1-p85), codename: A Midsummer Code's Dream
      DEBUG [4151b0ca] 	
      DEBUG [4151b0ca] 	* Min threads: 4, max threads: 16
      DEBUG [4151b0ca] 	
      DEBUG [4151b0ca] 	* Environment: production
      DEBUG [4151b0ca] 	
      DEBUG [4151b0ca] 	* Daemonizing...
      
      

      after scratching here and there i found puma log and it is **puma.access.log **

      === puma startup: 2015-09-09 15:22:22 -0400 ===
      /home/deploy/apps/golf/releases/20150909192056/app/api/v1/api.rb:5:in `format': no implicit conversion of Symbol into String (TypeError)
      	from /home/deploy/apps/golf/releases/20150909192056/app/api/v1/api.rb:5:in `<class:API>'
      	from /home/deploy/apps/golf/releases/20150909192056/app/api/v1/api.rb:4:in `<module:V1>'
      	from /home/deploy/apps/golf/releases/20150909192056/app/api/v1/api.rb:3:in `<top (required)>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:360:in `require_or_load'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:494:in `load_missing_constant'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
      	from /home/deploy/apps/golf/releases/20150909192056/config/routes.rb:10:in `block in <top (required)>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:410:in `draw'
      	from /home/deploy/apps/golf/releases/20150909192056/config/routes.rb:1:in `<top (required)>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `each'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:169:in `reload_routes!'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/devise-3.5.2/lib/devise/rails.rb:14:in `block in <class:Engine>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:55:in `block in <module:Finisher>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
      	from /home/deploy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
      	from /home/deploy/apps/golf/current/config/environment.rb:5:in `<top (required)>'
      	from /home/deploy/apps/golf/current/config.ru:3:in `require'
      	from /home/deploy/apps/golf/current/config.ru:3:in `block in <main>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:184:in `instance_eval'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:184:in `initialize'
      	from /home/deploy/apps/golf/current/config.ru:in `new'
      	from /home/deploy/apps/golf/current/config.ru:in `<main>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:170:in `eval'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:170:in `new_from_string'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:161:in `parse_file'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/configuration.rb:129:in `load_rackup'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/configuration.rb:96:in `app'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/runner.rb:113:in `load_and_bind'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/single.rb:79:in `run'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/lib/puma/cli.rb:215:in `run'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/gems/puma-2.13.4/bin/puma:10:in `<top (required)>'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/bin/puma:23:in `load'
      	from /home/deploy/apps/golf/shared/bundle/ruby/2.2.0/bin/puma:23:in `<main>'
      
      

      here is log

      === puma startup: 2015-09-09 17:01:34 -0400 ===
      /home/deploy/apps/golf/releases/20150909205712/app/api/v1/api.rb:5:in `format': no implicit conversion of Symbol into String (TypeError)
      	from /home/deploy/apps/golf/releases/20150909205712/app/api/v1/api.rb:5:in `<class:API>'
      	from /home/deploy/apps/golf/releases/20150909205712/app/api/v1/api.rb:4:in `<module:V1>'
      	from /home/deploy/apps/golf/releases/20150909205712/app/api/v1/api.rb:3:in `<top (required)>'
      
      

      If i run simple rails s it works perfect …

      Seems to be an error on line 5 of your app/api/v1/api.rb. Have you tried running your app with puma locally? Go into you app directory and run puma instead of rails s, and see if that works.

      @sheharyar thanks i solved it last night … it was gem set issue …

      My experience (in case it helps anyone!):

      To anyone who gets a javascript runtime error… I had to add these to my gemfile:

      gem 'execjs'
      gem 'therubyracer'
      

      Also, if you have trouble with your .yml files (which are excluded from git for many), I added this to my deploy.rb:

        set :linked_files, %w{config/database.yml config/application.yml}
        ...
        namespace :deploy do
          desc 'Upload YAML files.'
          task :upload_yml do
            on roles(:app) do
              execute "mkdir #{shared_path}/config -p"
              upload! StringIO.new(File.read("config/database.yml")), "#{shared_path}/config/database.yml"
              upload! StringIO.new(File.read("config/application.yml")), "#{shared_path}/config/application.yml"
            end
          end
      

      Then I did rake:upload_yml to upload those files.

      I also had some weird bugs that surfaced in production when doing initial migrations thus did not exist locally in development.

      One gem conflicted with devise gem, the error pointed to the line that I needed to comment out, then did initial deploy again, then commented back once my database was set up with migrations.

      Then I was trying to load a lib file with require 'Libname'. The actual lib file was libname.rb and thus should have been require 'libname'. I shouldn’t have had the capital letter, but I didn’t know that until now. It was not a problem locally in development probably because my local machine didn’t require it to be case sensitive.

      Good luck! These hiccups took many hours of searching and trial&error, but things look great now. Server seems speedy! Thanks DO!

      That would be cap production deploy:upload_yml of course

      For those that kept getting an error like an error occurred while installing json 1.8 2 and bundler cannot continue . The solution for me was to do sudo apt-get install libgmp3-dev on the host machine.

      Please, put tutorial for SECRET_KEY_BASE, using env variable.

      In your deploy tasks, I noticed you re-run deploy:compile_assets and deploy:cleanup in the deploy:finishing task.

      Is there any particular reason this is being done?

      Anyone receiving errors when running cap production deploy:initial?

      yes see my post below with my error

      hi there, after running cap production deploy:initial i am getting the following error:

      rake aborted! NoMethodError: undefined method `tr’ for nil:NilClass

      this happen as soon as Command: cd /home/deploy/freshbox/releases/20151018131809 && ( RAILS_ENV=production ~/.rvm/bin/rvm ruby-2.2.2 do bundle exec rake assets:precompile ) starts to run

      how do i get that to work … been stuck here for hours

      here is the log:

      <^>rake aborted!
      NoMethodError: undefined method `tr' for nil:NilClass
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:37:in `initialize'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:270:in `new'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:270:in `resolve_url_connection'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:258:in `resolve_hash_connection'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:215:in `resolve_connection'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:151:in `block in resolve_all'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:150:in `each'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:150:in `resolve_all'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:69:in `resolve'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/core.rb:46:in `configurations='
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `each'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
      /home/deploy/freshbox/releases/20151018135204/config/environment.rb:5:in `<top (required)>'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:328:in `require_environment!'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:457:in `block in run_tasks_blocks'
      /home/deploy/freshbox/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
      Tasks: TOP => environment
      (See full trace by running task with --trace)
      rake stderr: Nothing written<^>
      

      Great tutorial, it helped me get deployed fast. Just one small correction:

      In deploy.rb, the puma log names are backwards.

      set :puma_access_log, "#{release_path}/log/puma.error.log"
      set :puma_error_log,  "#{release_path}/log/puma.access.log"
      

      should be:

      set :puma_access_log, "#{release_path}/log/puma.access.log"
      set :puma_error_log,  "#{release_path}/log/puma.error.log"
      

      thanks Steven, that saved me a lot but i landed onto this error :

      rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied

      any idea ?

      If you run into problems running the cap production deploy:initial command, you may have insufficient RAM, for this you can create a swap file

      This solution does not help

      An unhandled lowlevel error occurred. The application logs may have details. how do i fix this ?

      Did you get this fixed?

      getting unhandled lowlevel error. secret key does exist in production, was generated in production and is outputting correctly with echo and printenv. using gem ‘dotenv-rails’ and .env file in .gitignore. Getting a HTTP 200 response and is displaying “unhandled lowlevel error”, this is usually where Rails will say “We’re sorry but something went wrong screen” where one has to read logs to go further. The nginx error log is saying something about puma.sock connection refused. I’ve checked permissions, restarted servers. I guess next step is to look into the sock connection.

      2016/02/06 17:09:01 [error] 966#0: *1 connect() to unix:///home/deploy/apps/myapp/shared/tmp/sockets/myapp-puma.sock failed (111: Connection refused) while connecting to upstream, client: 78.117.169.69, server: , request: "GET / HTTP/1.1", upstream: "http://unix:///home/deploy/apps/myapp/shared/tmp/sockets/myapp-puma.sock:/", host: "97.34.78.178"
      

      I’m getting this same error

      You say nothing about production.rb. Do we need to modify something about this file? Thank you for this great tutorial !

      Great guide man! Really appreciate it! Though, i have one problem. I got it all worked through, and I had no problems with “cap production deploy:initial”, but when open the application in my browser, i get this error message: “An unhandled lowlevel error occurred. The application logs may have details.”

      How can I fix this?

      What version of rails are you running? Do you have a secret_key_base? If not, you’ll need to add one. The configs/secrets.yml file gives instructions on where these values should be kept and read from.

      how u fix this ? i have same issue plz

      After following this blog and running

      cap production deploy:initial --trace

      I am getting the following error. Could someone help with this?

      cap aborted!
      SSHKit::Runner::ExecuteError: Exception while executing on host 104.197.138.17: connection closed by remote host
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
      Net::SSH::Disconnect: connection closed by remote host
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:50:in `rescue in block (2 levels) in negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:46:in `block (2 levels) in negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `loop'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `block in negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `loop'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:32:in `initialize'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `new'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `block in initialize'
      /home/vagrant/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/timeout.rb:75:in `timeout'
      /home/vagrant/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/timeout.rb:126:in `timeout'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `initialize'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `new'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `start'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:187:in `with_ssh'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:137:in `block in _execute'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:62:in `test'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in `block (3 levels) in <top (required)>'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
      EOFError: end of file reached
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:47:in `readpartial'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:47:in `block (2 levels) in negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `loop'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:45:in `block in negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `loop'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:43:in `negotiate!'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/server_version.rb:32:in `initialize'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `new'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `block in initialize'
      /home/vagrant/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/timeout.rb:75:in `timeout'
      /home/vagrant/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/timeout.rb:126:in `timeout'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in `initialize'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `new'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/net-ssh-2.9.2/lib/net/ssh.rb:207:in `start'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:187:in `with_ssh'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:137:in `block in _execute'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:62:in `test'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in `block (3 levels) in <top (required)>'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
      /home/vagrant/.rvm/gems/ruby-2.1.7/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
      Tasks: TOP => rvm:hook
      

      Looks like I got the same error, the issue is due to the ssh-agent not finding the correct ssh key for deployments to keep working.

      The solution I used was to ssh into the server and do the following:

      eval `ssh-agent`
      

      then re-add your ssh key and enter your ssh key passphrase.

      ssh-add ~/.ssh/id_rsa
      

      This will add your ssh key to the ssh-agent now run:

      cap production deploy
      

      Unfortunately I haven’t had a chance to dig deeper to see why the ssh key is lost being that the server is never turned off only nginx is restarted. Hopefully someone can shed some light on this.

      I had the same problem, but for me it was an issue on my local machine. I needed to run those same commands, but on my laptop in order to fix the deployment issue.

      After I ran cap production deploy:initial, I am getting the following error. I am able to ssh in to the box via ssh user@server-ip though. Not sure what’s going on. Please help

      cap aborted!
      SSHKit::Runner::ExecuteError: Exception while executing on host 104.197.138.17: Authentication failed for user deploy@104.197.138.17
      
      Net::SSH::AuthenticationFailed: Authentication failed for user deploy@104.197.138.17
      
      Tasks: TOP => rvm:hook
      

      Looks like I got the same error, the issue is due to the ssh-agent not finding the correct ssh key for deployments to keep working.

      The solution I used was to ssh into the server and do the following:

      eval `ssh-agent`
      

      then re-add your ssh key and enter your ssh key passphrase.

      ssh-add ~/.ssh/id_rsa
      

      This will add your ssh key to the ssh-agent now run:

      cap production deploy
      

      Unfortunately I haven’t had a chance to dig deeper to see why the ssh key is lost being that the server is never turned off only nginx is restarted. Hopefully someone can shed some light on this.

      Really good tutorail ! I have setup my full webserver with it ! :D

      Hi All,am in final stage of deploying and when I executed ‘cap production deploy’ everything was successful except for one error message

      DEBUG [f6f8e0d8] Running /usr/bin/env [ -L /home/deploy/apps/my_app/releases/20151124005659/public/assets ] as deploy@128.199.145.139 DEBUG [f6f8e0d8] Command: [ -L /home/deploy/apps/my_app/releases/20151124005659/public/assets ] DEBUG [f6f8e0d8] Finished in 0.581 seconds with exit status 1 (failed).

      After this,I tried to connect to application through IP and then it says ‘could not connect’.

      Please help me if you know the solution

      How do I deploy without db migration?

      How do you get puma to automatically restart when the server reboots?

      Deploy.rb around line 69 contains what you’re looking for.

      Help, I’m stuck! :/ Here is what I get when I run

      curl -sSL https://get.rvm.io | bash -s stable
      Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz
      curl: (23) Failed writing body (0 != 807)
      
      Could not download 'https://github.com/rvm/rvm/archive/1.26.11.tar.gz'.
        curl returned status '23'.
      
      Downloading https://bitbucket.org/mpapis/rvm/get/1.26.11.tar.gz
      curl: (23) Failed writing body (0 != 1038)
      
      Could not download 'https://bitbucket.org/mpapis/rvm/get/1.26.11.tar.gz'.
        curl returned status '23'.
      

      I tried to skip that step, as RVM seemed to be already available.

      But when I try to install rails or bundler I get these:

      ERROR:  While executing gem ... (Gem::FilePermissionError)
          You don't have write permissions for the /usr/local/rvm/gems/ruby-2.2.1 directory.
      

      And now I am really stuck. Any help would be very appreciated! :)

      I am stuck with this error and cant get any help on google

      usman@usman-Inspiron-3521:~/projects/gms$ cap production deploy:check
      /home/usman/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
      DEBUG [2b9c2203] Running /usr/bin/env [ -d ~/.rvm ] on 162.243.240.152
      DEBUG [2b9c2203] Command: [ -d ~/.rvm ]
      cap aborted!
      Net::SSH::Disconnect: connection closed by remote host
      
      EOFError: end of file reached
      
      Tasks: TOP => rvm:hook
      (See full trace by running task with --trace)
      
      

      If you have something other than 22 in place for your_port_num, you need to change it to 22.

      Would be very useful if this guide referenced how to add SSL into the mix, but I’ve found it to be very helpful.

      I got the following error after deploying the first time: *** Exception RuntimeError in Rack application object (Missing secret_token and secret_key_base for ‘production’ environment, set these values in config/secrets.yml) (process 5076, thread 0x007fd841f79d58(Worker 1)):

      Found this useful link to resolve the above issue in a secure way: http://ryanbigg.com/2015/07/deploying-a-rails-application-on-ubuntu-passenger-edition/

      Sweet tutorial, thanks a lot!!!

      The nginx.conf seems to have a lot of issues. After a lot of fidling, I seem to have gotten through most of it. One important note, is that the mime-types aren’t included, which caused nginx to serve my CSS files as text/plain and causing them not to load properly. To fix this, I added these lines:

      location ^~ /assets/ {
        ...
        include  /etc/nginx/mime.types; // Added this
      }
      
      location @puma {
        ...
        include  /etc/nginx/mime.types; // Added this
      }
      

      This comment has been deleted

        This comment has been deleted

          “cap production deploy:initial” gives me error

          DEBUG [63cf0a07] Running [ -d ~/.rvm ] on 162.243.10.38 DEBUG [63cf0a07] Command: [ -d ~/.rvm ] (Backtrace restricted to imported tasks) cap aborted! Net::SSH::Authentication::AgentError: agent could not sign data with requested identity

          Tasks: TOP => rvm:hook (See full trace by running task with --trace)

          Nice tutorial, thank you!

          Looks like there is a mixup with puma_access_log and puma_error_log filenames in deploy.rb script (access points to error and the other way around.)

          set :puma_access_log, "#{release_path}/log/puma.error.log"
          set :puma_error_log,  "#{release_path}/log/puma.access.log"
          

          Thanks for this tutorial, great job :-)

          I’m having a problem with deploying, when I enter “cap production deploy:initial” it begins but ends up throwing an error and returns:

          cap aborted!
          SSHKit::Runner::ExecuteError: Exception while executing on host {MY_HOST_IP}: Exception while executing on host {MY_HOST_IP}: bundle exit status: 5
          bundle stdout: An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue.
          Make sure that `gem install mysql2 -v '0.4.4'` succeeds before bundling.
          bundle stderr: Nothing written
          

          I’m using the mysql2 gem, installed mysql on my server (and can login etc).

          Great guide man! Really appreciate it! So I have just deployed my app, but I can’t running on my browser

          “We’re sorry, but something went wrong. If you are the application owner check the logs for more information.”

          Please check my git repository https://github.com/marcus02219/kidsart.git

          How can I fix it? How can I see error logs? Please HELP ME !!!

          Nice tutorial! I’ve just deployed to my server http://198.58.105.103/ But I have an error message

          “We’re sorry, but something went wrong. If you are the application owner check the logs for more information.”

          My source code is https://github.com/marcus02219/kidsart.git

          How can I check this error logs? How can I fix this error? Please help me!!!

          This comment has been deleted

            I am finding this message, even though I’ve copied the same deploy.rb. Any help?

            “Stage not set, please call something such as cap production deploy, where production is a stage you have defined.”

            Thanks!

            The script above works perfectly, except that each time I deploy I have to enter the deploy user’s password. Is there some way to fix this?

            If I manually ssh deploy@server it works fine/uses the ssh key.

            Thanks.

            I found the solution, I just had to at my ssh key to the ssh agent ssh-add ~/.ssh/id_rsa

            I’m getting this error:

            2016/06/06 20:14:02 [error] 907#0: *1 connect() to unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock failed (111: Connection refused) while connecting to upstream, client: 50.100.162.19, server: , request: "GET / HTTP/1.1", upstream: "http://unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock:/", host: "appname.com"
            

            (here it is with manually added newlines for your convenience)

            2016/06/06 20:14:02 [error] 907#0: *1 connect() to
            unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock failed
            (111: Connection refused) while connecting to upstream, client: 
            50.100.162.19, server: , request: "GET / HTTP/1.1", upstream: 
            "http://unix:///home/user/apps/appname/shared/tmp/sockets/appname-
            puma.sock:/", host: "appname.com"
            ```
            
            I have no idea how to fix it. I've been searching high and low...

            Can explain how “cap production deploy” start nginx and puma ?

            Could you explain how cap production deploy start nginx and puma ? how would you start nginx and puma after a reboot ?

            I followed the tutorial but i got this errors: puma log:

                === puma startup: 2016-06-11 13:10:07 +0200 ===
            ! Unable to load application: Errno::EADDRINUSE: Address already in use - bind(2) for [::]:2010
            bundler: failed to load command: puma (/home/admrails/apps/Paris/shared/bundle/ruby/2.1.0/bin/puma)
            

            nginx log:

             2016/06/11 13:16:37 [crit] 29360#0: *3 connect() to unix:///home/admrails/apps/myapp/shared/tmp/sockets/Paris-puma.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: myIP, request: "GET /en/log_in HTTP/1.1", upstream: 
            
            "http://unix:///home/admrails/apps/myapp/shared/tmp/sockets/myapp-puma.sock:/en/log_in", host: "localhost"
            

            When i try to run cap production deploy:initial I get the following error:

            cap aborted! Net::SSH::AuthenticationFailed: Authentication failed for user [user@ip-address-removed]

            Any idea what could be wrong here? I’ve gone through the initial server setup linked to at the top of this guide and I have my local key set up on the server so i can ssh in without a password but capistrano gets an authentication failed error

            I’m getting the following error:

            Net::SSH::Disconnect: connection closed by remote host

            EOFError: end of file reached

            Tasks: TOP => rvm:hook

            It’s rather frustrating that these tutorials don’t seem to account for common errors. I really appreciate you guys writing them, but they’re a little tricky to actually implement with all the various errors that seem to occur

            bundle stdout: bash: line 1: 18330 Killed ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/muse/shared/bundle --without development test --deployment --quiet bundle stderr: Nothing written

            ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines:

            DEBUG [d827b81d] * rails (5.0.2)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * sass-rails (5.0.6)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * spring (2.0.1)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * spring-watcher-listen (2.0.1)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * turbolinks (5.0.1)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * uglifier (3.1.7)

            DEBUG [d827b81d]

            DEBUG [d827b81d] * web-console (3.4.0)

            DEBUG [d827b81d]

            DEBUG [d827b81d] Install missing gems with bundle install

            DEBUG [d827b81d]

            DEBUG [d827b81d] Finished in 2.405 seconds with exit status 1 (failed).

            INFO [4c19d85c] Running ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/muse/shared/bundle --without development test --deployment --quiet on 45.55.181.104

            DEBUG [4c19d85c] Command: cd /home/deploy/apps/muse/releases/20170315150245 && ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/muse/shared/bundle --without development test --deployment --quiet

            DEBUG [4c19d85c] bash: line 1: 18330 Killed ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/muse/shared/bundle --without development test --deployment --quiet

            Can someone comment on the set :puma_workers, 0 line?

            Another guide here in DigitalOcean (that doesn’t use capistrano) tells me to use grep -c processor /proc/cpuinfo to get the number of cores and use that as puma_workers … is 0 some kind of auto setting?

            https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04

            If someone got an error when running this command cap production deploy:initial you’ll need to add this line install_plugin Capistrano::Puma under the require puma to your Capfiles

            I have a question about the last command in the 5th step: cat ~/.ssh/id_rsa.pub | ssh -p your_port_num deploy@your_server_ip 'cat >> ~/.ssh/authorized_keys'

            as I’m connected in my droplet via ssh isn’t my local SSH Key already in the Droplet’s Authorized Keys file?

            at this point I have already connected via ssh in the droplet and I have also cloned my bitbucket repo in the droplet too, so: is there any ssh configuration left to be done?

            thanks in advance for the help!

            i have completed this manual successfully still i get this error in browser “An unhandled lowlevel error occurred. The application logs may have details.” and in /log/nginx.error.log file sows only this error “client closed connection while waiting for request, client: 27.97.83.62, server: 0.0.0.0:80” any one have idea for this error thanks in advance

            Hi there,

            I’m having the following error after run cap production deploy:initial

            cap aborted! Don’t know how to build task ‘start’ (see --tasks)

            can anyone help me?

            Thanks for this! I need to learn how to generate a pub key for bitbucket, but the bitbucket instructions are now working now (the link)

            I have a little problem… :| Everything went smooth, but when I try to connect to the ip from the browser, it says (after a while trying to connect):

            “This site can’t be reached. <ip> took too long to respond.”

            Well. 10/20/2017, and I’m still having issues with the SECRET_KEY_BASE issues.

            Followed all the steps and everything is good, excpet /home/[user]/current/log/puma.access.log is giving the error

            #<RuntimeError: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`>
            

            secrets.yml is looking for <%= ENV[“SECRET_KEY_BASE”] %>

            echo $SECRET_KEY_BASE
            

            and

            irb
            ENV["SECRET_KEY_BASE"]
            

            give the same output.

            I also have the same output in /etc/profile

            I’ve restarted the server and ssh and everything I can think of. Not sure what I’m missing at this point.

            I went with the route of this tutorial: http://ryanbigg.com/2015/07/deploying-a-rails-application-on-ubuntu-passenger-edition

            I hard coded the secret in a new file in /home/[username]/[appname]/shared/config/secrets.yml, and added the following line to Capistrano’s deploy.rb

            set :linked_files, fetch(:linked_files, []).push('config/secrets.yml')
            

            Digital ocean’s tutorials/documentations are so unclear and incomplete. Sucks . Why the F**** does deploying has to be so effing difficult

            Hi, I have followed the above steps to deploy in the droplet. But what I am getting when I try to deploy with Capistrano cap production deploy:initial. I get the following error. ( export GIT_ASKPASS=“/bin/echo” GIT_SSH=“/tmp/git-ssh-xxxxxx-production-xxxxxxx.sh” ; /usr/bin/env git ls-remote git@bitbucket.org:xxxxxxxx/xxxxxxx.git HEAD )

            I am able to run the above command and in the server itself without any errors and also able to clone the repo. But capistrano is unable to .

            Any help is appreciated .

            Thanks!

            Those who are getting error

            Net::SSH::AuthenticationFailed: Authentication failed for user deploy@XXX.XX.XX.XXX
            

            Here is the solution,

            First of all you need to ssh to your server and run

            eval `ssh-agent`
            

            and then

            ssh-add ~/.ssh/id_rsa
            

            and now change

            set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) } 
            

            to

            set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa) }
            

            I just removed pub from id_rsa.pub.

            And then run

            
            cap production deploy:initial
            

            It should work now.

            I have encountered the same issue with my application https://www.wiki11.com. I researched and found the above solution. Hopefully it will help you folks.

            The problem with mine is: I’m able to login if I do: ssh user@IP, but when I use Capistrano, it gives me: Net::SSH::AuthenticationFailed: Authentication failed. Been working since yesterday, but unable to find a working solution.

            I tried denisinla’s solution fo the error, "Net::SSH::Disconnect: connection closed by remote host’, to no avail. I applied the solution to the server and my local machine. Also, I made sure the /var/www/myapp folder has permissions for the deploy user.

            Is there also an tutorial about this for newer ubuntu distributions. I tried to follow for ubuntu 16.x but got stuck at the capistrano deployment for production. I get:

            SSHKit::Command::Failed: rvm exit status: 127 rvm stdout: bash: /home/deploy/.rvm/bin/rvm: No such file or directory rvm stderr: Nothing written

            Any solution to this? There is indeed nothing in .rvm on my server. The folder .rvm is there but does not contain a bin directory. It does contain environments, gems, gems_cache, log, user, wrappers.

            Any ideas / suggestions?

            Thanks for the article. I’m having an issue at…

            cap production deploy:initial

            Net::SSH::AuthenticationFailed: Authentication failed for user (user)@(ip) Tasks: TOP => rvm:hook

            Interestingly, I do have set a key for SSH and I can successfully connect to the server with this user. It only seems to be an issue with Capistrano. I’m not sure where to look next for what may be causing this.

            ssh-add -l Successfully returns my RSA key… I would have thought Capistrano deploy would work the same way as when I successfully ssh to my server in terminal.

            Thanks in advance for your thoughts and input.

            The line source ~/.rvm/scripts/rvm perhaps needs to update. The new line should read source /etc/profile.d/rvm.sh (from the install messages of RVM)

            Also, for me, on Ubuntu 18.04, unless I had GPG verification done, RVM didn’t install.

            have an issue, cap production deploy:initial failed on

            ~/.rvm/bin/rvm default do bundle exec rake assets:precompile

            with

            Don't know how to build task 'assets:precompile'

            All steps according to this tutorial

            please help

            I followed this whole guide, was able to setup capistrano deployments, but when I access my IP, it keeps loading the page and nothing shows up. The connection basically times out.

            Neither the nginx logs, nor the Puma logs (access+error) show anything. both Puma and nginx are running, though.

            Ping shows that the server IP is reachable, so I think it has got to do with the webserver running on this droplet

            What could be the cause, and how to debug it?

            You need to add install_plugin Capistrano::Puma to your cap file now

            Can someone help me on this error showing in puma.stderr.log

            /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/configuration.rb:318:in load_rackup': Missing rackup file 'config.ru' (RuntimeError) from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/configuration.rb:245:in app’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/runner.rb:157:in app' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/runner.rb:164:in start_server’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:275:in worker' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:139:in block (2 levels) in spawn_workers’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:139:in fork' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:139:in block in spawn_workers’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:135:in times' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:135:in spawn_workers’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:213:in check_workers' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:486:in run’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/launcher.rb:186:in run' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cli.rb:80:in run’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/gems/puma-3.12.2/bin/puma:10:in <top (required)>' from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/bin/puma:23:in load’ from /home/deployer/apps/api_explore/shared/bundle/ruby/2.6.0/bin/puma:23:in <top (required)>' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in load’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in kernel_load' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in run’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:463:in exec' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in run’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in invoke_command' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in dispatch’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:27:in dispatch' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in start’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:18:in start' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in block in <top (required)>’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in with_friendly_errors' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in <top (required)>’ from /home/deployer/.rbenv/versions/2.6.4/bin/bundle:23:in load' from /home/deployer/.rbenv/versions/2.6.4/bin/bundle:23:in <top (required)>’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in load' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in kernel_load’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in run' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:463:in exec’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in run' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in invoke_command’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in dispatch' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:27:in dispatch’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in start' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/cli.rb:18:in start’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in block in <top (required)>' from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in with_friendly_errors’ from /home/deployer/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in <top (required)>' from /home/deployer/.rbenv/versions/2.6.4/bin/bundle:23:in load’ from /home/deployer/.rbenv/versions/2.6.4/bin/bundle:23:in `<main>’

            Try DigitalOcean for free

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

            Sign up

            Join the Tech Talk
            Success! Thank you! Please check your email for further details.

            Please complete your information!

            Become a contributor for community

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

            DigitalOcean Documentation

            Full documentation for every DigitalOcean product.

            Resources for startups and SMBs

            The Wave has everything you need to know about building a business, from raising funding to marketing your product.

            Get our newsletter

            Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

            New accounts only. By submitting your email you agree to our Privacy Policy

            The developer cloud

            Scale up as you grow — whether you're running one virtual machine or ten thousand.

            Get started for free

            Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

            *This promotional offer applies to new accounts only.