Richard,我们不想在暂存或生产服务器附近放置CruiseControl。
对于LAN(即内部生产服务器),我们手动触发Production Deploy CC任务,停止IIS(站点和应用程序池),复制新站点并重启IIS相关内容。
对于DMZ部署(即互联网内容,不存在AD身份验证的连接),我们尽可能地在内部完成构建,并将结果压缩成ZIP文件,包括执行“最终步骤”的NAnt脚本。有一个内部的CC任务会执行所有这些操作,并将ZIP文件通过FTP传输到目标服务器。要完成该过程需要手动干预:远程登录到框中,解压缩然后运行NAnt以“完成”部署(停止/复制/启动/其他操作)。
我不确定GAC如何控制,但似乎可以通过.VBS文件控制IIS。
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:\\devserver.local\root\WebAdministration")
' Specify the application pool.
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='ProjectName'")
' Stop the application pool.
oAppPool.Stop
' now website; get the application website
Set objWebSite = GetObject("IIS://localhost/W3SVC/7") ' id of web site
' get the app pool object for the websites app pool id
Set objAppPool = GetObject("IIS://localhost/W3SVC/AppPools/ProjectName")
'stop the site
objWebSite.Stop()
' stop the app pool
objAppPool.Stop()
我们使用NAnt通过psexec.exe
来提供服务。
<property name="Remote.Executor" value="${ToolsDir}\PSTools\psexec.exe" overwrite="false" />
<target name="installWindowsServiceRemote">
<echo message="${Service.Install.Action}ing ${Service.Name} on ${Deploy.TargetServer}..." />
<exec program="${Remote.Executor}">
<arg line="\\${Deploy.TargetServer} ${Deploy.TargetFolder}\${Service.Name} /${Service.Install.Action}" />
</exec>
</target>
无论如何,可能有几十种方法来处理这个问题——对于我们来说,需要内部自动化/外部手动步骤的设置是有效的。