Не удалось Capistrano - текущий каталог / пакет: не найден / откат - PullRequest
2 голосов
/ 14 марта 2012

Недавно я переместил одно из моих приложений rails в недавно сконфигурированный экземпляр EC2 Ubuntu.Работает на той же версии ruby, что и старый сервер, apache с пассажирским.Но я все еще не мог развернуть приложение на сервере с Capistrano.Тем не менее, я не имею ни малейшего представления об ошибке, поэтому я вставляю свои журналы развертывания здесь.Также вот мой рецепт Capistrano .Цените, если кто-то может найти проблему здесь.

$ cap deploy:setup
    triggering start callbacks for `deploy:setup'
  * executing `uploads:register_dirs'
  * executing `deploy:setup'
  * executing "mkdir -p /home/ubuntu/webapps/myapp-name /home/ubuntu/webapps/myapp-name/releases /home/ubuntu/webapps/myapp-name/shared /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/shared/uploads"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'mkdir -p /home/ubuntu/webapps/myapp-name /home/ubuntu/webapps/myapp-name/releases /home/ubuntu/webapps/myapp-name/shared /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/shared/uploads'
    command finished in 696ms
  * executing "chmod g+w /home/ubuntu/webapps/myapp-name /home/ubuntu/webapps/myapp-name/releases /home/ubuntu/webapps/myapp-name/shared /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/shared/uploads"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'chmod g+w /home/ubuntu/webapps/myapp-name /home/ubuntu/webapps/myapp-name/releases /home/ubuntu/webapps/myapp-name/shared /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/shared/uploads'
    command finished in 205ms

Приведенный выше не создает каталог current по какой-то причине, но я вижу каталоги releases и shared.Плюс внутри общего каталога у меня есть еще один каталог под названием uploads

$ cap deploy
    triggering start callbacks for `deploy'
  * executing `uploads:register_dirs'
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote . master"
    command finished in 5ms
  * getting (via checkout) revision a7e86283b743de666354349c56c66f80a35a6997 to /tmp/20120314153001
    executing locally: git clone -q . /tmp/20120314153001 && cd /tmp/20120314153001 && git checkout -q -b deploy a7e86283b743de666354349c56c66f80a35a6997
    command finished in 1879ms
    compressing /tmp/20120314153001 to /tmp/20120314153001.tar.gz
    executing locally: tar czf 20120314153001.tar.gz 20120314153001
    command finished in 4323ms
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
 ** sftp upload /tmp/20120314153001.tar.gz -> /tmp/20120314153001.tar.gz
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sftp upload /tmp/20120314153001.tar.gz -> /tmp/20120314153001.tar.gz
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sftp upload /tmp/20120314153001.tar.gz -> /tmp/20120314153001.tar.gz done
  * sftp upload complete
  * executing "cd /home/ubuntu/webapps/myapp-name/releases && tar xzf /tmp/20120314153001.tar.gz && rm /tmp/20120314153001.tar.gz"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'cd /home/ubuntu/webapps/myapp-name/releases && tar xzf /tmp/20120314153001.tar.gz && rm /tmp/20120314153001.tar.gz'
    command finished in 2353ms
  * executing `deploy:finalize_update'
  * executing "chmod -R g+w /home/ubuntu/webapps/myapp-name/releases/20120314153001"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'chmod -R g+w /home/ubuntu/webapps/myapp-name/releases/20120314153001'
    command finished in 294ms
  * executing "rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001/log /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/system /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp/pids &&\\\n      mkdir -p /home/ubuntu/webapps/myapp-name/releases/20120314153001/public &&\\\n      mkdir -p /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001/log /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/system /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp/pids &&\
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] mkdir -p /home/ubuntu/webapps/myapp-name/releases/20120314153001/public &&\
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] mkdir -p /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp'
    command finished in 211ms
  * executing "ln -s /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/system"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ln -s /home/ubuntu/webapps/myapp-name/shared/system /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/system'
    command finished in 193ms
  * executing "ln -s /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/releases/20120314153001/log"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ln -s /home/ubuntu/webapps/myapp-name/shared/log /home/ubuntu/webapps/myapp-name/releases/20120314153001/log'
    command finished in 189ms
  * executing "ln -s /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp/pids"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ln -s /home/ubuntu/webapps/myapp-name/shared/pids /home/ubuntu/webapps/myapp-name/releases/20120314153001/tmp/pids'
    command finished in 191ms
  * executing "ln -s /home/ubuntu/webapps/myapp-name/shared/uploads /home/ubuntu/webapps/myapp-name/releases/20120314153001/uploads"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ln -s /home/ubuntu/webapps/myapp-name/shared/uploads /home/ubuntu/webapps/myapp-name/releases/20120314153001/uploads'
    command finished in 191ms
  * executing "find /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/images /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/stylesheets /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/javascripts -exec touch -t 201203141535.01 {} ';'; true"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] env TZ=UTC sh -c 'find /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/images /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/stylesheets /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/javascripts -exec touch -t 201203141535.01 {} '\'';'\''; true'
    command finished in 2057ms
    triggering after callbacks for `deploy:finalize_update'
  * executing `uploads:symlink'
  * executing "rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/uploads"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/uploads'
    command finished in 192ms
  * executing "ln -nfs /home/ubuntu/webapps/myapp-name/shared/uploads /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/uploads"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ln -nfs /home/ubuntu/webapps/myapp-name/shared/uploads /home/ubuntu/webapps/myapp-name/releases/20120314153001/public/uploads'
    command finished in 204ms
  * executing `bundle:install'
  * executing "ls -x /home/ubuntu/webapps/myapp-name/releases"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'ls -x /home/ubuntu/webapps/myapp-name/releases'
    command finished in 188ms
  * executing "cd /home/ubuntu/webapps/myapp-name/releases/20120314153001 && bundle install --gemfile /home/ubuntu/webapps/myapp-name/releases/20120314153001/Gemfile --path /home/ubuntu/webapps/myapp-name/shared/bundle --deployment --quiet --without development test"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'cd /home/ubuntu/webapps/myapp-name/releases/20120314153001 && bundle install --gemfile /home/ubuntu/webapps/myapp-name/releases/20120314153001/Gemfile --path /home/ubuntu/webapps/myapp-name/shared/bundle --deployment --quiet --without development test'
*** [err :: ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh:
*** [err :: ec2-184-73-xx-xxx.compute-1.amazonaws.com] bundle: not found
*** [err :: ec2-184-73-xx-xxx.compute-1.amazonaws.com] 
    command finished in 189ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001; true"
    servers: ["ec2-184-73-xx-xxx.compute-1.amazonaws.com"]
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] executing command
    [ec2-184-73-xx-xxx.compute-1.amazonaws.com] sh -c 'rm -rf /home/ubuntu/webapps/myapp-name/releases/20120314153001; true'
    command finished in 435ms
failed: "sh -c 'cd /home/ubuntu/webapps/myapp-name/releases/20120314153001 && bundle install --gemfile /home/ubuntu/webapps/myapp-name/releases/20120314153001/Gemfile --path /home/ubuntu/webapps/myapp-name/shared/bundle --deployment --quiet --without development test'" on ec2-184-73-xx-xxx.compute-1.amazonaws.com

1 Ответ

2 голосов
/ 14 марта 2012

Короче говоря, похоже, что команда bundle не найдена на сервере.

Вы можете подтвердить, что он установлен с помощью SSH на сервер как «ubuntu» (пользователь, указанный в файле развертывания) и попробовать запустить bundle. Если вы получите сообщение об ошибке «Команда не найдена», возможно, пакет не установлен или у пользователя «ubuntu» нет прав.

Если приведенная выше команда работает, то переменные окружения могут не загружаться, когда cap пытается выполнить свои команды. Мне пришлось указать следующие переменные среды в сценарии развертывания:

default_environment['PATH'] = '/usr/local/lib/ruby/gems/1.9.1/bin:$PATH'
default_environment['GEM_PATH']= '/usr/local/lib/ruby/gems/1.9.1'

Очевидно, настройте пути в соответствии с конфигурацией вашего сервера.

Надеюсь, это поможет!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...