上传图像到文件系统的版本控制 [英] Version control of uploaded images to file system

查看:113
本文介绍了上传图像到文件系统的版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读在数据库中存储图像 - 是或否?我认为文件系统是存储图像的正确位置。但我想知道你如何处理不同环境(dev / stage / prod)中上传图像的备份/版本控制以及网络负载平衡?

After reading Storing Images in DB - Yea or Nay? I think that the file system is the right place for storing images. But I would like to know how you handle backup/version control of uploaded images in your different environments (dev/stage/prod) and for network load balancing?

这些问题使用数据库时非常容易处理,例如从生产环境进行备份并在开发环境中恢复数据库。

These problems is pretty easy to handle when working with a database e.g. to make a backup from the production environment and restore the DB in the development environment.

您如何使用git来处理上传文件的版本控制,例如?

What do you think of using for example git to handle version control of uploaded files e.g?

生产环境:


  • 将图像上传到共享文件夹中网络服务器。

  • 元数据存储在数据库中

  • 图像自动添加到git存储库

开发人员在工作:


  • 检查源代码。

  • 运行脚本以恢复数据库。

  • 运行脚本以获取最新图像。

我认为上面的解决方案对开发人员来说非常顺利,图像将受版本控制,环境可以相互隔离。

I think the solution above is pretty smooth for the developer, the images will be under version control and the environments can be isolated from each other.

推荐答案

对我们来说,版本控制并不像发行版那么重要。通过Web管理员添加元数据,并将图像放在管理服务器上。 Rsync脚本将这些脚本推送到为prod图像提供服务的集群。对于dev / test,我们只是从prod主服务器rsync回到开发服务器。

For us, the version control isn't as important as the distribution. Meta data is added via the web admin and the images are dropped on the admin server. Rsync scripts push those out to the cluster that serves prod images. For dev/test, we just rsync from prod master server back to the dev server.

rsync非常适合负载平衡和分发。如果您使用git作为管理员/主服务器,那么您有一个非常好的解决方案。

The rsync is great for load balancing and distribution. If you sub in git for the admin/master server, you have a pretty good solution.

如果您对备份保持正常,那么在备份时保留文件历史记录(与每个版本的版本控制相反),然后对此进行一些调整可能会有所帮助:
使用rsync自动执行快照式备份

If you're OK with backup that preserves file history at the time of backup (as opposed to version control with every revision), then some adaption of this may help: Automated Snapshot-style backups with rsync.

这篇关于上传图像到文件系统的版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆