建立多个开发环境

时间:2022-03-27 12:17:53

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:

我是一个开发典型Web项目(Django + PostgresSQL)的独立开发人员,使用Eclipse作为我的IDE和Subversion进行源代码控制。到目前为止,我一直在研究我自己设置的单个开发机器。最近,我被要求在客户现场做一些工作,并且有一些时候在家中访问该网站是有用的。我正在考虑设置它的最佳方法是什么。不幸的是,由于各种原因,笔记本电脑不是一个可行的解决方案,所以我想到的解决方案是:

  1. Installing all the necessary development tools on each machine (PostgresSQL, Eclipse, Django, Python + librariries etc.) and keeping the code in sync using SVN.
  2. 在每台机器上安装所有必要的开发工具(PostgresSQL,Eclipse,Django,Python + librariries等),并使用SVN保持代码同步。

  3. Setting some kind of VNC access on my development machine and accessing it remotely to do work.
  4. 在我的开发机器上设置某种VNC访问并远程访问它以进行工作。

  5. Creating a Virtual machine and copying the image between all the machines using a pen drive.
  6. 创建虚拟机并使用笔式驱动器在所有计算机之间复制映像。

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.

#1的优点是快速的本地开发,但是我必须在每台机器上设置所有工具并处理它们的配置并保持所有内容同步。另外,要在机器之间共享代码,即使它没有“准备好”,我也必须将其检入SVN。解决方案#2解决了这个问题,但代价是较慢的UI体验。最后,#3似乎是一个不错的解决方案,但我不确定我是否真的能够在笔式驱动器上安装虚拟映像,而且我不确定性能。

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. :)

我想这并不是一个“正确”的答案,但是我把它扔出去得到那些比我做得更久的人的想法和建议。 :)

5 个解决方案

#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.

我认为1号选项仍然是最好的。我假设你家里只有一台电脑,你可以在那台电脑上工作,所以设置应该只是一次性的事情。

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.

你是对的,设置时间相当繁琐,但它实际上弥补了使用像VNC这样的远程工作的慢UI。提交可能不起作用的代码的问题是有效的,但是如果您对此感到担心,只需注释掉损坏的代码并确保编译最新版本。

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.

无论如何,选项1是我的偏好,我希望它有所帮助。

#2


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.

如果机器有e-sata端口,这可能就是你要找的东西。为什么不组合使用一个和三个,创建一个基本vm一次将它部署到所有机器并使用svn或其他同步工具保持代码同步?如果你不想经常检查和退出源代码控制,只要你不介意让第三方能够查看你的代码虽然他们可能赢了不用费心。另一个选择是创建一个“工作”分支,你总是检查进出,只有当代码足够稳定并稍微完成时才将代码移动到主干。

#3


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.

使用版本控制。如果您担心签入“不完整”代码,请使用分支(分支开发)或标签(标记“已完成”代码)。承诺“进行中”工作有其优点(良好的撤销,帮助您编写好的更改日志等)。此外,记录您的“设置”过程,以便更容易重现也很好。

#4


Also, to share code between the machines, I'd have to check it into SVN even if it's not "ready."

另外,要在机器之间共享代码,即使它没有“准备好”,我也必须将其检入SVN。

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.

Git非常明确地解决了这个问题。对于离线开发,你应该试试Git。它使管理离线存储库变得非常简单。而且由于其分布式架构在环境之间移动时提供了一些便利。它旨在使工作流程经常检查早期检查。我想你会发现它提供了SVN没有提供的东西。

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.

例如,您可以为不同的环境保留不同的存储库,并轻松地合并它们之间的更改。这样,您就可以将存储库与VM映像捆绑在一起。它们可以发生巨大的分歧,但仍然很容易合并回来。

The merging is what makes Git such a dream to use.

合并是让Git成为这样一个梦想的原因。

Watch these two presentations for a nice overview.

观看这两个演示文稿以获得精彩的概述。

Linus Torvalds on Git (more on the design philosophy of Git)

关于Git的Linus Torvalds(更多关于Git的设计理念)

http://www.youtube.com/watch?v=4XpnKHJAok8

Randall Schwartz presentation (more practical overview)

Randall Schwartz演讲(更实用的概述)

http://www.youtube.com/watch?v=8dhZ9BXQgc4

#5


Running a VM from a pen-drive (even a fast one, which most aren't!) will suck big time.

从笔式驱动器运行VM(即使是快速的,也是大多数都没有!)将耗费大量时间。

You could copy it locally or use a USB HDD though, or even a solution like Live Mesh to sync it.

你可以在本地复制或使用USB硬盘,甚至像Live Mesh这样的解决方案来同步它。

#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.

我认为1号选项仍然是最好的。我假设你家里只有一台电脑,你可以在那台电脑上工作,所以设置应该只是一次性的事情。

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.

你是对的,设置时间相当繁琐,但它实际上弥补了使用像VNC这样的远程工作的慢UI。提交可能不起作用的代码的问题是有效的,但是如果您对此感到担心,只需注释掉损坏的代码并确保编译最新版本。

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.

无论如何,选项1是我的偏好,我希望它有所帮助。

#2


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.

如果机器有e-sata端口,这可能就是你要找的东西。为什么不组合使用一个和三个,创建一个基本vm一次将它部署到所有机器并使用svn或其他同步工具保持代码同步?如果你不想经常检查和退出源代码控制,只要你不介意让第三方能够查看你的代码虽然他们可能赢了不用费心。另一个选择是创建一个“工作”分支,你总是检查进出,只有当代码足够稳定并稍微完成时才将代码移动到主干。

#3


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.

使用版本控制。如果您担心签入“不完整”代码,请使用分支(分支开发)或标签(标记“已完成”代码)。承诺“进行中”工作有其优点(良好的撤销,帮助您编写好的更改日志等)。此外,记录您的“设置”过程,以便更容易重现也很好。

#4


Also, to share code between the machines, I'd have to check it into SVN even if it's not "ready."

另外,要在机器之间共享代码,即使它没有“准备好”,我也必须将其检入SVN。

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.

Git非常明确地解决了这个问题。对于离线开发,你应该试试Git。它使管理离线存储库变得非常简单。而且由于其分布式架构在环境之间移动时提供了一些便利。它旨在使工作流程经常检查早期检查。我想你会发现它提供了SVN没有提供的东西。

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.

例如,您可以为不同的环境保留不同的存储库,并轻松地合并它们之间的更改。这样,您就可以将存储库与VM映像捆绑在一起。它们可以发生巨大的分歧,但仍然很容易合并回来。

The merging is what makes Git such a dream to use.

合并是让Git成为这样一个梦想的原因。

Watch these two presentations for a nice overview.

观看这两个演示文稿以获得精彩的概述。

Linus Torvalds on Git (more on the design philosophy of Git)

关于Git的Linus Torvalds(更多关于Git的设计理念)

http://www.youtube.com/watch?v=4XpnKHJAok8

Randall Schwartz presentation (more practical overview)

Randall Schwartz演讲(更实用的概述)

http://www.youtube.com/watch?v=8dhZ9BXQgc4

#5


Running a VM from a pen-drive (even a fast one, which most aren't!) will suck big time.

从笔式驱动器运行VM(即使是快速的,也是大多数都没有!)将耗费大量时间。

You could copy it locally or use a USB HDD though, or even a solution like Live Mesh to sync it.

你可以在本地复制或使用USB硬盘,甚至像Live Mesh这样的解决方案来同步它。