上传到 s3 时图像损坏,仅限生产。 (载波、发动机场)
我正在使用 Carrierwave 将图像上传到亚马逊 s3。这在开发中效果很好,但当我将其推送到我的服务器(engineyard 云试用版)时效果不佳。
该过程工作正常,没有抛出任何错误,并且返回了链接。然而,实际的图像不知何故被损坏了。
例如,这是一个: https://s3.amazonaws .com/ZenBucket/uploads/goal/photo/30/guinness-toucan.jpg
谁能告诉我它是如何被损坏的,或者会发生什么正在做吗?
编辑:部署后的第一次图像上传尝试似乎总是失败 500,但错误不会显示在日志中。不确定这是否相关。
Edit2:似乎也发生在蜻蜓宝石而不是载波上。
谢谢
I am using carrierwave to upload images to amazon s3. This works great on development, but not when I push it to my server (engineyard cloud trial).
The process works fine, no errors are thrown, and a link is given back. However, the actual image is corrupted, somehow.
Here's one, for example: https://s3.amazonaws.com/ZenBucket/uploads/goal/photo/30/guinness-toucan.jpg
Can anyone tell me how it's being corrupted, or what could be doing it?
Edit: The first image upload attempt after deploying always seems to fail 500, but the error doesn't show in the log. Not sure if that's relevent.
Edit2: Also seems to be occurring with dragonfly gem instead of carrierwave.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果它只发生在部署后的第一个图像上,我会怀疑你的应用程序仍在加载(或者至少有一些工作人员正在加载),导致 CPU 使用率高并减慢上传过程,这可能会导致超时并损坏图像同时。
我假设 Engine Yard 只会在第一个请求时重新加载您的应用程序,这可能就是原因。您应该尝试在部署后“卷曲”您的应用程序,然后等待几分钟看看是否有帮助。
EC2 上的小型实例具有单核,并且在重新启动许多工作进程时可能会变得非常慢。
If it only happens on the first image after a deploy, I would suspect that your app is still loading (or at least some workers are), causing high cpu usage and slowing down the upload process, which might make it timeout and corrupt the image at the same time.
I assume that Engine Yard will reload your app only on the first request, which might be why. You should try just "curling" your app after a deploy and wait a couple minutes to see if that helps.
Small instances on EC2 have a single core and can become quite slow when many workers are being restarted.
完成 EngineYard 的载波/雾设置,如下所述:
http://www.engineyard.com/blog/2011/载波温和介绍/
在这里:
http://docs.engineyard .com/use-rierwave-and-optionally-fog-to-upload-and-store-files.html
您的“fog”公开设置为“false”还是“true”?如果它是“false”,请检查此线程,因为您需要使用“authenticated_url”属性而不是返回的内容:
http://groups.google.com/group/rierwave/browse_thread/thread/2f727c77864ac923
Go through the carrierwave / fog setup for EngineYard, as described here:
http://www.engineyard.com/blog/2011/a-gentle-introduction-to-carrierwave/
and here:
http://docs.engineyard.com/use-carrierwave-and-optionally-fog-to-upload-and-store-files.html
Is your "fog" public set to "false" or "true"? If it's "false", check this thread, as you'll need to use the "authenticated_url" property instead of what's returned:
http://groups.google.com/group/carrierwave/browse_thread/thread/2f727c77864ac923
jRuby 上的 gzip 压缩(可能使用 https)似乎已解决。如果有人需要我的堆栈中的版本号,我可以帮忙。
There appears to have been an issue with gzip compression on jRuby (possibly with https) that has been resolved. If anyone needs version numbers from my stack, I can oblige.