简体   繁体   English

将照片复制到暂存S3(使用导轨和回形针)

[英]Copy Photos to Staging S3 (using rails and paperclip)

I've got a website built on rails that uses paperclip to persist photos to S3. 我有一个建立在rails上的网站,它使用回形针将照片保存到S3。 This works great. 这非常有效。 I'm using Heroku, so i've also got a staging server set up for future changes and user testing. 我正在使用Heroku,所以我还有一个临时服务器,用于未来的更改和用户测试。 Following the 12factor Dev/Prod parity http://www.12factor.net/dev-prod-parity in mind I've been using PGbackups to keep the same data in staging as in production. 遵循12因子Dev / Prod平价http://www.12factor.net/dev-prod-Parity考虑到我一直在使用PGbackups来保存与生产中相同的数据。 However I can't find a good way to sync my production S3 bucket to staging. 但是,我找不到将生产S3存储桶同步到暂存的好方法。

I don't want to use my production S3 bucket in staging for fear of accidentally deleting production photos. 我不想在分段中使用我的生产S3存储桶,以免意外删除生产照片。 Having missing photos show up durring user testing is distracting and unacceptable. 缺少照片显示用户测试是分散注意力和不可接受的。 Is there an easy solution to push the same photo to two buckets while saving, or to set staging to be a "slave" to the production bucket in S3? 是否有一个简单的解决方案可以在保存时将相同的照片推送到两个存储桶,或者将阶段设置为S3中生产存储桶的“从属”?

You can run a script to copy your production bucket to staging whevener you synchronize your database: Googling a bit I've found this one . 您可以运行脚本将生产存储桶复制到您同步数据库的暂存工具:谷歌搜索我找到了这个 You can wrap it in a rake task and run it from your staging app. 您可以将其包装在rake任务中并从您的暂存应用程序中运行它。

The most recent best answer is on a similar question: 最近的最佳答案是关于类似的问题:

Best way to move files between S3 buckets? 在S3存储桶之间移动文件的最佳方法?

Scroll down until you see the answer by alberge 向下滚动,直到你看到alberge的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM