ps/Modules/Alkami.DevOps.Installation/Public/Install-ORBAppServer.ps1
2023-05-30 22:51:22 -07:00

95 lines
3.0 KiB
PowerShell

function Install-ORBAppServer {
<#
.SYNOPSIS
Installs an ORB App Server.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)]
[Alias("SecretServerUserName")]
[string]$secretUserName,
[Parameter(Mandatory = $false)]
[Alias("SecretServerPassword")]
[string]$secretPassword,
[Parameter(Mandatory = $false)]
[Alias("SecretServerFolders")]
[string]$secretFolderNames,
[Parameter(Mandatory = $false)]
[Alias("SecretServerDomain")]
[string]$secretDomain = "corp.alkamitech.com",
[Parameter(Mandatory = $false)]
[Alias("SkipWarmup")]
[switch]$skipAppWarmup,
[Parameter(Mandatory = $false)]
[Alias("PodGMSAAccount")]
[string]$podGMSAAccountParent
)
if ( ( Test-IsAppServer ) -eq $false ) {
$title = "You Are Attempting to Install the ORB App Tier on a Machine Identified as a non-App Tier Server";
$message = "Do you want to quit?";
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Breaks execution."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Continues execution."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$result = $host.ui.PromptForChoice($title, $message, $options, 0)
if ( $result -eq 0 ) {
Write-Host "Cancelling installation."
return
}
}
$logLead = (Get-LogLeadName)
Write-Output ("$logLead : Configuring Machine as App Tier Server for POD {0}" -f [Environment]::GetEnvironmentVariable("POD", "Machine"))
if (![String]::IsNullOrEmpty($secretUserName) -and ![String]::IsNullOrEmpty($secretPassword) -and ![String]::IsNullOrEmpty($secretFolderNames) -and ![String]::IsNullOrEmpty($secretDomain)) {
Read-AppTierSecrets $secretUserName $secretPassword $secretFolderNames $secretDomain
}
if (![String]::IsNullOrEmpty($podGMSAAccountParent)) {
Set-AppTierGMSAAccounts $podGMSAAccountParent
}
if (($appTierApplications | Where-Object {$_.User.EndsWith("$") -and $_.IsGMSAAccount}).Count -gt 0 -or ((Get-AppTierServices) | Where-Object {$_.User.EndsWith("$") -and $_.IsGMSAAccount}).Count -gt 0) {
Test-AppTierGMSAAccounts
}
Set-AppTierDefaultWebSite
Set-AppTierFolderAndFilePermissions
New-MachineConfigConnectionString $true
New-MachineConfigConnectionString $false
Write-Output "$logLead : Running the CreateSymLinks Script"
New-OrbSymLinks
Write-Output "$logLead : Creating AppPools, Services, Configs, etc"
New-AppTierWebApplications
New-AppTierWindowsServices
New-AppTierHostFileEntries
New-MachineConfigMachineKeys
Rename-NewLogConfig
Set-DefaultTLSVersion
Write-Output "$logLead : Calling Disable-Nag"
Disable-Nag
Set-RapidFailSettings
if ($skipAppWarmup) {
return
}
Write-Output "$logLead : Warming up services..."
Ping-AlkamiServices
}