问题描述
当我用capistrano部署我的rails应用程序时,我有一个非常奇怪的错误.有时是部署,有时不是.例如我添加一些东西到CSS(只是一个字符串)例如.my_some_class{width:10px}
然后部署失败.在我添加它之前-部署成功.我确定没有其他改变,因为我进行了实验提交,其中仅包含一串CSS.我的配置:
i have very strange error when deploy my rails app with capistrano. sometimes it's deploy and sometimes not.for example i add something to css (just one string) e.g. .my_some_class{width:10px}
and after that deployment fails. before i add this - it's deploy ok.i am sure what nothing else changed cause i make experimental commit which contain only one string of css.my config:
rails 4.1.0
ruby 2.1.1p76
gem 'capistrano-rails', group: :development
gem 'capistrano-rvm', group: :development
gem 'capistrano-bundler', group: :development
部署日志结束:
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: rake exit status: 137
rake stdout: Nothing written
rake stderr: SafeYAML Warning
----------------
You appear to have an outdated version of libyaml (0.1.4) installed on your system.
Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads.
For more info, see:
https://www.ruby-lang.org/en/news/2014/03/29/heap-overflow-in-yaml-uri-escape-parsing-cve-2014-2525/
The easiest thing to do right now is probably to update Psych to the latest version and enable
the 'bundled-libyaml' option, which will install a vendored libyaml with the vulnerability patched:
gem install psych -- --enable-bundled-libyaml
I, [2014-04-30T09:42:41.121037 #12193] INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/Thumbs-82e32ea0cc1ce375db2805ceadd707ef.db
I, [2014-04-30T09:42:41.123108 #12193] INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/agency_no_logo-a8544e60b8a38abeb431c2eb5089f7c6.png
I, [2014-04-30T09:42:41.461121 #12193] INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/swipebox/img/loader-a66dde050b0b2447862919f2c4c37eda.gif
bash: line 1: 12193 Killed ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
推荐答案
如上所述,可能您的RAM不足.
As was written above, probably, you have not enough RAM.
我通过在Ubuntu 14.04服务器上添加SWAP文件解决了问题:
I solved problem by adding SWAP file on my Ubuntu 14.04 server:
在root
下:
dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile
将下一行添加到/etc/fstab
:
/swapfile none swap sw 0 0
和:
echo 0 > /proc/sys/vm/swappiness
sudo chown root:root /swapfile
sudo chmod 0600 /swapfile
检查SWAP(可能需要重新加载):
check SWAP(maybe need reloading):
swapon -s
-如何在其上添加交换Ubuntu 14.04 @ Digital Ocean社区
这篇关于rails 4.1无法通过capistrano 3进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!