Created
October 10, 2018 04:25
-
-
Save BillCacy/258ad2afbdb05cb9cd9325fdce32bd15 to your computer and use it in GitHub Desktop.
Script to call the Solr functionality from an Octopus step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using module ".\BlueGreenSolrSettings.psm1" | |
using module ".\BlueGreenSolrSettingsMap.psm1" | |
<# | |
.SYNOPSIS | |
Calls the Solr functions for SolrCloud CDCR to update a Live environment (with Octopus deploy). | |
The .\BlueGreenSolrSettingsMap.psm1 file is used to map Octopus-defined variable values to | |
the .\BlueGreenSolrSettings.psm1 properties. | |
.PARAMETER startingReplication | |
Boolean variable used to specify if replication is being started or if this is a pre-starting | |
event to change the direction of replication. | |
.PARAMETER reversing | |
Boolean variable used to specify if the replication direction is being reversed or not. | |
This option will be false, unless a reversal deployment is being run. | |
In a reversal the roles used for pushing configs and starting replication are reversed. | |
.EXAMPLE | |
Pushing config files to SolrCloud Zookeepers. | |
.\BlueGreenSolr.ps1 -startingReplication $false -reversing $false | |
Starting the replication process after the Zookeepers have received the configurations. | |
.\BlueGreenSolr.ps1 -startingReplication $true -reversing $false | |
Reverting a failed deploy and reverting zookeeper configs. | |
.\BlueGreenSolr.ps1 -startingReplication $false -reversing $true | |
Reverting a failed deploy, restarting replication. | |
.\BlueGreenSolr.ps1 -startingReplication $true -reversing $true | |
#> | |
param( | |
[Parameter(Mandatory = $true)] [bool]$startingReplication, | |
[Parameter(Mandatory = $true)] [bool]$reversing | |
) | |
Set-StrictMode -Version 2.0 | |
Import-Module -Name "$PSScriptRoot\BlueGreenSolrHelper.psm1" -Force | |
$ErrorActionPreference = "Stop" | |
$blueGreenSettings = New-BlueGreenSolrSettings $OctopusParameters | |
if($startingReplication) | |
{ | |
# Kicking off the process to start the replication. | |
if($reversing) | |
{ | |
Start-ReplicationReverse -BlueGreen $blueGreenSettings | |
} | |
else | |
{ | |
Start-Replication -BlueGreen $blueGreenSettings | |
} | |
} | |
else | |
{ | |
# Kicking of the updates to push configs to the zookeepers in | |
# preparation for starting replication. | |
if($reversing) | |
{ | |
Set-ReplicationDirectionReverse -BlueGreen $blueGreenSettings | |
} | |
else | |
{ | |
Set-ReplicationDirection -BlueGreen $blueGreenSettings | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment