Created
October 10, 2018 04:20
-
-
Save BillCacy/b0e63997864a43f68d307e4cec217ab4 to your computer and use it in GitHub Desktop.
Solr settings mapping from Octopus variables.
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" | |
Set-StrictMode -Version 2.0 | |
$ErrorActionPreference = "Stop" | |
<# | |
.SYNOPSIS | |
Creates a BlueGreenSolrSettings object with property values defined by Octopus variables. | |
.PARAMETER Settings | |
An string dictionary passed in from Octopus deploy containing the variables used in | |
the defined deployment process. | |
.EXAMPLE | |
Calling the function from a script that is called during Octopus deployment | |
$blueGreenSettings = New-BlueGreenSolrSettings $OctopusParameters | |
#> | |
function New-BlueGreenSolrSettings() | |
{ | |
param( | |
[Parameter(Mandatory = $true)] | |
[System.Collections.Generic.Dictionary``2[System.String,System.String]] | |
$Settings | |
) | |
$model = [BlueGreenSolrSettings]::new() | |
# Octopus Environment settings (provided by Octopus by default) | |
$model.Machine.Roles = $Settings["Octopus.Machine.Roles"].Split(",") | |
# Octopus Solr variables (must be defined manually in Octopus) | |
$model.Solr.InstallDir = $Settings["BlueGreen.SolrCloud.InstallDir"] | |
$model.Solr.Zookeepers = $Settings["BlueGreen.SolrCloud.Zookeepers"] | |
$model.Solr.InstanceUrl = $Settings["BlueGreen.SolrCloud.InstanceUrl"] | |
# Role names for the Active and Non-Active roles used. | |
# These values are important for all of the functionality regarding the 'Source' and 'Target' | |
# of the replication and direction. | |
# Only the 'Primary' Solr node in the cluster is utilized in the scripts. | |
$model.Solr.ActiveRoleName = $Settings["BlueGreen.SolrCloud.ActiveRoleName"] | |
$model.Solr.NonActiveRoleName = $Setting["BlueGreen.SolrCloud.NonActiveRoleName"] | |
# Index name is configurable based on needs. | |
# Be sure the index configuration files are setup correctly. | |
# A solrconfig.xml is needed with different values for 'Source' and 'Target'. | |
# Information on configuring CDCR with SolrCloud can be found here: | |
# https://lucene.apache.org/solr/guide/6_6/cross-data-center-replication-cdcr.html | |
$model.Solr.IndexConfigName = "sitecore_analytics_live_index" | |
return $model | |
} | |
Export-ModuleMember -Function New-BlueGreenSolrSettings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment