设置多个开发环境
我是一名独立开发人员,正在开发一个典型的 Web 项目(Django + PostgresSQL),使用 Eclipse 作为我的 IDE,并使用 Subversion 进行源代码控制。 到目前为止,我一直在开发一台我自己设置的开发机器。 最近,我被要求在客户现场做一些工作,也有几次在家里访问该网站会很有用。 我正在考虑最好的设置方法是什么。 不幸的是,由于各种原因,笔记本电脑不是一个可行的解决方案,因此我想到的解决方案是:
- 在每台计算机上安装所有必要的开发工具(PostgresSQL、Eclipse、Django、Python + 库等)并保持代码同步使用SVN。
- 在我的开发计算机上设置某种 VNC 访问权限并远程访问它来完成工作。
- 创建虚拟机并使用笔式驱动器在所有计算机之间复制映像。
#1 的优点是快速本地开发,但随后我必须在每台计算机上设置所有工具并处理它们的配置并保持所有内容同步。 另外,为了在机器之间共享代码,即使它还没有“准备好”,我也必须将其签入 SVN。 解决方案#2 解决了这个问题,但代价是 UI 体验变慢。 最后,#3 似乎是一个不错的解决方案,但我不确定是否真的可以在笔式驱动器上安装虚拟映像,并且我不确定性能。
我想确实没有一个“正确”的答案,但我把这个扔掉是为了从那些比我做这件事更久的人那里得到想法和建议。 :)
I'm a solo developer working on a typical web project (Django + PostgresSQL) using Eclipse as my IDE and Subversion for source control. So far I've been working on a single development machine that I have setup myself. Recently, I've been asked to do some work at the customer site and there have also been a few occasions when it would have been useful to have access to the site at home. I'm thinking about what the best way to set this up is. Unfortunately, for various reasons a laptop is not a viable solution, so the solutions I am thinking of are:
- Installing all the necessary development tools on each machine (PostgresSQL, Eclipse, Django, Python + librariries etc.) and keeping the code in sync using SVN.
- Setting some kind of VNC access on my development machine and accessing it remotely to do work.
- Creating a Virtual machine and copying the image between all the machines using a pen drive.
The advantage of #1 is fast local development, but then I have to setup all the tools on each machine and deal with their configurations and keeping everything in sync. Also, to share code between the machines, I'd have to check it into SVN even if it's not "ready." Solution #2 solves this problem, but at the expense of slower UI experience. Finally, #3 seems like a nice solution, but I'm not sure if I can really fit a virtual image on a pen drive and I'm not sure about the performance.
I guess there's not really a "correct" answer, but I'm throwing this out to get ideas and suggestions from people who have been doing this longer than me. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我想说选项 1 仍然是最好的。 我假设您家里只有一台计算机,并且您可以使用该计算机进行工作,因此设置应该只是一次性的事情。
虽然你是对的,设置时间相当繁琐,但它实际上弥补了使用 VNC 等远程工作的缓慢 UI。 您提交可能无法工作的代码的问题是一个有效的问题,但是如果您担心这一点,只需注释掉损坏的代码并确保您的最新版本可以编译。
通过存储库进行工作是最有效的方法,尤其是当您正在处理一个相当大的项目时。 遗憾的是您没有笔记本电脑,在笔记本电脑上设置所有工具可以使您在任何地方编码/工作(前提是您有互联网连接)特别方便。
无论如何,选项1是我的偏好,我希望它有帮助。
I'd say option number 1 is still the best. I'd assume you only have one computer at home and you can work off of that one, so the setup should hopefully just be a one time thing.
You're right though, the setup time is quite tedious, however it does in fact make up for the slow UI of using something like VNC to work remotely. Your problem with committing code that may not work is a valid one, however if you're concerned about that, simply comment out the broken code and ensure that your latest version compiles.
Working through a repository is the most efficient method, especially if you're working on a fairly large project. It's too bad you don't have a laptop, setting up all the tools on a laptop makes coding/working from anywhere (provided you have an internet connection) especially convenient.
Anyways, option 1 is my preference, I hope it helps.
如果计算机有 e-sata 端口这可能就是您正在寻找的。 为什么不将一和三结合起来,创建一个基础虚拟机,将其立即部署到所有计算机上,并使用 svn 或其他同步工具保持代码同步? 如果您不想经常签入和签出源代码管理,类似 drop box 之类的东西可以让您只要您不介意第三方能够查看您的代码,就保持工作目录同步,尽管他们可能不会打扰。 另一种选择是创建一个“工作”分支,您总是签入和签出该分支,并且仅在代码足够稳定且已完成时才将代码移至主干。
If the machines have e-sata ports this might be what you’re looking for. Why not do a combination of one and three, create a base vm deploy it to all your machines at once and keep the code in sync using svn or some other synchronization tool? If you don't want to constantly check in and out of source control something like drop box would allow you to keep working directories in sync as long as you don't mind having a third party be able to view your code although they probably won't bother. Another option would to create a "working" branch that you always check in and out of, and only move code to the trunk when it's stable enough and somewhat finished.
使用版本控制。 如果您担心签入“不完整”代码,请使用分支(开发分支)或标签(标记“已完成”代码)。 提交“正在进行的”工作有其优点(良好的撤消,帮助您编写良好的变更日志等)。 另外,记录您的“设置”过程,以便更容易重现也很好。
Use version control. If you are worried about checking in "incomplete" code, use branches (branch for development) or tags (tag "completed" code). Committing "in progress" work has its advantages (good undo, helps you write good changelogs, etc.). Also, documenting your "setup" process so it's easier to reproduce is good too.
Git 非常明确地解决了这个问题。 就离线开发而言,您应该尝试一下 Git。 它使管理离线存储库变得非常简单。 而且由于其分布式架构在环境之间移动时提供了一些便利。 它旨在使工作流程签入经常提前签入。 我想你会发现它提供了 SVN 所没有的东西。
例如,您可以为不同的环境保留不同的存储库,并轻松合并它们之间的更改。 这样您就可以将存储库与虚拟机映像捆绑在一起。 它们可能会发生巨大的分歧,但仍然很容易重新融合在一起。
正是合并让 Git 成为了一个理想的使用工具。
观看这两个演示以获得一个很好的概述。
Linus Torvalds on Git(更多关于 Git 的设计理念)
http://www.youtube.com /watch?v=4XpnKHJAok8
Randall Schwartz 演示(更实用的概述)
http:// www.youtube.com/watch?v=8dhZ9BXQgc4
Git very much solves this problem explicitly. As far as offline development goes you should give Git a try. It makes managing offline repositories really simple. And because of its distributed architecture offers a handful of conveniences when moving between environments. It was designed to make the workflow checkin early checkin often. I think you will find it offers things that SVN doesn't.
For example you can keep different repositories around for different environments and easily merge changes between them. That way you can have repositories bundled with your VM images. And they can diverge dramatically but still be easily to merge back together.
The merging is what makes Git such a dream to use.
Watch these two presentations for a nice overview.
Linus Torvalds on Git (more on the design philosophy of Git)
http://www.youtube.com/watch?v=4XpnKHJAok8
Randall Schwartz presentation (more practical overview)
http://www.youtube.com/watch?v=8dhZ9BXQgc4
从笔式驱动器运行虚拟机(即使速度很快,但大多数都不是!)会耗费大量时间。
您可以在本地复制它或使用 USB HDD,甚至使用 Live Mesh 等解决方案来同步它。
Running a VM from a pen-drive (even a fast one, which most aren't!) will suck big time.
You could copy it locally or use a USB HDD though, or even a solution like Live Mesh to sync it.