【发布时间】:2013-09-14 16:29:58
【问题描述】:
我正在使用 Rails 4 和 assets_sync(使用 Fog)将 Amazon S3 用于我的资产. S3 存储桶位于“eu-west-1”(爱尔兰)。
在 production.rb 和 development.rb 环境中,我设置了以下行(BUCKETNAME 是真实的存储桶名称):
config.action_controller.asset_host = "http://s3-eu-west-1.amazonaws.com/BUCKETNAME"
此外,我还设置了下一个环境变量:AWS_ACCESS_KEY_ID、AWS_SECRET_ACCESS_KEY、FOG_DIRECTORY、FOG_PROVIDER(以及 FOG_REGION=eu-west-1 拼命尝试)。
不管我做什么,我都会收到以下错误(已经是posted in StackOverflow,这个答案对我没有帮助)
rake assets:precompile
[WARNING] fog: followed redirect to BUCKETNAME.s3-external-3.amazonaws.com, connecting to the matching region will be more performant
[WARNING] fog: followed redirect to BUCKETNAME.s3-external-3.amazonaws.com, connecting to the matching region will be more performant
rake aborted!
Connection reset by peer (Errno::ECONNRESET)
(... more trace details ...)
尽管出现此错误,但有时仍会上传资产(如 application-7d888bd5c98564a528d102954bf2061a.css),但由于应用程序正在以这种方式链接资产,因此仍然可以正常工作:
<link data-turbolinks-track="true" href="//s3-eu-west-1.amazonaws.com/BUCKETNAME/assets/application.css?body=1" media="all" rel="stylesheet" />
如果有帮助,我在生产中启用了以下选项: config.assets.compile = false config.assets.digest = true
有什么建议可以帮助我接近解决方案吗?
【问题讨论】:
-
似乎我在开发环境中没有 config.assets.digest = true 活跃。区域警告继续出现,但一切正常。
标签: ruby-on-rails amazon-web-services amazon-s3 fog