【问题标题】:awsdeploy -> msdeploy -> runCommand timeoutawsdeploy -> msdeploy -> runCommand 超时
【发布时间】:2013-08-19 23:35:39
【问题描述】:

我正在使用 awsdeploy 部署弹性 beanstalk ASP.NET MVC 应用程序。该应用程序需要 Crystal Reports,只能通过运行 .msi 安装程序 (CRRuntime_64bit_13_0_6.msi) 进行安装。

为了在部署过程中运行安装程序,我添加了一个自定义目标,如下所示:

<!--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>

安装可能需要一分钟左右,我可以查看安装程序创建的日志文件,以了解它是否已正常启动。但是,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.

有什么想法可以增加超时时间以使安装程序运行成功吗?或者任何其他想法如何让安装程序作为部署的一部分运行?

【问题讨论】:

    标签: amazon-web-services crystal-reports msdeploy amazon-elastic-beanstalk ec2-api-tools


    【解决方案1】:

    在 AWS Elastic Beanstalk 实例上安装 MSI 包的更简单方法是使用 .ebextensions 机制。

    在您的项目中创建一个名为.ebextensions 的文件夹,并在其中放置一个扩展名为.config 的文件(例如installs.config)。这是一个 YAML 文件,它描述了要执行的安装以及在部署之前在每个实例上运行的命令。一个简单的示例可能如下所示

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

    如果 URL 是可公开访问的位置,您可以放置​​ MSI。例如,这可能在 S3 存储桶中。

    有关 AWS Elastic Beanstalk 自定义功能的更多详细信息,请访问此处: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

    【讨论】:

    • 太棒了!谢谢工作完美。比使用 runco​​mmand 提供程序容易得多。
    • 对于那些在 msbuild 和 runco​​mmand 提供者中苦苦挣扎的人,我认为问题在于当 msbuild 使用目标来构建 archive.xml 清单文件时,它不尊重 waitInterval 参数。一种解决方法可能是使用 this approach 并手动编写顶级清单文件,以便您可以在 runCommand 元素上指定 waitInteval 属性。
    猜你喜欢
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-25
    相关资源
    最近更新 更多