2 votes

Erreur Capistrano "bundle : not found".

J'essaie de déployer octopress sur un VPS mais j'obtiens cette erreur bundle: not found mais l'offre groupée est installée !

Erreur complète.

$ cap deploy
  * 2013-07-20 18:08:55 executing `deploy'
  * 2013-07-20 18:08:55 executing `deploy:update'
 ** transaction: start
  * 2013-07-20 18:08:55 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@mydomain.com:website.git HEAD"
    command finished in 8348ms
  * executing "if [ -d /home/deploy/ruby_apps/website/shared/cached-copy ]; then cd /home/deploy/ruby_apps/website/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard de26553c0aa7ea583e0bfdec2c103ba83adbb793 && git clean -q -d -x -f; else git clone -q git@mydomain.com:website.git /home/deploy/ruby_apps/website/shared/cached-copy && cd /home/deploy/ruby_apps/website/shared/cached-copy && git checkout -q -b deploy de26553c0aa7ea583e0bfdec2c103ba83adbb793; fi"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
^Acssh revers    command finished in 7161ms
    copying the cached version to /home/deploy/ruby_apps/website/releases/20130720123917
  * executing "cp -RPp /home/deploy/ruby_apps/website/shared/cached-copy /home/deploy/ruby_apps/website/releases/20130720123917 && (echo de26553c0aa7ea583e0bfdec2c103ba83adbb793 > /home/deploy/ruby_apps/website/releases/20130720123917/REVISION)"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
    command finished in 1868ms
  * 2013-07-20 18:09:19 executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * 2013-07-20 18:09:19 executing `bundle:install'
  * executing "cd /home/deploy/ruby_apps/website/releases/20130720123917 && bundle install --gemfile /home/deploy/ruby_apps/website/releases/20130720123917/Gemfile --path /home/deploy/ruby_apps/website/shared/bundle --deployment --quiet --without development test"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
 ** [out :: mydomain.com] sh: 1:
 ** [out :: mydomain.com] bundle: not found
 ** [out :: mydomain.com] 
    command finished in 1431ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deploy/ruby_apps/website/releases/20130720123917; true"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
    command finished in 1387ms
failed: "sh -c 'cd /home/deploy/ruby_apps/website/releases/20130720123917 && bundle install --gemfile /home/deploy/ruby_apps/website/releases/20130720123917/Gemfile --path /home/deploy/ruby_apps/website/shared/bundle --deployment --quiet --without development test'" on mydomain.com

J'ai fait une recherche sur Google et j'ai découvert cap shell et j'ai découvert que la variable PATH n'est probablement pas définie d'une manière ou d'une autre

$ cap shell                                                                                                                                                         1 
  * 2013-07-20 18:16:43 executing `shell'
====================================================================
Welcome to the interactive Capistrano shell! This is an experimental
feature, and is liable to change in future releases. Type 'help' for
a summary of how to use the shell.
--------------------------------------------------------------------
cap> echo $PATH
[establishing connection(s) to mydomain.com]
 ** [out :: mydomain.com] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
 ** [out :: mydomain.com] 
cap> id
 ** [out :: mydomain.com] uid=1003(deploy) gid=1003(deploy) groups=1003(deploy),1005(rvm)
 ** [out :: mydomain.com] 
cap>

Mais lorsque je me connecte à deploy@mydomain.com

deploy@mydomain:~$ id
uid=1003(deploy) gid=1003(deploy) groups=1003(deploy),1005(rvm)
deploy@mydomain:~$ echo $PATH
/usr/local/rvm/gems/ruby-2.0.0-p247/bin:/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p247/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
deploy@mydomain:~$ grep source .bashrc
# sources /etc/bash.bashrc).
source /etc/profile.d/rvm.sh
deploy@mydomain:~$ rvm list

rvm rubies

   ruby-1.9.3-p429 [ x86_64 ]
=* ruby-2.0.0-p247 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

deploy@mydomain:~$ gem list bundler

*** LOCAL GEMS ***

bundler (1.3.5)
bundler-unload (1.0.1)
deploy@mydomain:~$ gem which bundler
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb
deploy@mydomain:~$ 

Je ne sais pas exactement ce qui m'échappe. J'ai également essayé d'ajouter source /etc/profile.d/rvm.sh à .bash_login mais toujours pas de chance.

6voto

kn330 Points 827

Il semble que Capistrano utilise Shell non interactif et donc il ne lira pas bashrc.

Solution :

Ajouté à deploy.rb

set :default_shell, '/bin/bash -l'

0voto

mpapis Points 334

Vous devez utiliser rvm-capistrano - ce projet vous permet de contrôler le chargement de rvm et les tâches d'aide comme l'installation de rvm ou de ruby.

0voto

februaryInk Points 101

Lorsque j'ai obtenu le bash: bundle: not found avec Capistrano et rvm, j'utilisais Puma et j'ai découvert que je devais requérir capistrano-puma après capistrano-rvm dans mon Capfile :

...

require 'capistrano/rvm'
require 'capistrano/puma'

...

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X