我正在使用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 /&#39;:权限被拒绝
谁能告诉我为什么会这样?
答案 0 :(得分:0)
两件事:
直接使用chmod
代替find
和exec
,如下所示:chmod 755 #{current_path}
检查server_owner
用户是否有current_path
的权限。如果没有,请使用sudo
,如下所示:sudo "chmod 755 #{current_path}"