我想将二进制文件(媒体)与我的代码存储库分开。值得吗?如果是这样,我该如何管理它们?
我们的存储库变得越来越庞大,因为我们拥有大量媒体(数百个 1 MB jpeg、数百个 PDF 等)。
因此,对于某些存储库,我们检查这些存储库的开发人员必须等待异常长的时间。
以前有其他人遇到过这种困境吗?我是否以正确的方式将代码与媒体分开?以下是我遇到的一些问题/担忧:
- 如果我将它们迁移到媒体服务器中,那么我担心开发人员使用起来可能会很痛苦。如果两台服务器同时进行编程逻辑和媒体更新,他/她现在必须更新两台服务器,而不是对一台服务器进行更新。
- 如果我将它们迁移到媒体服务器中,我仍然需要对媒体进行修订控制,不是吗?因此,开发人员必须提交代码更新并提交媒体更新。
- 开发者如何在本地进行测试?我可以让我的网站使用绝对网址,例如
src="http://media.domain.com/site/blah/image.gif"
,但这在本地不起作用。我认为我必须更改我的网站模板来决定它是本地/开发还是生产,并基于此更改 BASE_URL。 - 值得这么费尽心思去做这件事吗?我们处理大约 100-150 个站点,而不是十几个左右的主要站点,因此我们有大约 100-150 个存储库。我们没有时间或资源来改变现有的网站,我们只能在全新的网站上实现这一点。
- 我仍然需要在代码存储库中保留生成媒体( pdf 生成器)的脚本和生成的媒体,对吗?将所有这些 pdf 生成器更新为将文件 POST 到外部媒体服务器将是一个巨大的痛苦,而且考虑到缓存也是一个额外的痛苦。
如果您能深入了解有关管理媒体和代码的问题,我将不胜感激。
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:
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,是的,将媒体和生成的内容(如生成的 pdf)与源代码控制分开是一个好主意。
这是因为:
也就是说,这种类型的任何转换实施起来成本高昂。
您需要将发布管理过程(在正确的位置生成正确的文件)与开发过程(从一两个参考资料获取正确的材料来开发/更新您的项目)分开。
二进制文件通常分为两类:
它们最好保存在工件存储库中(例如 Nexus),位于与 VCS 生成的二进制文件中用于文本源的标签相匹配的标签
理想情况下,它们不应保存在任何存储库中,而仅在发布管理阶段生成以便部署。
First, yes, separating media and generated content (like the generated pdf) from the source control is a good idea.
That is because of:
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:
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
ideally, they shouldn't be kept in any repository, but only generated during the release management phase in order to be deployed.