Reputation: 801
I'm trying to run cap staging deploy to an AWS instance, which is our staging server. Everything works, including bundle install... But when it gets to running the Puma server it fails:
Command: cd /home/ubuntu/medcordance/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.0" RACK_ENV="staging" ; bundle exec puma -C /home/ubuntu/app_name/shared/puma.rb --daemon )
DEBUG [02658949] bash: bundle: command not found
I've checked high and low for a solution. I can't find one. I ran gem install bundler, I confirmed that bundler is installed, I've configured Capistrano with every setting I know should work, and I still can't find a solution to this.
Capfile:
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
require 'capistrano/rails'
# require "capistrano/rvm"
require "capistrano/rbenv"
require "capistrano/bundler"
# require "capistrano/chruby"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require "capistrano/puma"
install_plugin Capistrano::Puma # Default puma tasks
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
Deploy:
lock "~> 3.10.1"
set :application, "app_name"
set :repo_url, "my bitbucket"
set :branch, 'master'
set :use_sudo, true
set :rbenv_type, :user
set :rbenv_ruby, '2.5.0'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all # default value
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/home/ubuntu/app_name"
Upvotes: 1
Views: 1530
Reputation: 5145
For me, adding the following line to config/deploy.rb
append :asdf_map_ruby_bins, 'puma', 'pumactl' # I use asdf to manage ruby plugins
# Or
# append :rbenv_map_bins, 'puma', 'pumactl' if you're using Rbenv, like OP
solved the issue. Hope it helps someone!
Reference: https://github.com/seuros/capistrano-puma/issues/188
NB* append
is the new Capistrano syntax, set
still works though
Upvotes: 0
Reputation: 801
Figured it out. Turned out to be this single line in my config/deploy.rb file:
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
By removing that it works...
Upvotes: 2