好的,所以我有一个新的ec2实例,全部设置,我与用户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
一切似乎都没问题,但是当我进行上限部署时,我最后会收到此错误
[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
我需要改变的任何想法
更新
这是我的整个输出
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
答案 0 :(得分:2)
因此,您可以从输出中看到:
chmod: cannot access `/var/www/projects/shared/log/*': No such file or directory
那些失踪的Mkdir死了并确保他们的权限没问题。