加载'部署/资产'的Capistrano部署问题

时间:2012-06-19 03:32:24

标签: ruby-on-rails-3.1 capistrano

我有一个capistrano部署脚本,输出以下内容:

  * executing `deploy:assets:precompile'
  * executing "cd /data/sites/app/releases/20120619023328 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["123.230.158.135"]
    [123.230.158.135] executing command
*** [err :: 123.230.158.135] mkdir -p /data/sites/app/releases/20120619023328/public/assets
*** [err :: 173.230.158.135] mkdir -p /data/sites/app/releases/20120619023328/public/assets
*** [err :: 173.230.158.135] mkdir -p /data/sites/app/releases/20120619023328/public/assets
*** [err :: 173.230.158.135] mkdir -p /data/sites/app/releases/20120619023328/public/assets

这是孤立的: 加载'部署/资产'

但由于目录存在,我不确定这里发生了什么。如果我注释掉负载'deploy / assets',那么错误就会消失。我已经移动了这个调用的位置,但这似乎没有效果。此外,好像一切都得到了正确的部署,但显然,我不想要这个错误。关于如何纠正的任何想法?或者负载'部署/资产'的代码存在于哪里?

THX

编辑1 这可能是发生了什么? Capistrano error with successfully copied files

我应该忽略并在stderror上写这个而不是stdout

1 个答案:

答案 0 :(得分:1)

尝试使用此

  cap production deploy:cold

这是脚本:

    set :stages, %w(production staging)     #various environments
    load "deploy/assets"                    #precompile all the css, js and images... before deployment..
    require "bundler/capistrano"            # install all the new missing plugins...
    require 'capistrano/ext/multistage'     # deploy on all the servers..
    require 'delayed/recipes'               # load this for delayed job..
    require "rvm/capistrano"                # if you are using rvm on your server..
    require './config/boot'           
    require 'airbrake/capistrano'           # using airbrake in your application for crash notifications..
    require 'thinking_sphinx/deploy/capistrano'  # using thnking sphinx in your application
    require 'whenever/capistrano'           # using whenever for cron jobs..

    before "deploy:update_code", "thinking_sphinx:stop" # stop the serch engine before updating the code..
    after "deploy:update_code", "thinking_sphinx:rebuild" #rebuild the search engine configure and start the search engine..

    set :delayed_job_args, "-n 2"            # number of delayed job workers 
    before "deploy:update_code",    "delayed_job:stop"  # stop the previous deployed job workers...
    after "deploy:start",   "delayed_job:start" #start the delayed job 
    after "deploy:restart", "delayed_job:restart" # restart it..

    after "deploy:update", "deploy:cleanup" #clean up temp files etc.

    set :rvm_ruby_string, '1.9.3'             # ruby version you are using...
    set :rvm_type, :user
    set :whenever_environment, defer { stage }  # whenever gem for cron jobs...

    server "xx.xx.xx.xx", :app, :web, :db, :primary => true #ip of the server

    set(:application) { "my_cool_project" }
    set (:deploy_to) { "/home/me/#{application}/#{stage}" }
    set :user, 'my_awesome_deployer'
    set :keep_releases, 3
    set :repository, "git_repo_url"
    set :use_sudo, false
    set :scm, :git
    default_run_options[:pty] = true
    ssh_options[:forward_agent] = false
    set :deploy_via, :remote_cache
    set :git_shallow_clone, 1
    set :git_enable_submodules, 1

    namespace :deploy do
      task :start do ; end
      task :stop do ; end
      task :restart, :roles => :app, :except => { :no_release => true } do
        run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
      end
    end