Почему мой капистрано терпит неудачу? - PullRequest
3 голосов
/ 23 января 2012

Хорошо, поэтому у меня есть новый экземпляр ec2, который полностью настроен, и я ssh подключился к пользователю ec2-user, и на моей локальной машине я выполнил команду проверки

cap deploy:check
  * executing `deploy:check'
  * executing "test -d /var/www/projects/releases"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 101ms
  * executing "test -w /var/www/projects"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 106ms
  * executing "test -w /var/www/projects/releases"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 103ms
  * executing "which git"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 104ms
You appear to have all necessary dependencies installed

Кажется, все в порядке, но когда я запускаю cap, я получаю эту ошибку в конце

 [50.19.84.170] executing command
    command finished in 150ms
failed: "sh -c 'rm -f /var/www/projects/current && ln -s /var/www/projects/releases/20120123133717 /var/www/projects/current'" on 50.19.84.170

тогда я вижу, есть ли что-нибудь в каталоге выпусков и ничего

 ls -la /var/www/projects/releases/total 8
drwxrwxr-x 2 ec2-user ec2-user 4096 Jan 23 13:37 .
drwxrwxr-x 5 ec2-user ec2-user 4096 Jan 20 03:03 ..

не уверен, что я делаю неправильно ... вот мой deploy.rb

set :application, "projects"
set :deploy_to, "/var/www/#{application}"
set :keep_releases, 3

set :scm, :git
set :repository,  "git@github.com:railsdevmatt/fat_free_crm.git"
set :git_shallow_clone, 1
set :branch, "master"
set :use_sudo, true

set :user, "ec2-user"
ssh_options[:forward_agent] = true
default_run_options[:pty] = true

role :app, "50.19.84.170"
role :web, "50.19.84.170"
role :db,  "50.19.84.170", :primary => true

after "deploy:setup", :fix_perms
after "deploy:update_code", :fix_perms

# ssh_options[:keys] = ["#{ENV['HOME']}/Downloads/important.pem"]

task :fix_perms do
  # sudo "chown apache:webshare -R /var/www/projects"
  # sudo "chmod 666 -R /var/www/projects/shared/log/*"
end

любые идеи, что мне нужно изменить

UPDATE

Вот весь мой вывод

cap deploy
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote git@github.com:railsdevmatt/fat_free_crm.git master"
/Library/Ruby/Gems/1.8/gems/capistrano-2.6.0/lib/capistrano/recipes/deploy.rb:104: warning: Insecure world writable dir /Users/mattelhotiby in PATH, mode 040777
    command finished in 1061ms
  * executing "git clone -q --depth 1 git@github.com:railsdevmatt/fat_free_crm.git /var/www/projects/releases/20120123144652 && cd /var/www/projects/releases/20120123144652 && git checkout -q -b deploy 65b439e201c2134fc97ee10a4ea66174018d8553 && (echo 65b439e201c2134fc97ee10a4ea66174018d8553 > /var/www/projects/releases/20120123144652/REVISION)"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 1898ms
  * executing `deploy:finalize_update'
  * executing "chmod -R g+w /var/www/projects/releases/20120123144652"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 123ms
  * executing "rm -rf /var/www/projects/releases/20120123144652/log /var/www/projects/releases/20120123144652/public/system /var/www/projects/releases/20120123144652/tmp/pids &&\\\n      mkdir -p /var/www/projects/releases/20120123144652/public &&\\\n      mkdir -p /var/www/projects/releases/20120123144652/tmp &&\\\n      ln -s /var/www/projects/shared/log /var/www/projects/releases/20120123144652/log &&\\\n      ln -s /var/www/projects/shared/system /var/www/projects/releases/20120123144652/public/system &&\\\n      ln -s /var/www/projects/shared/pids /var/www/projects/releases/20120123144652/tmp/pids"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 133ms
  * executing "find /var/www/projects/releases/20120123144652/public/images /var/www/projects/releases/20120123144652/public/stylesheets /var/www/projects/releases/20120123144652/public/javascripts -exec touch -t 201201231446.55 {} ';'; true"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
 ** [out :: 50.19.84.170] find: `/var/www/projects/releases/20120123144652/public/images': No such file or directory
 ** [out :: 50.19.84.170] find: `/var/www/projects/releases/20120123144652/public/stylesheets': No such file or directory
 ** [out :: 50.19.84.170] find: `/var/www/projects/releases/20120123144652/public/javascripts': No such file or directory
    command finished in 111ms
    triggering after callbacks for `deploy:update_code'
  * executing `fix_perms'
  * executing "sudo -p 'sudo password: ' chown apache:webshare -R /var/www/projects"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 136ms
  * executing "sudo -p 'sudo password: ' chmod 666 -R /var/www/projects/shared/log/*"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
 ** [out :: 50.19.84.170] chmod: cannot access `/var/www/projects/shared/log/*': No such file or directory
    command finished in 119ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/projects/releases/20120123144652; true"
    servers: ["50.19.84.170"]
    [50.19.84.170] executing command
    command finished in 145ms
failed: "sh -c 'sudo -p '\\''sudo password: '\\'' chmod 666 -R /var/www/projects/shared/log/*'" on 50.19.84.170

вот этот каталог

 ls -la /var/www/projects/shared/
total 20
drwxrwxr-x 5 apache webshare 4096 Jan 23 13:32 .
drwxrwxr-x 5 apache webshare 4096 Jan 20 03:03 ..
drwxrwxr-x 2 apache webshare 4096 Jan 20 03:31 log
drwxrwxr-x 2 apache webshare 4096 Jan 23 13:32 pids
drwxrwxr-x 2 apache webshare 4096 Jan 23 13:32 system

1 Ответ

2 голосов
/ 23 января 2012

Итак, из выходного файла вы можете увидеть:

chmod: cannot access `/var/www/projects/shared/log/*': No such file or directory

Mkdir эти недостающие каталоги и убедитесь, что их разрешения в порядке.

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