【问题标题】:How to get Elastic Beanstalk to server compiled assets?如何将 Elastic Beanstalk 获取到服务器编译的资产?
【发布时间】:2013-01-01 07:59:54
【问题描述】:

我试图让 Rails 3.2.x 应用程序在生产环境中运行,但每次我访问已部署的应用程序时,它都会抱怨资产没有被编译:

An ActionView::Template::Error occurred in home#index:

application.css isn't precompiled
vendor/bundle/gems/actionpack-3.2.11/lib/sprockets/helpers/rails_helper.rb:142:in `digest_for'


-------------------------------
Request:
-------------------------------

* URL       : http://some-server.elasticbeanstalk.com/
* Parameters: {"controller"=>"home", "action"=>"index"}
* Rails root: /var/app/current
* Timestamp : 2013-01-17 17:22:55 UTC

但是,当我查阅我的 EB 实例的日志文件时,我将此视为每次部署的一部分:

Script succeeded.
Executing script: /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh
Output from script: /usr/bin/ruby1.9 /usr/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets

我可以在生产模式下运行本地乘客实例,并且资产服务良好。有没有人知道可能出了什么问题?

【问题讨论】:

  • 我在部署到 AWS 的 Elastic Beanstalk 时遇到了同样的问题。直到最近,一切都运行良好。我尝试恢复到以前的提交,但我仍然收到“application.css 未预编译”500 错误。

标签: ruby-on-rails asset-pipeline amazon-elastic-beanstalk


【解决方案1】:

尝试通过从应用程序根目录运行以下命令来重新启动应用程序:

touch tmp/restart.txt

为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 2013-11-14
    • 2019-06-17
    • 2015-04-17
    • 2015-01-06
    • 2015-03-23
    • 1970-01-01
    • 2016-08-08
    • 1970-01-01
    • 2016-11-28
    相关资源
    最近更新 更多