0

AWS Beanstalk Windows IIS 인스턴스에 배포 한 후 PowerShell 스크립트를 실행하려고합니다.AWS Beanstalk Windows 인스턴스에서 postInstall PowerShell 스크립트를 실행하는 방법

{ 
 
    "manifestVersion": 1, 
 
    "iisConfig": { 
 
    "appPools": [ 
 
     { 
 
     "name": "AppPoolName", 
 
     "recycling": { 
 
      "regularTimeInterval": 10 
 
     } 
 
     } 
 
    ] 
 
    }, 
 
    "deployments": { 
 
    "msDeploy": [ 
 
     { 
 
     "name": "app", 
 
     "parameters": { 
 
      "appBundle": "App.zip", 
 
      "iisPath": "/", 
 
      "iisWebSite": "Default Web Site", 
 
      "appPool": "AppPoolName" 
 
     }, 
 
     "scripts": { 
 
      "postInstall": { 
 
      "file": "PostInstallSetup.ps1" 
 
      } 
 
     } 
 
     } 
 
    ] 
 
    } 
 
}

내 PostInstallSetup.ps1 스크립트는 슈퍼 간단합니다 그냥 포함 : 다음과 같이이를 위해, 나는 AWS-창 배포-의 manifest.json 파일을 작성했습니다

"Hello, World!" 

그래도 작동하지 않습니다. 배포의 로그 파일에서 나는 다음과 같은 메시지를 얻을 :

Info: Adding file (Default Web Site/Web.config). 
---------- Executing command "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted -NonInteractive -NoProfile -Command "& { & \"C:\Staging\PostInstallSetup.ps1\"; exit $LastExitCode }" " ---------- 
Info: Adding file (Default Web Site/Readme.txt). 
Error during deployment: The directory name is invalid 
    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) 
    at System.Diagnostics.Process.Start() 
    at AWS.DeploymentCommands.Utilities.ExecuteCommand(String cwd, String command, String arguments, ILogger logger, Boolean throwOnError) in D:\Jenkins\jobs\aws.deploytools-build\workspace\src\AWS.DeploymentCommands\Utilities.cs:line 181 
    at AWS.DeploymentCommands.Utilities.ExecutePowerShellScript(String cwd, String script, ILogger logger) in D:\Jenkins\jobs\aws.deploytools-build\workspace\src\AWS.DeploymentCommands\Utilities.cs:line 107 
    at AWS.DeploymentCommands.Commands.BaseScriptableCommand.ExecuteScript(ScriptDeclaration script, String cwd) in D:\Jenkins\jobs\aws.deploytools-build\workspace\src\AWS.DeploymentCommands\Commands\BaseScriptableCommand.cs:line 84 
    at AWS.DeploymentCommands.Commands.DeployMSDeployPackages.DoInstall() in D:\Jenkins\jobs\aws.deploytools-build\workspace\src\AWS.DeploymentCommands\Commands\DeployMSDeployPackages.cs:line 105 
Info: Adding file (Default Web Site/WebC.Web.config). 
---------- Executing command "C:\Windows\system32\iisreset.exe /start" ---------- 

최종 결과는 배포가 웹 응용 프로그램이 작동되고, 완료,하지만 PostInstallSetup.ps1 스크립트가 실행되지 않은 것입니다.

매니 페스트 파일에 오류가 있습니까? 또는 PostInstallSetup.ps1 스크립트를 다른 위치에 두어야합니까?

스크립트의 문제로 인해 배포가 중단되는 것을 제외하기 위해 PostInstallSetup.ps1 스크립트를 "Hello World"로 축소했습니다.

답변

0

scripts/postInstall 메서드는 msDeploy와 함께 제대로 작동하지 않습니다. .NET Core 유형 배포와 함께 작동 했으므로 해결 방법으로 postInstall 코드를 배치 한 더미 .NET Core 패키지를 추가했습니다.