ps/Modules/Alkami.PowerShell.SDK/Public/Install-SDKIISComponents.ps1
2023-05-30 22:51:22 -07:00

63 lines
2.6 KiB
PowerShell

function Install-SDKIISComponents {
[CmdletBinding()]
param()
$logLead = Get-LogLeadName
Import-Module WebAdministration
## Remove existing sites along the specified path names
# This is being redone to match what is in prod, instead of QA
# Developers are only expected to have a handful of sites, so making this change is beneficial for developers so they continue to match production conifguration
$siteNamesToKeep = @('WebClient','WebClientAdmin','IPSTS','DefaultWebSite','Default Web Site', 'Eagle Eye', 'CoreDashboard', 'Orion')
$sitesToTest = @()
$sitesToTest += Get-IISSitesByPath -Path "C:\Orb\WebClient"
$sitesToTest += Get-IISSitesByPath -Path "C:\Orb\WebClientAdmin"
$sitesToTest += Get-IISSitesByPath -Path "C:\Orb\IPSTS"
foreach ($site in $sitesToTest) {
if ($site.Name -in $siteNamesToKeep) {
continue
}
#Remove-IISSite -Name $site.Name
Remove-Item IIS:\Sites\$site.Name
}
$forciblyCreate = @('WebClient', 'WebClientAdmin', 'IPSTS')
foreach ($create in $forciblyCreate) {
$appPool = (Get-AlkamiWebAppPool $create)
if ($null -eq $appPool) {
$appPool = (New-AlkamiWebAppPool $create)
}
}
## Loop tenants for site names to create
$tenants = Get-FullTenantListFromServer
# Handle the use-case where one tenant has multiple signatures in the smae field
# This will auto-array via PS so we just end up with a list of tenant signatures
# Yay magic
$clientSignatures = $tenants.Signature -split ','
$adminSignatures = $tenants.AdminSignature -split ','
foreach ($clientSignature in $clientSignatures) {
New-ClientWebBinding -ClientUrl $clientSignature -doCombineClientAppPools $true
}
foreach ($adminSignature in $adminSignatures) {
New-AdminWebBinding -AdminUrl $adminSignature -doCombineAdminAppPools $true
}
New-IPSTSWebBinding -ipstsUrl 'ip.dev.alkamitech.com' -DoCombineIPSTSAppPools $true
New-AppTierWebApplications
# Override the global to only install Radium, not Nag.
$global:appTierServices = @(
@{ FolderName = 'Radium'; AssemblyInfo = 'Alkami.App.Radium.WindowsService'; Name = "Alkami Radium Scheduler Service"; User = "REPLACEME"; Password = "REPLACEME"; IsGMSAAccount = $true; Binary = $basePath + "\Radium\Alkami.App.Radium.WindowsService.exe"; }
)
$radiumServiceName = $global:appTierServices.Name
if (Stop-AlkamiService -ServiceName $radiumServiceName) {
Write-Warning "$logLead : Radium may be stopped, you may need to start it manually if this was not called as part of a deploy/install"
}
New-AppTierWindowsServices
}