Search code examples
amazon-web-servicescrystal-reportsmsdeployamazon-elastic-beanstalkec2-api-tools

awsdeploy -> msdeploy -> runCommand timeout


I am using awsdeploy to deploy an elastic beanstalk ASP.NET MVC application. The application requires Crystal Reports which can only be installed by running a .msi installer (CRRuntime_64bit_13_0_6.msi).

To run the installer as part of the deployment I have added a custom target like so:

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

The install can take around a minute and I can view the log files created by the installer to see that it has been started OK. However, runCommand will only let it run for a maxiumum of 5 seconds before terminating it with an error. Changing waitAttempts and waitInterval appears to have no impact.

Below in an excerpt from "C:\Program Files\Amazon\ElasticBeanstalk\logs\AWSDeployment.log" which shows how awsdeploy/msdeploy is prematurely terminating the install.

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.

Any ideas how I can up the increase the timeout so the installer will run to success? Or any other ideas how I could get the installer run as part of the deployment?


Solution

  • An easier way to install MSI packages on AWS Elastic Beanstalk instances is to use the .ebextensions mechanism.

    Create a folder in your project called .ebextensions, and place a file in there with the extension .config (for example installs.config). This is a YAML file which describes installs to do, and commands to run on each instance before deploying. A simple example might look like this

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

    Where the URL is a publicly accessible place you can put your MSI. This could be in an S3 bucket for example.

    More details about the AWS Elastic Beanstalk customization feature can be found here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html

    An overview of the feature can be found on the AWS Developer Blog, here: http://blogs.aws.amazon.com/net/post/Tx1RLX98N5ERPSA/Customizing-Windows-Elastic-Beanstalk-Environments-Part-1