I had to setup continous deployment for my Rails application with Capistrano 3. The application is hosted in AWS ubuntu. Beanstalk frustrated me for a long time, so i decided to use Capistrano 3 deployment tool.
One of the issues that developers who have used Capistrano 3 are bound to face is /usr/bin/env XXXX not installed. I am not going to get into why you get this issue as there is lots written about it. But I think the solutions to this are not highlighted clearly. In the Capistrano 3 documentation, ‘Command Mapping’ is the section that we need to go through, for clearing this one.
Since Capistrano 3 runns bundle, rake, ruby commands we may have to configure the path of these tools in the Capistrano config file; ie., deploy.rb.
I configured the path like this
set :default_env, { path: "/usr/share/rvm/rubies/ruby-2.2.1/bin:/home/ubuntu/.rvm/gems/ruby-2.2.1/bin:$PATH", 'GEM_HOME' => '~/.rvm/gems/ruby-2.2.1/', 'GEM_PATH' => '~/.rvm/gems/ruby-2.2.1/gems' }
Also, you can configure the SSHKit mapping for rake and bundle commands like this,
SSHKit.config.command_map[:bundle] = "~/.rvm/gems/ruby-2.2.1/bin/bundle" SSHKit.config.command_map[:rake] = "~/.rvm/gems/ruby-2.2.1/bin/rake"
This solves the problem really fast as the SSHKit now that connects to your Ubuntu instance uses these paths.