I’m working on a Blue/Green deployment POC and running scripts on host in two different environments to essentially make one live and bring another one off-line.
I’ve found helpful information in a solution mentioned by Matt Richardson in this thread: https://help.octopusdeploy.com/discussions/questions/10632-run-script-on-non-deployed-environment
I’ve installed 2 tentacles on a machine and assigned them different names and roles, to target them differently based on whether they are going to be made live or not as part of the blue green deployment.
The following is my scenario:
Blue environment - DRH-POC-SlrPrGrNonLive - with role ‘non-active-stc-solr-primary’
Green environment - DRH-POC-SlrPrGr - with role ‘stc-solr-primary’
A powershell script is used to update the machines based on role. When the script is run against the ‘DRH-POC-SlrPrGrNonLive’ host, it seems that the role getting associated with that host, may be the role from the ‘DRH-POC-SlrPrGr’ server.
Including screenshots of the step log and the blue environment hosts:
The script being called references the “Octopus.Machine.Roles” variable to determine what action to perform.
This is the portion that handles processing based on the role:
if($Arke.Machine.HasRole("stc-solr-primary"))
{
#Instance needs to be set as source
Write-Host "Pushing configuration to zookeepers for role: stc-solr-primary"
$sourceConfigDir = Join-Path $BlueGreen.Solr.SolrInstall -ChildPath "server\solr\configsets\sitecore_analytics_live_index_source\conf"
Push-ConfigToZookeepers -solrPath $BlueGreen.Solr.SolrInstall -zookeepers $BlueGreen.Solr.Zookeepers -configName $configName -configDir $sourceConfigDir
return
}
if($Arke.Machine.HasRole("non-active-stc-solr-primary"))
{
#Instance needs to be set as target
Write-Host "Pushing configuration to zookeepers for role: non-active-stc-solr-primary"
$targetConfigDir = Join-Path $BlueGreen.Solr.SolrInstall -ChildPath "server\solr\configsets\sitecore_analytics_live_index_target\conf"
Push-ConfigToZookeepers -solrPath $BlueGreen.Solr.SolrInstall -zookeepers $BlueGreen.Solr.Zookeepers -configName $configName -configDir $targetConfigDir
return
}
Are there known issues with running 2 tentacles on the same machine to assign them to different environments? I expected that the role ‘non-active-stc-solr-primary’ would’ve been defined for the ‘DRH-POC-SlrPrGrNonLive’ host, but it seems something isn’t quite right and I’m not sure what that could be.
Any assistance would be appreciated!