gpt4 book ai didi

octopus-deploy - 如何在八达通部署期间优雅地使网络应用程序脱机?

转载 作者:行者123 更新时间:2023-12-03 19:57:18 27 4
gpt4 key购买 nike

我有点失职,发现 Octopus 虽然很神奇,但在升级之前关闭你的网络应用程序并没有做任何可爱或聪明的事情。

在我们的解决方案中,我们有两个依赖同一个数据库的 Web 应用程序(一个网站和一个单独的 API Web 应用程序),因此当一个正在升级时,另一个仍然有效,并且有可能在同时为 Web 或 API 请求提供服务数据库正在升级。

不干净!

Clean 是 Octopus 关闭网络应用程序,等到它们关闭然后继续升级,完成后将应用程序池恢复在线。

如何实现?

最佳答案

自拍答案!

很容易让 Octopus-deploy 对你的部署更加小心,你只需要一些额外的 执行-Powershell 部署例程中的步骤。

添加新的第一步以停止应用程序池:

# Settings
#---------------
$appPoolName = "PushpayApi" # Or we could set this from an Octopus environment setting.

# Installation
#---------------
Import-Module WebAdministration
# see http://technet.microsoft.com/en-us/library/ee790588.aspx

cd IIS:\


if ( (Get-WebAppPoolState -Name $appPoolName).Value -eq "Stopped" )
{
Write-Host "AppPool already stopped: " + $appPoolName
}

Write-Host "Shutting down the AppPool: " + $appPoolName
Write-Host (Get-WebAppPoolState $appPoolName).Value

# Signal to stop.
Stop-WebAppPool -Name $appPoolName

do
{
Write-Host (Get-WebAppPoolState $appPoolName).Value
Start-Sleep -Seconds 1
}
until ( (Get-WebAppPoolState -Name $appPoolName).Value -eq "Stopped" )
# Wait for the apppool to shut down.

然后在最后添加另一个步骤以重新启动应用程序池:
# Settings
#---------------
$appPoolName = "PushpayApi"

# Installation
#---------------
Import-Module WebAdministration
# see http://technet.microsoft.com/en-us/library/ee790588.aspx

cd IIS:\

if ( (Get-WebAppPoolState -Name $appPoolName).Value -eq "Started" )
{
Write-Host "AppPool already started: " + $appPoolName
}

Write-Host "Starting the AppPool: " + $appPoolName
Write-Host (Get-WebAppPoolState $appPoolName).Value

# To restart the app pool ...
Start-WebAppPool -Name $appPoolName

Get-WebAppPoolState -Name $appPoolName

关于octopus-deploy - 如何在八达通部署期间优雅地使网络应用程序脱机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20037060/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com