在 Rails 中将文件从虚拟服务器移动到云
我有一个 ruby on Rails 项目 我有几千个与该网站相关的文件。 有没有一种简单的方法可以将所有文件从虚拟主机移动到云(亚马逊)。
基本上我有很多图像,我使用回形针 gem 来存储图像。已经有一些用户并拥有数千张图像。现在我计划迁移到云(亚马逊)。我已将 aws-s3 gem 用于此目的,它对于新图像效果很好。
但是如何放置已经上传的旧图像?
我必须手动压缩并重新上传吗?或者有更好的方法吗?
谢谢
I have a ruby on rails project
I have some few thousand files associated with the site.
Is there a simple way to move all the files from virtual host to cloud (amazon).
Basically I have a lot of images and I am using paperclip gem to store the images.There are already a few users and have thousands of images . Now I have planned to migrate to cloud(amazon). I have used aws-s3 gem for this purpose and it works fine for new images.
But How do I put the old images which were already uploaded ?
Do I have to manually zip and reupload ? or is there a better way ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗨,我会做一个简单的耙子任务来完成这个任务。它看起来像这样(未经测试):
一些注意事项:
如果您使用回形针来管理和访问文件,您将希望将它们存储在 s3 中,以便回形针可以访问它们。为此,请使用 Paperclip::Interpolations.interpolate 方法。就像:
这是不言而喻的——确保你在临时环境中测试它!
祝你好运。
Hi I would right a simple rake task to accomplish this. It would look like something like this (not tested):
A few notes:
if you are using paperclip to manage and access the files you will want to store them in s3 so paperclip can access them. To do that use
Paperclip::Interpolations.interpolate
method. like:And this goes without saying -- make sure you test this in a staging environment!
Good luck.