编程语言
首页 > 编程语言> > ruby-Capistrano deploy.rb文件中的任务问题

ruby-Capistrano deploy.rb文件中的任务问题

作者:互联网

我从this tutorial中获取了我的deploy.rb文件中的以下内容,除touch命令外,其他所有内容均按预期工作.

有谁知道为什么这可能行不通?

set :application, "your-application-name"
set :repository, "git@github.com:you/your-project.git"
set :scm, :git
set :deploy_to, "/home/path/to/project/"
set :use_sudo, false

set :deploy_via, :remote_cache
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"]

server "example.org", :app

namespace :myproject do
    task :symlink, :roles => :app do
        run "ln -nfs #{shared_path}/uploads #{release_path}/application/wp-content/uploads"
        run "touch #{release_path}/env_production"
    end
end

after "deploy:create_symlink", ":after_deploy" 

上限部署的输出

 * executing `deploy'
 * executing `deploy:update'
** transaction: start
 * executing `deploy:update_code'
   updating the cached checkout on all servers
   executing locally: "git ls-remote git@github.com:jeffreynolte/Testing-WP-Workflow.git HEAD"
 * executing "if [ -d /var/www/domain.com/subdomains/wp-workflow/shared/cached-copy ]; then cd /var/www/domain.com/subdomains/wp-workflow/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 8c10e1f459dc78a127681362386bb84d5fbf3662 && git clean -q -d -x -f; else git clone -q git@github.com:jeffreynolte/Testing-WP-Workflow.git /var/www/domain.com/subdomains/wp-workflow/shared/cached-copy && cd /var/www/domain.com/subdomains/wp-workflow/shared/cached-copy && git checkout -q -b deploy 8c10e1f459dc78a127681362386bb84d5fbf3662; fi"
   servers: ["domain.com"]
   [domain.com] executing command
   command finished in 3905ms
   copying the cached version to /var/www/domain.com/subdomains/wp-workflow/releases/20121026041737
 * executing "rsync -lrpt --exclude=\".git\" --exclude=\".DS_Store\" --exclude=\".gitignore\" --exclude=\".gitmodules\" /var/www/domain.com/subdomains/wp-workflow/shared/cached-copy/ /var/www/domain.com/subdomains/wp-workflow/releases/20121026041737 && (echo 8c10e1f459dc78a127681362386bb84d5fbf3662 > /var/www/domain.com/subdomains/wp-workflow/releases/20121026041737/REVISION)"
   servers: ["domain.com"]
   [domain.com] executing command
   command finished in 577ms
 * executing `deploy:finalize_update'
 * executing "chmod -R g+w /var/www/domain.com/subdomains/wp-workflow/releases/20121026041737"
   servers: ["domain.com"]
   [domain.com] executing command
   command finished in 51ms
 * executing `deploy:symlink'
 * executing "rm -f /var/www/domain.com/subdomains/wp-workflow/current && ln -s /var/www/domain.com/subdomains/wp-workflow/releases/20121026041737 /var/www/domain.com/subdomains/wp-workflow/current"
   servers: ["domain.com"]
   [domain.com] executing command
   command finished in 45ms
** transaction: commit

解决方法:

在当前的Capistrano版本中,默认任务deploy:symlink已弃用,并已由deploy:create_symlink代替

要使其正常运行,请将最后一行更改为:

after "deploy:create_symlink", "myproject:symlink"

请参阅capistrano/recipes/deploy.rb line 294 and following.您应该已经在Capistrano输出中看到过时警告.为了使Capistrano输出更具可读性,我强烈建议capistrano_colors gem.

标签:deployment,capistrano,linux,ruby
来源: https://codeday.me/bug/20191127/2074667.html