2

我正在使用awsdeploy部署彈性beanstalk ASP.NET MVC應用程序。該應用程序需要Crystal Reports,只能通過運行.msi安裝程序(CRRuntime_64bit_13_0_6.msi)進行安裝。awsdeploy - > msdeploy - > runCommand timeout

運行作爲部署的一部分,我已經添加了一個自定義的目標,像這樣安裝程序:

<!--install msi--> 
    <Target Name="InstallCrystalReports" AfterTargets="AddIisSettingAndFileContentsToSourceManifest"> 
    <Message Text="Install Crystal Reports msi" /> 
    <ItemGroup> 
     <MsDeploySourceManifest Include="runCommand"> 
     <Path>c:\mypath\installCrystalReports.cmd</Path> 
     <waitAttempts>20</waitAttempts> 
     <waitInterval>300000</waitInterval> 
     <dontUseCommandExe>false</dontUseCommandExe> 
     <AdditionalProviderSettings>waitAttempts;waitInterval;dontUseCommandExe</AdditionalProviderSettings> 
     </MsDeploySourceManifest> 
    </ItemGroup> 
    </Target> 

的安裝可能需要大約一分鐘,我可以通過安裝人員看到,查看創建的日誌文件它已經開始OK。然而,runCommand只會讓它運行一個5秒鐘的最大值,然後終止一個錯誤。更改waitAttempts和waitInterval似乎沒有影響。

下面摘錄自「C:\ Program Files \ Amazon \ ElasticBeanstalk \ logs \ AWSDeployment.log」,其中顯示了awsdeploy/msdeploy如何過早終止安裝。

2013-08-19 12:42:11,428 INFO 5 DeploymentLog - C:\mypath>msiexec /i CRRuntime_64bit_13_0_6.msi /quiet /norestart /l C:\mypath\CRRuntime_64bit_13_0_6.txt 

2013-08-19 12:42:12,426 WARN 1 AWSBeanstalkCfnDeploy.DeploymentUtils - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 1 of 5). 
2013-08-19 12:42:12,426 WARN 1 DeploymentLog - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 1 of 5). 
2013-08-19 12:42:13,440 WARN 1 AWSBeanstalkCfnDeploy.DeploymentUtils - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 2 of 5). 
2013-08-19 12:42:13,440 WARN 1 DeploymentLog - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 2 of 5). 
2013-08-19 12:42:14,454 WARN 1 AWSBeanstalkCfnDeploy.DeploymentUtils - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 3 of 5). 
2013-08-19 12:42:14,454 WARN 1 DeploymentLog - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 3 of 5). 
2013-08-19 12:42:15,468 WARN 1 AWSBeanstalkCfnDeploy.DeploymentUtils - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 4 of 5). 
2013-08-19 12:42:15,468 WARN 1 DeploymentLog - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 4 of 5). 
2013-08-19 12:42:16,482 WARN 1 AWSBeanstalkCfnDeploy.DeploymentUtils - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 5 of 5). 
2013-08-19 12:42:16,482 WARN 1 DeploymentLog - The process 'C:\Windows\system32\cmd.exe' (command line '') is still running. Waiting for 1000 ms (attempt 5 of 5). 
2013-08-19 12:42:16,482 ERROR 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Exception during deployment. 

任何想法如何增加超時,使安裝程序將運行成功?或者我可以如何讓安裝程序作爲部署的一部分運行?

回答

3

在AWS Elastic Beanstalk實例上安裝MSI包的更簡單方法是使用.ebextensions機制。

在您的項目中創建一個名爲.ebextensions的文件夾,並在其中放置一個文件,其中擴展名爲.config(例如installs.config)。這是一個描述要執行的安裝的YAML文件,以及在部署之前在每個實例上運行的命令。一個簡單的例子可能是這樣的

packages: 
    msi: 
     CrystalReports: http://myfilehost.com/packages/CrystalReports.msi 

如果URL是一個公共訪問的地方,你可以把你的MSI。例如,這可能在S3存儲桶中。

關於AWS彈性魔豆定製功能的更多細節可以在這裏找到:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html

功能的概述可以在AWS開發者博客,在這裏找到:http://blogs.aws.amazon.com/net/post/Tx1RLX98N5ERPSA/Customizing-Windows-Elastic-Beanstalk-Environments-Part-1

+0

輝煌!謝謝工作完美。比使用runco​​mmand提供者要容易得多。 –

+0

對於那些與msbuild和runco​​mmand提供者苦苦掙扎的人,我認爲問題在於,當msbuild使用目標來構建archive.xml清單文件時,它不尊重waitInterval參數。其中一種解決方法可能是使用[此方法](http://www.codeproject.com/Articles/539088/Amazon-AWSDeploy-To-Provision-Multiple-Websites?fid=1825739&df=90&mpp=25&noise=1&prof=True&sort = Position&view = None&spc = Relaxed)並手動編寫頂級清單文件,以便您可以在runCommand元素上指定waitInteval屬性。 –

相關問題