2

我正在使用 cap deploy 部署到登台。cap deploy:setup 创建了发布和共享文件夹。

这是 deploy.rb 代码。

set :stages, %w(staging production)
set :default_stage, "staging"
set :stage_dir, "capistrano"
require 'capistrano/ext/multistage'

set :application, "application"
set :repository,  "git@github.com:owner/#{application}.git"
set :scm, :git

set :local_user, ENV['USER'] || ENV['USERNAME'] || "unknown"
set :user, "server_owner"

set :deploy_via, :copy

set :use_sudo, false
set :copy_remote_dir, "/home/#{user}/tmp/capistrano"

namespace :deploy do
  desc "Change Permissions" 
  task :change_permissions, :except => { :no_release => true } do
    run "find #{current_path}/ -type d -exec chmod 755 {} \\;"
    run "find #{current_path}/ -type f -exec chmod 644 {} \\;"
  end

  desc "Create symlinks for shared items"
  task :update_shared_symlinks, :except => { :no_release => true} do
     < ln -s command to create the links>
  end
end

before "deploy:finalize_update", "deploy:update_shared_symlinks"

这是暂存代码

role :app, "ipaddress"

set :branch, "staging"

set :deploy_to, "/home/#{user}/_#{application}_beta/"

使用 cap deploy 进行部署时,出现以下错误

ln:创建符号链接`/home/narayan/_instaprint_beta/releases/20130130102815/':权限被拒绝

谁能告诉我为什么会这样?

4

1 回答 1

0

两件事情:

  1. 立即使用chmod而不是findand exec,如下所示:chmod 755 #{current_path}

  2. 检查server_owner用户是否有权限current_path。如果没有,那么sudo像这样使用:sudo "chmod 755 #{current_path}"

于 2013-05-09T06:47:33.300 回答