简体   繁体   English

我的Web服务器的版本控制

[英]Version control for my web server

I'm building a Web2Py-based web application and am doing most of my development right on a remote EC2 development server. 我正在构建一个基于Web2Py的Web应用程序,并且正在远程EC2开发服务器上进行大部分开发。 I would like to version control the entire system, including all python modules, web pages, and Apache config files. 我想版本控制整个系统,包括所有python模块,网页和Apache配置文件。 The files are obviously scattered across my Linux box, but I would like to be able to checkout/commit using a single command. 这些文件显然分散在我的Linux机器上,但我希望能够使用单个命令检出/提交。 I'm new to SVN on the command line- Is there a way to do this using a some sort of virtual directory with sym links? 我在命令行上对SVN不熟悉 - 有没有办法使用带有sym链接的某种虚拟目录来执行此操作?

Any thoughts are welcome. 欢迎任何想法。 Thanks. 谢谢。

If you've already started developing, the easy route would be to organize an SVN tree and then sym link the modules and httpd.conf. 如果您已经开始开发,那么简单的方法就是组织一个SVN树,然后sym链接模块和httpd.conf。 You could also make use of virtualenv and only check in the virtualenv config. 你也可以使用virtualenv并只检查virtualenv配置。

For a single developer, Git ( book ) is better suited for convenience. 对于单个开发人员, Git )更适合方便。 You can "commit" locally very easily, and push changes to a remote server, which could be your EC2 instance, it just needs an SSH connection to work. 您可以非常轻松地在本地“提交”,并将更改推送到远程服务器(可能是您的EC2实例),它只需要SSH连接即可工作。 But I would probably go with a hosted solution like GitHub or any other hosting solution that has SSH and the ability to install Git. 但我可能会使用像GitHub这样的托管解决方案或任何其他具有SSH和安装Git的托管解决方案。 I use GitHub for my public projects and DreamHost for my "private" projects. 我将GitHub用于我的公共项目 ,将DreamHost用于我的“私人”项目。

You would put all your files in one directory structure and then deploy them using some automated process. 您可以将所有文件放在一个目录结构中,然后使用一些自动化过程进行部署 For Python I would suggest something Python standard like distutils or even easy_install . 对于Python,我会建议像distutils甚至easy_install这样的Python标准。 For more complicated environments, you want to consider something like Chef , which will be extremely important if you start scaling out to more than a single EC2 instance. 对于更复杂的环境,您需要考虑像Chef这样的东西,如果您开始扩展到多个EC2实例,这将非常重要。 Even without the multiple server needs something like Chef for repeatable automated deployments is what an efficient developer does. 即使没有多服务器需求,像Chef这样的可重复自动化部署也是一个高效的开发人员所做的事情。

Just don't get tempted to write a "quick and dirty" shell script to do deployments, they are brittle and very un-maintainable. 只是不要试图写一个“快速和脏”的shell脚本来进行部署,它们很脆弱且非常难以维护。 If you don't like Chef, research alternatives and take the time to learn one. 如果你不喜欢厨师,研究替代品并花时间学习一个。 The time spent will be made up for down the line. 花费的时间将用于弥补。

Like fuzzy lolipop I would highly suggest git as well. 像模糊lolipop我也强烈建议git。 Especially because of it's low taint footprint. 特别是因为它的低污染足迹。 SVN leaves .svn folders in each subfolder of your repo, this can get costly if your automated scripts copy/paste them around. SVN会在您的repo的每个子文件夹中留下.svn文件夹,如果您的自动脚本复制/粘贴它们,这可能会花费很多。

What i suggest is you have a central git repo and a publish script that checks out a version, then copies the files to their locations. 我建议你有一个中央git仓库和一个检出版本的发布脚本,然后将文件复制到他们的位置。

Alternatively 另外

You could segment your repo out a bit and use symbolic links to wire up your website, however it's probably poor practice to point your production source into a repo, i'd still leverage the replication script method listed above. 您可以将您的仓库分段并使用符号链接来连接您的网站,但是将生产源指向仓库可能是不好的做法,我仍然会利用上面列出的复制脚本方法。

I personally use git for managing websites and config files. 我个人使用git来管理网站和配置文件。

I'm not sure if I would mix the apache configs and website in the same repo, but if I were to take that approach I'd do it in separate branches and set the remote appropriately. 我不确定我是否会在相同的仓库中混合apache配置和网站,但如果我采取这种方法,我会在不同的分支机构中进行,并适当地设置遥控器。

Depending on what OS you're running, etckeeper is nice and integrates well with debian/apt based systems. 根据你运行的操作系统,etckeeper很好,并且与基于debian / apt的系统很好地集成。

Ever think of ghosting the VM to S3? 有没有想过将虚拟机重命名为S3? It's almost like the cloud version of "poor mans version control". 它几乎就像是“穷人版本控制”的云版本。

I have done the symlinking and although it is a good solution it is not the easiest to work with at first. 我已经完成了符号链接,虽然它是一个很好的解决方案但它最初并不是最容易使用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM