1)上下文
在部署Spree站点时,cap deploy
会返回以下错误消息:
[err :: 000.000.000.000] /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby /var/www/site/shared/bundle/ruby/1.9.1/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
我已在此消息的末尾发布了更多cap deploy
以下的输出。
注意:
1a)导航到生产站点,我发现大多数资产都丢失了,这证实了资产预编译阶段已经中止。
1b)Cap deploys在退出之前显示成功消息,请参阅4)
下的输出帖子2)我的问题
我如何调整Capistrano和Rake以获取有关失败的更多信息?是否可以将Capistrano及其工具堆栈的日志级别设置为调试甚至信息?
3)我已经尝试过但没有成功
3a)当从开发盒和生产服务器上的命令行调用时,此rake任务结束时没有错误消息。
3b)rake --trace
只列出被调用/执行的任务,同样没有错误消息。
3c)添加以下初始化程序也无济于事:
# config/initializers/assets_logging.rb
Rails.application.assets.logger = Logger.new($stdout)
Rails.application.assets.logger.level = 0
3d)应用程序在开发模式下工作正常,我的软件包是最新的。 我列出了第4节下的Gemfile,也许它会提供一个提示
4)其他信息
我Gemfile
的内容:
source 'https://rubygems.org'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end # group :assets do
group :development do
gem 'xray-rails'
gem 'capistrano', '~> 2.15.5'
gem 'rvm-capistrano', '~> 1.4.1'
gem 'diffy'
gem 'thin'
end # group :development do
group :production do
gem 'activerecord-postgresql-adapter', '~> 0.0.1'
end # group :production do
gem 'rails', '3.2.13'
gem 'pg'
gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git', :branch => '2-0-stable'
gem 'squeel'
gem 'capistrano-log_with_awesome'
# private library
gem 'myprivatelibrary', path: "/home/user/myprivatelibrary/"
gem 'requirejs-rails'
gem 'jquery-rails', '~> 2.2.1'
gem 'spree', '2.0.3'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-0-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-0-stable'
cap deploy
的输出(以便轻松发现错误,查找包含三颗星的唯一行,即开头为***
):
triggering load callbacks
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
* getting (via checkout) revision to /tmp/20131212195216
executing locally: cp -R . /tmp/20131212195216
command finished in 457ms
* Compressing /tmp/20131212195216 to /tmp/20131212195216.tar.gz
executing locally: tar czf 20131212195216.tar.gz 20131212195216
command finished in 11527ms
servers: ["87.98.157.252"]
** sftp upload /tmp/20131212195216.tar.gz -> /tmp/20131212195216.tar.gz
[87.98.157.252] /tmp/20131212195216.tar.gz
[87.98.157.252] done
* sftp upload complete
* executing "cd /var/www/site/releases && tar xzf /tmp/20131212195216.tar.gz && rm /tmp/20131212195216.tar.gz"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 901ms
* executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* executing `bundle:install'
* executing "cd /var/www/site/releases/20131212195216 && bundle install --gemfile /var/www/site/releases/20131212195216/Gemfile --path /var/www/site/shared/bundle --deployment --quiet --without development test"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 2087ms
* executing `deploy:assets:symlink'
* executing "rm -rf /var/www/site/releases/20131212195216/public/assets && mkdir -p /var/www/site/releases/20131212195216/public && mkdir -p /var/www/site/shared/assets && ln -s /var/www/site/shared/assets /var/www/site/releases/20131212195216/public/assets"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 253ms
* executing "chmod -R -- g+w /var/www/site/releases/20131212195216 && rm -rf -- /var/www/site/releases/20131212195216/public/system && mkdir -p -- /var/www/site/releases/20131212195216/public/ && ln -s -- /var/www/site/shared/system /var/www/site/releases/20131212195216/public/system && rm -rf -- /var/www/site/releases/20131212195216/log && ln -s -- /var/www/site/shared/log /var/www/site/releases/20131212195216/log && rm -rf -- /var/www/site/releases/20131212195216/tmp/pids && mkdir -p -- /var/www/site/releases/20131212195216/tmp/ && ln -s -- /var/www/site/shared/pids /var/www/site/releases/20131212195216/tmp/pids"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 310ms
triggering after callbacks for `deploy:update_code'
* executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /var/www/site/shared/assets/manifest* ] && cat /var/www/site/shared/assets/manifest* || echo"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 527ms
** Updating mtimes for ~2976 assets...
servers: ["87.98.157.252"]
** scp upload #<StringIO:0x00000001567d58> -> /var/www/site/TOUCH_ASSETS
[87.98.157.252] /var/www/site/TOUCH_ASSETS
* scp upload complete
* executing "cat /var/www/site/TOUCH_ASSETS | while read asset; do touch -c -- \"$asset\"; done && rm -f -- /var/www/site/TOUCH_ASSETS"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 2694ms
* executing "cd -- /var/www/site/releases/20131212195216 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
*** [err :: 87.98.157.252] /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby /var/www/site/shared/bundle/ruby/1.9.1/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
command finished in 116488ms
* executing "ls -1 /var/www/site/shared/assets/manifest* | wc -l"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 245ms
* executing "ls /var/www/site/shared/assets/manifest*"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 271ms
* executing "ls -x /var/www/site/releases"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 247ms
* executing "cp -- /var/www/site/shared/assets/manifest.yml /var/www/site/releases/20131212195216/assets_manifest.yml"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 244ms
* executing `deploy:create_symlink'
* executing "rm -f /var/www/site/current && ln -s /var/www/site/releases/20131212195216 /var/www/site/current"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 258ms
** transaction: commit
* executing `deploy:restart'
* executing "touch /var/www/site/current/tmp/restart.txt"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 247ms
triggering after callbacks for `deploy:restart'
* executing `deploy:cleanup'
* executing "ls -1dt /var/www/site/releases/* | tail -n +6 | xargs rm -rf"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 336ms
triggering after callbacks for `deploy:cleanup'
* executing `deploy:assets:clean_expired'
* executing "for manifest in /var/www/site/releases/*/assets_manifest.*; do cat -- \"$manifest\" 2> /dev/null && printf ':::' || true; done"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 758ms
** Fetched 5 manifests from /var/www/site/releases/*/assets_manifest.*
** Writing required assets to /var/www/site/REQUIRED_ASSETS...
servers: ["87.98.157.252"]
** scp upload #<StringIO:0x000000015b52d8> -> /var/www/site/REQUIRED_ASSETS
[87.98.157.252] /var/www/site/REQUIRED_ASSETS
* scp upload complete
** Removing assets that haven't been deployed for 10080 minutes...
* executing "cd -- /var/www/site/ && LC_COLLATE=C sort REQUIRED_ASSETS -o REQUIRED_ASSETS && cd -- /var/www/site/shared/assets/ && for f in $( find * -mmin +10080 -type f | LC_COLLATE=C sort | LC_COLLATE=C comm -23 -- - /var/www/site/REQUIRED_ASSETS ); do echo \"Removing unneeded asset: $f\"; rm -f -- \"$f\"; done; rm -f -- /var/www/site/REQUIRED_ASSETS"
servers: ["87.98.157.252"]
[87.98.157.252] executing command
command finished in 300ms
欢迎任何帮助。
答案 0 :(得分:1)
我可以在从requirejs
删除Gemfile
时解决此问题。