Skip to content

Commit

Permalink
Merge pull request #1 from Akaizoku/develop
Browse files Browse the repository at this point in the history
1.1.0 release
  • Loading branch information
Akaizoku authored Nov 21, 2021
2 parents 8707f40 + dd5db1a commit c670ac8
Show file tree
Hide file tree
Showing 14 changed files with 915 additions and 259 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Changelog

All notable changes to the [Alteryx deploy](https://github.com/Akaizoku/alteryx-deploy) project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.0](https://github.com/Akaizoku/alteryx-deploy/releases/1.1.0) - 2021-11-21

### Added

- `Invoke-StartAlteryx` now checks for release version to ensure compatibility
- Check connectivity to licensing system
- Disable Alteryx license action
- Disable Alteryx license(s) during uninstallation
- License key parameter

### Changed

- Disabled InstallAware logging by default to improve performances
- Improved documentation

### Fixed

- Fix conflict with version parameter and PowerShell modules versions
- Fix `Get-AlteryxUtility` function call following refactoring of [PSAYX](https://github.com/Akaizoku/PSAYX)

## [1.0.0](https://github.com/Akaizoku/alteryx-deploy/releases/1.0.0) - 2021-09-20

Minimum viable product (MVP) release for the Alteryx automated deployment utility.

### Added

The following functions have been added:

- Install-Alteryx
- Invoke-ActivateAlteryx
- Invoke-BackupAlteryx
- Invoke-RestartAlteryx
- Invoke-RestoreAlteryx
- Invoke-StartAlteryx
- Invoke-StopAlteryx
- Show-Configuration
- Uninstall-Alteryx
- Update-Alteryx

The following files have been added:

- LICENSE
- README.md
143 changes: 87 additions & 56 deletions Deploy-Alteryx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@

<#
.SYNOPSIS
Setup Alteryx
Deploy Alteryx
.DESCRIPTION
Setup and configure Alteryx
Deploy and configure Alteryx
.PARAMETER Action
The action parameter corresponds to the operation to perform.
Eight options are available:
- backup: backup the Alteryx application database
- configure: configure the Alteryx application
- install: install the Alteryx application
- restart: restart the Alteryx application
- restore: restore a backup of the Alteryx application database
- show: display the script configuration
- start: start the Alteryx application
- stop: stop the Alteryx application
- uninstall: uninstall the Alteryx application
- upgrade: upgrade the Alteryx application
Eleven options are available:
- activate: activate the Alteryx application license
- backup: backup the Alteryx application database
- deactivate: deactivate the Alteryx application license
- install: install the Alteryx application
- restart: restart the Alteryx application
- restore: restore a backup of the Alteryx application database
- show: display the script configuration
- start: start the Alteryx application
- stop: stop the Alteryx application
- uninstall: uninstall the Alteryx application
- upgrade: upgrade the Alteryx application
.PARAMETER Unattended
The unattended switch define if the script should run in silent mode without any user interaction.
.NOTES
File name: Deploy-Alteryx.psm1
File name: Deploy-Alteryx.ps1
Author: Florian Carrier
Creation date: 2021-06-13
Last modified: 2021-09-10
Last modified: 2021-11-15
Dependencies: - PowerShell Tool Kit (PSTK)
- Alteryx PowerShell Module (PSAYX)
- Alteryx PowerShell Module (PSAYX)
.LINK
https://github.com/Akaizoku/alteryx-deploy
Expand All @@ -57,6 +60,7 @@ Param (
[ValidateSet (
"activate",
"backup",
"deactivate",
"install",
"restart",
"restore",
Expand All @@ -66,21 +70,23 @@ Param (
"uninstall",
"upgrade"
)]
[String]
[System.String]
$Action,
[Parameter (
Position = 2,
Mandatory = $false,
HelpMessage = "Version parameter overwrite"
)]
[ValidateNotNullOrEmpty ()]
[System.String]
$Version,
[Parameter (
Position = 3,
Mandatory = $false,
HelpMessage = "Database backup path"
)]
[String]
[ValidateNotNullOrEmpty ()]
[System.String]
$BackupPath,
[Parameter (
Position = 4,
Expand All @@ -91,8 +97,21 @@ Param (
"Designer",
"Server"
)]
[ValidateNotNullOrEmpty ()]
[System.String]
$Product = "Server",
[Parameter (
Position = 5,
Mandatory = $false,
HelpMessage = "License key(s)"
)]
[ValidatePattern ("^\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4}(\s\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4}-\w{4})*$")]
[Alias (
"Keys",
"Serial"
)]
[System.String[]]
$LicenseKey,
[Parameter (
HelpMessage = "Run script in non-interactive mode"
)]
Expand All @@ -102,14 +121,13 @@ Param (

Begin {
# ----------------------------------------------------------------------------
# Global preferences
# * Global preferences
# ----------------------------------------------------------------------------
$ErrorActionPreference = "Stop"
$DebugPreference = "Continue"
Set-StrictMode -Version Latest
$ProgressPreference = "Continue"

# ----------------------------------------------------------------------------
# Global variables
# * Global variables
# ----------------------------------------------------------------------------
# General
$ISOTimeStamp = Get-Date -Format "yyyyMMdd_HHmmss"
Expand All @@ -121,28 +139,34 @@ Begin {
$CustomProperties = "custom.ini"

# ----------------------------------------------------------------------------
# Modules
# * Modules
# ----------------------------------------------------------------------------
# List all required modules
$Modules = @("PSTK", "PSAYX")
foreach ($Module in $Modules) {
try {
# Check if module is installed
Import-Module -Name "$Module" -ErrorAction "Stop" -Force
Write-Log -Type "CHECK" -Object "The $Module module was successfully loaded."
} catch {
# Otherwise check if package is available locally
try {
Import-Module -Name (Join-Path -Path $LibDirectory -ChildPath "$Module") -ErrorAction "Stop" -Force
Write-Log -Type "CHECK" -Object "The $Module module was successfully loaded from the library directory."
} catch {
Throw "The $Module library could not be loaded. Make sure it has been made available on the machine or manually put it in the ""$LibDirectory"" directory"
}
}
}
# Dependencies
$Modules = [Ordered]@{
"PSTK" = "1.2.4"
"PSAYX" = "1.0.1"
}
# Load modules
foreach ($Module in $Modules.GetEnumerator()) {
try {
# Check if package is available locally
Import-Module -Name (Join-Path -Path $LibDirectory -ChildPath $Module.Name) -MinimumVersion $Module.Value -ErrorAction "Stop" -Force
$ModuleVersion = (Get-Module -Name $Module.Name).Version
Write-Log -Type "CHECK" -Object "The $($Module.Name) module (v$ModuleVersion) was successfully loaded from the library directory."
} catch {
try {
# Otherwise check if module is installed
Import-Module -Name $Module.Name -MinimumVersion $Module.Value -ErrorAction "Stop" -Force
$ModuleVersion = (Get-Module -Name $Module.Name).Version
Write-Log -Type "CHECK" -Object "The $($Module.Name) module (v$ModuleVersion) was successfully loaded."
} catch {
Throw "The $($Module.Name) module (v$($Module.Value)) could not be loaded. Make sure it has been installed on the machine or packaged in the ""$LibDirectory"" directory"
}
}
}

# ----------------------------------------------------------------------------
# Script configuration
# * Script configuration
# ----------------------------------------------------------------------------
# General settings
$Properties = Get-Properties -File $DefaultProperties -Directory $ConfDirectory -Custom $CustomProperties
Expand All @@ -159,15 +183,15 @@ Begin {
Write-Log -Type "DEBUG" -Message $PSCmdlet.MyInvocation.Line

# ------------------------------------------------------------------------------
# Checks
# * Checks
# ------------------------------------------------------------------------------
# Ensure shell is running as 64 bit process
if ([Environment]::Is64BitProcess -eq $false) {
Write-Log -Type "ERROR" -Message "PowerShell is running as a 32-bit process" -ExitCode 1
}

# ----------------------------------------------------------------------------
# Functions
# * Functions
# ----------------------------------------------------------------------------
# Load PowerShell functions
$Functions = Get-ChildItem -Path $Properties.PSDirectory
Expand All @@ -178,7 +202,7 @@ Begin {
}

# ----------------------------------------------------------------------------
# Variables
# * Variables
# ----------------------------------------------------------------------------
# (Re)load environment variables
# Write-Log -Type "DEBUG" -Message "Load environment variables"
Expand All @@ -188,7 +212,7 @@ Begin {
# }

# ----------------------------------------------------------------------------
# Options
# * Options
# ----------------------------------------------------------------------------
# Installation properties
$ValidateSet = @(
Expand All @@ -206,22 +230,29 @@ Begin {
if ($PSBoundParameters.ContainsKey("BackupPath")) {
$Properties.Add("BackupPath", $BackupPath)
}
if ($PSBoundParameters.ContainsKey("LicenseKey")) {
if ($LicenseKey.Count -eq 1 -And $LicenseKey -match "\s") {
$LicenseKey = $LicenseKey.Split(" ")
}
$Properties.Add("LicenseKey", @($LicenseKey))
}
}

Process {
# Check operation to perform
switch ($Action) {
"activate" { Invoke-ActivateAlteryx -Properties $Properties -Unattended:$Unattended }
"backup" { Invoke-BackupAlteryx -Properties $Properties -Unattended:$Unattended }
"install" { Install-Alteryx -Properties $Properties -InstallationProperties $InstallationProperties -Unattended:$Unattended }
"restart" { Invoke-RestartAlteryx -Properties $Properties -Unattended:$Unattended }
"restore" { Invoke-RestoreAlteryx -Properties $Properties -Unattended:$Unattended }
"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 -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 }
"activate" { Invoke-ActivateAlteryx -Properties $Properties -Unattended:$Unattended }
"backup" { Invoke-BackupAlteryx -Properties $Properties -Unattended:$Unattended }
"deactivate" { Invoke-DeactivateAlteryx -Properties $Properties -Unattended:$Unattended }
"install" { Install-Alteryx -Properties $Properties -InstallationProperties $InstallationProperties -Unattended:$Unattended }
"restart" { Invoke-RestartAlteryx -Properties $Properties -Unattended:$Unattended }
"restore" { Invoke-RestoreAlteryx -Properties $Properties -Unattended:$Unattended }
"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 -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
Loading

0 comments on commit c670ac8

Please sign in to comment.