我想从代码存储库中分离二进制文件(媒体)。这值得么?如果是这样,我该如何管理它们? [英] I want to separate binary files (media) from my code repositories. Is it worth it? If so, how can I manage them?

查看:61
本文介绍了我想从代码存储库中分离二进制文件(媒体)。这值得么?如果是这样,我该如何管理它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的存储库正在变得越来越庞大,因为我们拥有大量的媒体(数百个1 MB jpeg,数百个PDF等)。

Our repositories are getting huge because there's tons of media we have ( hundreds of 1 MB jpegs, hundreds of PDFs, etc ).

我们的开发人员会检查这些内容因此,对于某些存储库,存储库必须异常地等待很长时间。

Our developers who check out these repositories have to wait an abnormally long time because of this for certain repos.

其他人以前有这个难题吗?我是否通过将代码与媒体分开来以正确的方式进行操作?以下是我遇到的一些问题/忧虑:

Has anyone else had this dilemma before? Am I going about it the right way by separating code from media? Here are some issues/worries I had:


  • 如果我将它们迁移到媒体服务器中,恐怕这样做可能会很痛苦开发人员使用。如果他/她同时执行编程逻辑和媒体更新,则必须更新两台服务器,而不是对一台服务器进行更新。

  • 如果我将它们迁移到媒体服务器中,我会仍然需要修订控制媒体,不是吗?因此,开发人员必须提交代码更新提交媒体更新。

  • 开发人员将如何在本地进行测试?我可以使我的网站使用绝对URL,例如 src = http://media.domain.com/site/blah/image.gif ,但这不会在本地工作。我假设我必须更改网站模板以决定它是本地的/开发的还是生产的,然后根据该模板更改BASE_URL。

  • 这样做值得所有麻烦吗?我们处理大约100-150个站点,而不是十几个主要站点,因此我们拥有大约100-150个存储库。我们将没有时间或资源来更改现有站点,我们只能在全新的站点上实现。

  • 我仍然必须保留用于生成媒体的脚本(pdf生成器)以及代码存储库中生成的媒体,对不对?将所有这些pdf生成器更新为POST文件到外部媒体服务器将是一个巨大的痛苦,并且考虑到缓存,这将是一个额外的痛苦。

  • If I migrate these into a media server then I'm afraid it might be a pain for the developer to use. Instead of making updates to one server he/she will have to now update two servers if they are doing both programming logic and media updates.
  • If I migrate these into a media server, I'll still have to revision control the media, no? So the developer would have to commit code updates and commit media updates.
  • How would the developer test locally? I could make my site use absolute urls, eg src="http://media.domain.com/site/blah/image.gif", but this wouldn't work locally. I assume I'd have to change my site templating to decide whether it's local/development or production and based on that, change the BASE_URL.
  • Is it worth all the trouble to do this? We deal with about 100-150 sites, not a dozen or so major sites and so we have around 100-150 repositories. We won't have the time or resources to change existing sites, and we can only implement this on brand new sites.
  • I would still have to keep scripts that generate media ( pdf generators ) and the generated media on the code repository, right? It would be a huge pain to update all those pdf generators to POST files to external media servers, and an extra pain taking caching into account.

对于任何有关管理媒体和代码的问题的见解,我将不胜感激。

I'd appreciate any insight into the questions I have regarding managing media and code.

推荐答案

首先,是的,分离媒体并从源代码管理生成的内容(如生成的pdf)是个好主意。

这是因为:

First, yes, separating media and generated content (like the generated pdf) from the source control is a good idea.
That is because of:


  • 磁盘空间和签出时间(如您在问题中所述)

  • 此类文件实际使用的CVS功能缺失(无差异,无合并,仅标签和分支)

也就是说,这种过渡成本很高。

您需要将在开发过程中发布管理过程(在正确的位置生成正确的文件)(从一到两个参照物获得正确的材料来开发/更新项目)

That said, any transition of this kind is costly to put in place.
You need to separate the release management process (generate the right files at the right places) from the development process (getting from one or two referential the right material to develop/update your projects)

二进制文件通常分为两类:

Binaries fall generally into two categories:


  • 非生成二进制文件

    最好将它们保存在工件存储库中(例如 Nexus ),在与用于VCS中文本源的标签相匹配的标签下

  • 生成的二进制文件(如您的pdf文件):

    ,它们不应保留在任何存储库中,而应仅在发布管理阶段生成以便部署。

  • non-generated binaries:
    They are best kept in an artifact repository (like Nexus for instance), under a label that would match the label used for the text sources in a VCS
  • generated binaries (like your pdf):
    ideally, they shouldn't be kept in any repository, but only generated during the release management phase in order to be deployed.

这篇关于我想从代码存储库中分离二进制文件(媒体)。这值得么?如果是这样,我该如何管理它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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