Skip to content

Commit

Permalink
Add support for Designer installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaizoku committed Sep 15, 2021
1 parent 6114ba2 commit 4b7bf24
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 42 deletions.
20 changes: 16 additions & 4 deletions Deploy-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
File name: Deploy-Alteryx.psm1
Author: Florian Carrier
Creation date: 2021-06-13
Last modified: 2021-09-03
Last modified: 2021-09-10
Dependencies: - PowerShell Tool Kit (PSTK)
- Alteryx PowerShell Module (PSAYX)
Expand Down Expand Up @@ -73,7 +73,7 @@ Param (
Mandatory = $false,
HelpMessage = "Version parameter overwrite"
)]
[System.Version]
[System.String]
$Version,
[Parameter (
Position = 3,
Expand All @@ -82,6 +82,17 @@ Param (
)]
[String]
$BackupPath,
[Parameter (
Position = 4,
Mandatory = $false,
HelpMessage = "Product to install"
)]
[ValidateSet (
"Designer",
"Server"
)]
[System.String]
$Product = "Server",
[Parameter (
HelpMessage = "Run script in non-interactive mode"
)]
Expand Down Expand Up @@ -187,6 +198,7 @@ Begin {
"DataPackages"
)
$InstallationProperties = Get-Properties -File $Properties.InstallationOptions -Directory $Properties.ConfDirectory -ValidateSet $ValidateSet
$InstallationProperties.Add("Product", $Product)
# Optional parameters
if ($PSBoundParameters.ContainsKey("Version")) {
$Properties.Version = $Version
Expand All @@ -207,8 +219,8 @@ Process {
"show" { Show-Configuration -Properties $Properties -InstallationProperties $InstallationProperties }
"start" { Invoke-StartAlteryx -Properties $Properties -Unattended:$Unattended }
"stop" { Invoke-StopAlteryx -Properties $Properties -Unattended:$Unattended }
"uninstall" { Uninstall-Alteryx -Properties $Properties -Unattended:$Unattended }
"upgrade" { Invoke-UpgradeAlteryx -Properties $Properties -Unattended:$Unattended }
"uninstall" { Uninstall-Alteryx -Properties $Properties -InstallationProperties $InstallationProperties -Unattended:$Unattended }
"upgrade" { Update-Alteryx -Properties $Properties -InstallationProperties $InstallationProperties -Unattended:$Unattended }
default { Write-Log -Type "ERROR" -Message """$Action"" operation is not supported" -ExitCode 1 }
}
}
Expand Down
12 changes: 1 addition & 11 deletions conf/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,12 @@ DataPackagesPath = C:\Program Files\Alteryx\Data
[Filenames]
# Installation properties
InstallationOptions = install.ini
# Alteryx Server installer prefix
ServerInstaller = AlteryxServerInstallx64_
# Predictive Tools installer prefix
RInstaller = RInstaller_
# Alteryx Intelligence Suite installer prefix
AISInstaller = AlteryxAISInstall_
# Alteryx Connect installer prefix
ConnectInstaller = AlteryxConnect-
# Alteryx Promote installer prefix
PromoteInstaller = promote-

[Misc.]
# Installation language
Language = English
# Version
Version = 2021.3.1.47945
Version = 2021.3.2.54175
# SSL/TLS
EnableSSL = false

Expand Down
66 changes: 48 additions & 18 deletions powershell/Install-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Install-Alteryx {
File name: Install-Alteryx.ps1
Author: Florian Carrier
Creation date: 2021-07-05
Last modified: 2021-09-06
Last modified: 2021-09-14
.LINK
https://www.powershellgallery.com/packages/PSAYX
Expand Down Expand Up @@ -56,6 +56,16 @@ function Install-Alteryx {
Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
# Variables
$ISOTimeStamp = Get-Date -Format "yyyyMMdd_HHmmss"
$Tags = [Ordered]@{"Version" = $Properties.Version}
# Filenames
if ($InstallationProperties.Product -eq "Designer") {
$ServerInstaller = "AlteryxInstallx64_<Version>.exe"
} else {
$ServerInstaller = "AlteryxServerInstallx64_<Version>.exe"
}
# $RFileName AISFileName
$RInstaller = "RInstaller_<Version>.exe"
$AISInstaller = "AlteryxAISInstall_<Version>.exe"
# Unattended execution arguments
if ($Unattended) {
$Arguments = "/s"
Expand All @@ -64,43 +74,57 @@ function Install-Alteryx {
}
}
Process {
Write-Log -Type "INFO" -Message "Installation of Alteryx Server $($Properties.Version)"
Write-Log -Type "INFO" -Message "Installation of Alteryx $($InstallationProperties.Product) $($Properties.Version)"
# ------------------------------------------------------------------------------
# Alteryx Server
if ($InstallationProperties.Server -eq $true) {
$ServerFileName = [System.String]::Concat($Properties.ServerInstaller, $Properties.Version)
$ServerPath = Join-Path -Path $Properties.SrcDirectory -ChildPath "$ServerFileName.exe"
# ------------------------------------------------------------------------------
if ($InstallationProperties.Product -eq "Designer" -Or $InstallationProperties.Server -eq $true) {
# Update file version number
$ServerFileName = Set-Tags -String $ServerInstaller -Tags (Resolve-Tags -Tags $Tags -Prefix "<" -Suffix ">")
$ServerPath = Join-Path -Path $Properties.SrcDirectory -ChildPath $ServerFileName
if (Test-Path -Path $ServerPath) {
Write-Log -Type "INFO" -Message "Installing Alteryx Server"
Write-Log -Type "INFO" -Message "Installing Alteryx $($InstallationProperties.Product)"
if ($PSCmdlet.ShouldProcess($ServerPath, "Install")) {
$ServerLog = Join-Path -Path $Properties.LogDirectory -ChildPath "${ISOTimeStamp}_${ServerFileName}.log"
$ServerInstall = Install-AlteryxServer -Path $ServerPath -InstallDirectory $Properties.InstallationPath -Log $ServerLog -Serial $Properties.LicenseEmail -Language $Properties.Language -AllUsers -Unattended:$Unattended
Write-Log -Type "DEBUG" -Message $ServerInstall
if ($ServerInstall.ExitCode -eq 0) {
Write-Log -Type "CHECK" -Message "Alteryx Server installed successfully"
Write-Log -Type "CHECK" -Message "Alteryx $($InstallationProperties.Product) installed successfully"
} else {
Write-Log -Type "ERROR" -Message "An error occured during the installation" -ExitCode $ServerInstall.ExitCode
}
}
} else {
Write-Log -Type "ERROR" -Message "Path not found $ServerPath"
Write-Log -Type "ERROR" -Message "Alteryx Server installation file could not be located" -ExitCode 1
Write-Log -Type "ERROR" -Message "Alteryx $($InstallationProperties.Product) installation file could not be located" -ExitCode 1
}
# Configuration
if ($Unattended) {
Write-Log -Type "WARN" -Message "Do not forget to configure system settings"
} else {
# TODO start system settings
if ($InstallationProperties.Product -eq "Server") {
if ($Unattended) {
Write-Log -Type "WARN" -Message "Do not forget to configure system settings"
} else {
# TODO start system settings
}
}
}
# ------------------------------------------------------------------------------
# Predictive Tools
# ------------------------------------------------------------------------------
if ($InstallationProperties.PredictiveTools -eq $true) {
$RFileName = [System.String]::Concat($Properties.RInstaller, $Properties.Version, ".exe")
$RPath = Join-Path -Path $Properties.InstallationPath -ChildPath "RInstaller\$RFileName"
# Update file version number
$RFileName = Set-Tags -String $RInstaller -Tags (Resolve-Tags -Tags $Tags -Prefix "<" -Suffix ">")
if ($InstallationProperties.Product -eq "Server") {
# Use embedded R installer
$RPath = Join-Path -Path $Properties.InstallationPath -ChildPath "RInstaller\$RFileName"
} elseif ($InstallationProperties.Product -eq "Designer") {
$RPath = Join-Path -Path $Properties.SrcDirectory -ChildPath $RFileName
}
# Check source file
if (Test-Path -Path $RPath) {
Write-Log -Type "INFO" -Message "Installing Predictive Tools"
if ($PSCmdlet.ShouldProcess($RPath, "Install")) {
$RCommand = (@("&", $RPath, $Arguments) -join " ").Trim()
Write-Log -Type "DEBUG" -Message $RCommand
$RInstall = Start-Process -FilePath $RPath -ArgumentList $Arguments -Verb "RunAs" -PassThru -Wait
Write-Log -Type "DEBUG" -Message $RInstall
if ($RInstall.ExitCode -eq 0) {
Expand All @@ -116,12 +140,16 @@ function Install-Alteryx {
}
# ------------------------------------------------------------------------------
# Intelligence Suite
# ------------------------------------------------------------------------------
if ($InstallationProperties.IntelligenceSuite -eq $true) {
$AISFileName = [System.String]::Concat($Properties.AISInstaller, $Properties.Version, ".exe")
# Update file version number
$AISFileName = Set-Tags -String $AISInstaller -Tags (Resolve-Tags -Tags $Tags -Prefix "<" -Suffix ">")
$AISPath = Join-Path -Path $Properties.SrcDirectory -ChildPath $AISFileName
if (Test-Path -Path $AISPath) {
Write-Log -Type "INFO" -Message "Installing Intelligence Suite"
if ($PSCmdlet.ShouldProcess($AISPath, "Install")) {
$AISCommand = (@("&", $AISPath, $Arguments) -join " ").Trim()
Write-Log -Type "DEBUG" -Message $AISCommand
$AISInstall = Start-Process -FilePath $AISPath -ArgumentList $Arguments -Verb "RunAs" -PassThru -Wait
Write-Log -Type "DEBUG" -Message $AISInstall
if ($AISInstall.ExitCode -eq 0) {
Expand All @@ -137,12 +165,13 @@ function Install-Alteryx {
}
# ------------------------------------------------------------------------------
# Data packages
# ------------------------------------------------------------------------------
if ($InstallationProperties.DataPackages -eq $true) {
# TODO
$DataPackage = $null
if ($null -ne $DataPackage) {
$DataPackagePath = Join-Path -Path $Properties.SrcDirectory -ChildPath "$DataPackage.7z"
$DataPackageLog = Join-Path -Path $Properties.LogDirectory -ChildPath "${ISOTimeStamp}_${DataPackage}.log"
$DataPackagePath = Join-Path -Path $Properties.SrcDirectory -ChildPath "$DataPackage.7z"
$DataPackageLog = Join-Path -Path $Properties.LogDirectory -ChildPath "${ISOTimeStamp}_${DataPackage}.log"
if (-Not (Test-Path -Path $DataPackagePath)) {
Write-Log -Type "ERROR" -Message "Path not found $DataPackagePath"
Write-Log -Type "ERROR" -Message "Data package could not be located" -ExitCode 1
Expand Down Expand Up @@ -183,9 +212,10 @@ function Install-Alteryx {
}
# ------------------------------------------------------------------------------
# Licensing
# ------------------------------------------------------------------------------
Invoke-ActivateAlteryx -Properties $Properties -Unattended:$Unattended
}
End {
Write-Log -Type "CHECK" -Message "Alteryx Server $($Properties.Version) installed successfully"
Write-Log -Type "CHECK" -Message "Alteryx $($InstallationProperties.Product) $($Properties.Version) installed successfully"
}
}
29 changes: 23 additions & 6 deletions powershell/Uninstall-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Uninstall-Alteryx {
File name: Uninstall-Alteryx.ps1
Author: Florian Carrier
Creation date: 2021-07-08
Last modified: 2021-07-08
Last modified: 2021-09-14
.LINK
https://www.powershellgallery.com/packages/PSAYX
Expand All @@ -37,6 +37,14 @@ function Uninstall-Alteryx {
[ValidateNotNullOrEmpty ()]
[System.Collections.Specialized.OrderedDictionary]
$Properties,
[Parameter (
Position = 2,
Mandatory = $true,
HelpMessage = "Installation properties"
)]
[ValidateNotNullOrEmpty ()]
[System.Collections.Specialized.OrderedDictionary]
$InstallationProperties,
[Parameter (
HelpMessage = "Non-interactive mode"
)]
Expand All @@ -48,17 +56,25 @@ function Uninstall-Alteryx {
Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
# Variables
$ISOTimeStamp = Get-Date -Format "yyyyMMdd_HHmmss"
$Tags = [Ordered]@{"Version" = $Properties.Version}
# Filenames
if ($InstallationProperties.Product -eq "Designer") {
$ServerInstaller = "AlteryxInstallx64_<Version>.exe"
} else {
$ServerInstaller = "AlteryxServerInstallx64_<Version>.exe"
}
}
Process {
Write-Log -Type "INFO" -Message "Uninstallation of Alteryx Server $($Properties.Version)"
# ------------------------------------------------------------------------------
# Alteryx Server
# ------------------------------------------------------------------------------
# TODO check if Alteryx is installed
$ServerFileName = [System.String]::Concat($Properties.ServerInstaller, $Properties.Version)
$ServerPath = Join-Path -Path $Properties.SrcDirectory -ChildPath "$ServerFileName.exe"
# Update file version number
$ServerFileName = Set-Tags -String $ServerInstaller -Tags (Resolve-Tags -Tags $Tags -Prefix "<" -Suffix ">")
$ServerPath = Join-Path -Path $Properties.SrcDirectory -ChildPath $ServerFileName
if (Test-Path -Path $ServerPath) {
Write-Log -Type "INFO" -Message "Uninstalling Alteryx Server"
Write-Log -Type "INFO" -Message "Uninstalling Alteryx $($InstallationProperties.Product)"
if ($PSCmdlet.ShouldProcess($ServerPath, "Uninstall")) {
$ServerLog = Join-Path -Path $Properties.LogDirectory -ChildPath "${ISOTimeStamp}_${ServerFileName}.log"
$ServerUninstall = Uninstall-AlteryxServer -Path $ServerPath -Log $ServerLog -Unattended:$Unattended
Expand All @@ -71,8 +87,9 @@ function Uninstall-Alteryx {
}
} else {
Write-Log -Type "ERROR" -Message "Path not found $ServerPath"
Write-Log -Type "ERROR" -Message "Alteryx Server executable file could not be located" -ExitCode 1
Write-Log -Type "ERROR" -Message "Alteryx $($InstallationProperties.Product) executable file could not be located" -ExitCode 1
}
Write-Log -Type "CHECK" -Message "Uninstallation of Alteryx Server $Version successfull"
# TODO enable uninstall of standalone components
Write-Log -Type "CHECK" -Message "Uninstallation of Alteryx $($InstallationProperties.Product) $Version successfull"
}
}
14 changes: 11 additions & 3 deletions powershell/Update-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Update-Alteryx {
File name: Update-Alteryx.ps1
Author: Florian Carrier
Creation date: 2021-09-02
Last modified: 2021-09-02
Last modified: 2021-09-10
#>
[CmdletBinding (
SupportsShouldProcess = $true
Expand All @@ -24,6 +24,14 @@ function Update-Alteryx {
[ValidateNotNullOrEmpty ()]
[System.Collections.Specialized.OrderedDictionary]
$Properties,
[Parameter (
Position = 2,
Mandatory = $true,
HelpMessage = "Installation properties"
)]
[ValidateNotNullOrEmpty ()]
[System.Collections.Specialized.OrderedDictionary]
$InstallationProperties,
[Parameter (
HelpMessage = "Non-interactive mode"
)]
Expand All @@ -48,9 +56,9 @@ function Update-Alteryx {
# Create back-up
Invoke-BackupAlteryx -Properties $Properties -Unattended:$Unattended
# Upgrade
Install-Alteryx -Properties $Properties -Unattended:$Unattended
Install-Alteryx -Properties $Properties -InstallationProperties $InstallationProperties -Unattended:$Unattended
# Check for errors
if ($Errors.Count -gt 0) {
if ($Error.Count -gt 0) {
Write-Log -Type "ERROR" -Object "Upgrade process failed with $($Errors.Count) errors"
Write-Log -Type "WARN" -Object "Restoring previous version ($BackupVersion)"
# Overwrite target version
Expand Down

0 comments on commit 4b7bf24

Please sign in to comment.