prajeesh
prajeesh

Reputation: 2392

cannot load such file -- bundler/setup - Capistrano

I am trying to learn deployment via capistrano. When i run the deploy script everything is working fine except the migration.

I am getting the following error.

INFO [175f4b0b] Running /usr/bin/env rake db:migrate as 

prajeesh@xx.x.x.xxx
DEBUG [175f4b0b] Command: cd /home/prajeesh/Desktop/projects/capistrano_staging/current && ( RAILS_ENV=development /usr/bin/env rake db:migrate )
DEBUG [175f4b0b]    rake aborted!
DEBUG [175f4b0b]    

cannot load such file -- bundler/setup

Capfile

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'
#require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

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

Deploy file

# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'capistrano_study'
set :repo_url, 'https://github.com/xxxxxxxx/capistrano_study.git'

# config valid only for current version of Capistrano
set :stages, ["development","staging", "production"]
set :default_stage, "development"
set :user, "prajeesh"
after "deploy:updated", "deploy:migrate"

 set :keep_releases, 5

namespace :deploy do
  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end
end

If i run the command RAILS_ENV=development /usr/bin/env rake db:migrate directly from the project path, the migration is running but through capistrano it is not working.

Any help would be appreciated.

Upvotes: 0

Views: 990

Answers (2)

prajeesh
prajeesh

Reputation: 2392

All i had to do was to install the gem 'capistrano-rvm' and require it on the cap file

Upvotes: 0

Rubyrider
Rubyrider

Reputation: 3587

Here is your answer:

Install the following gem:

gem 'capistrano-rails', '~> 1.1'

and require the bundler tasks

# Capfile
require 'capistrano/bundler' # Rails needs Bundler, right?
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

Source: https://github.com/capistrano/rails/

Upvotes: 1

Related Questions