0
我想在部署到AWS Beanstalk Windows IIS實例後執行PowerShell腳本。對於這一點,我已經寫了AWS-Windows的部署,manifest.json檔案如下:如何獲取在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腳本是超級簡單,只包含:
"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" ----------
最終的結果是,在部署完成後,Web應用程序的工作,但PostInstallSetup.ps1腳本尚未執行。
我是否在清單文件中的錯誤?或者我需要將PostInstallSetup.ps1腳本放在別的地方嗎?
我已經減少了PostInstallSetup.ps1腳本爲「Hello World」只是爲了排除腳本問題打破了部署。