我遇到了Capistrano 3这个奇怪的问题.除非我删除服务器上app文件夹中的repo文件夹,否则它所部署的代码永远不会更新.如果我删除repo文件夹并进行部署,它将更新代码.
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'APP_NAME'
set :repo_url, 'REPO'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/deployer/apps/APP_NAME'
# Default value for :scm is :git
set :scm, :git
set :branch, "master"
# Default value for :format is :pretty
set :format, :pretty
# Default value for :log_level is :debug
set :log_level, :info
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}
# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
set :use_sudo, false
set :linked_files, ["config/database.yml"]
namespace :deploy do
desc "Start Unicorn"
task :start do
on roles(:app) do
within current_path do
execute :bundle, "exec unicorn_rails -c config/unicorn.rb -D"
end
end
end
desc "Stop Unicorn"
task :stop do
on roles(:app) do
execute "kill -s QUIT `cat #{shared_path}/pids/unicorn.pid`"
end
end
desc "Restart application"
task :restart do
invoke 'deploy:stop'
invoke 'deploy:start'
end
end
最佳答案 可能有点明显,但你检查了服务器上的权限?我会尝试为我正在尝试部署的文件夹上的任何用户提供完全权限,只是作为测试,看看它是否通过,如果确实如此,那么你知道你的问题在哪里.