使用的Robocopy部署网站 [英] Using Robocopy to deploy sites

查看:184
本文介绍了使用的Robocopy部署网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够快速部署更新一个网站,是相当繁忙。对于规模较小的网站,我只想FTP通过旧的新的文件。这一次,但是,有几个大的DLL定期得到更新,虽然它们复制的有效部位是(加有万一的东西使他们的备份的麻烦不顺心的。

I want to be able to quickly deploy updates to a site that is fairly busy. For smaller sites I would just FTP the new files over the old ones. This one, however, has a few large dll's that regularly get updated and while they are copying the site is effectively down (plus there is the hassle of making backups of them in case something goes wrong.

我的计划是使用TortoiseHg与服务器上的一个临时拷贝过来的FTP(使用NetDrive的或类似的东西)来同步。那么我可以检查所有的顺畅,一旦完成,我想运行一个.bat文件(或别的东西),将创建活动站点的备份(preferably只有那些即将发生变化的文件,但是这并不重要),然后到活动网站新更改的文件复制。

My plan is to use TortoiseHg to synchronise with a staging copy on the server over FTP (using netdrive or something similar). I can then check all is running smoothly and once that is complete I would like to run a .bat file (or something else) that will create a backup of the live site (preferably only the files that are about to change, but that is not critical) and then copy the newly changed files over to the live site.

如果可能,我也想拥有副本忽略特定目录(如用户上传),因此它不会覆盖直播网站上这些文件?

If possible I also want to have the copy ignore certain directories (like user uploads) so that it won't overwrite those files on the live site?

我听说ROBOCOPY是要走的路,但我不知道从哪里开始。我需要调用2命令(1初始备份和一个副本)?有什么办法恢复直播网站,它是previous国家应该什么错呢?

I've heard RoboCopy is the way to go but I'm not sure of where to start. Would I need to call 2 commands (1 for the initial backup and one for the copy)? Is there any way to restore the live site to it's previous state should something go wrong?

该网站是在ASP.NET中,并会被复制到Windows 2003服务器。

The site is in ASP.NET and would be copied to Windows 2003 server.

编辑:它变得有点棘手时的web.config项目已经改变,需要进行合并,以使临时服务器设置(的AppSettings,连接字符串,等等)没有得到部署到直播现场。这是如何得到处理?

It gets a little tricky when web.config items have changed and need to be merged so that the staging servers settings (appsettings, connection strings, etc) don't get deployed to the live site. How does that get handled?

推荐答案

我们使用什么是以下


  • 先建的网站在cruisecontrol.net打造的二进制文件的MSBuild

  • 存档时间戳的文件夹下当前部署的文件,以避免出现问题时丢失数据。

  • first build the website with msbuild in cruisecontrol.net to build the binaries
  • archive the currently deployed files under a timestamped folder to avoid losing data in case of a problem

C:\\ DevTools \\的Robocopy \\ robocopy.exe / R:1 / W:10 / MIRD:\\网页\\文件 \"D:\\Webarchive\\ArchivedFiles\\Documents.%date:~0,-8%.%date:~3,-5%.%date:~6%.%time:~0,-9%.%time:~3,-6%.%time:~6,-3%\" / XF * .scc

停止网站

除了由我们存档的文件复制一切部署网站(/ XD是exclude目录)

deploy the website by copying everything except the files we archived (/XD is eXclude Directory)

C:\\ DevTools \\的Robocopy \\ robocopy.exe / R:1 / W:10 / MIRC:\\ dev的\\网站D:\\网/ XF * .scc / XD D:\\网页\\文件

复制和重命名(带XCOPY,这一次)用正确的信息将release.config到d:\\网站\\ web.config文件(实际上,这就是我们用来做什么,现在我们有一个自制软件转换引擎改变对飞开发的web.config)的部分。

copy and rename (with xcopy, this time) a release.config with correct information to d:\Website\web.config (in fact, that's what we used to do, now we have a homebrew transformation engine to change parts of the dev web.config on the fly).

在你的情况,你就必须添加/ XD标志你想忽略,如用户上传的任何目录。除非生产web.config文件是复杂的,我真的建议简单地复制你保持作为项目的一部分,并排着在web.config

In your case, you'll have to add the /XD flags for any directory you want to ignore, such as the users' upload. And unless the production web.config file is complicated, i'd really recommend simply copying a release.config that you maintain as a part of the project, side by side with the web.config

这篇关于使用的Robocopy部署网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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