Created
October 10, 2018 04:27
-
-
Save BillCacy/318d8e60117defc98eaf67e683ea66e0 to your computer and use it in GitHub Desktop.
Script to utilize in local testing of the Solr functionality pieces of a blue/green deployment. This utilizes the LocalSettings.psm1 file that maps user-defined values to the Solr settings.
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 ".\LocalSettings.psm1" | |
<# | |
.SYNOPSIS | |
Calls the Solr functions for SolrCloud CDCR to test in a non-live environment (without Octopus deploy). | |
The .\LocalSettings.psm1 file is used to map user-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 Solr Cloud Zookeepers. | |
.\BlueGreenSolr-Local.ps1 -startingReplication $false -reversing $false | |
Starting the replication process after the Zookeepers have been pushed. | |
.\BlueGreenSolr-Local.ps1 -startingReplication $true -reversing $false | |
Reverting a failed deploy reverting zookeeper configs. | |
.\BlueGreenSolr-Local.ps1 -startingReplication $false -reversing $true | |
Reverting a failed deploy, restarting replication. | |
.\BlueGreenSolr-Local.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 = Get-LocalBlueGreenSolrSettings | |
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