PowerShell Script for Unicorn Backup in Sitecore

Hi Champs,

Today I have created the PowerShell Script to create the backup of your Unicorn serialized folder. This script you can integrate with your local on server deployment or Environment setup plan.

 

Note: This is a PowerShell script you need save this with .ps1 extension and then you can utilize this.

 

Param(
[string]$environmentName
)
Add-Type -Assembly “System.IO.Compression.FileSystem”;
$sourceDir = “you have to mention your sourceDir”;
$targetDir = “you have to mention your targetDir”;
$date = (Get-Date -format “yyyyMMddTHHmmss”).ToString();

if (-Not (Test-Path $targetDir)) {
New-Item -Path $targetDir -ItemType directory
}

[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, “$targetDir$environmentName$date.zip”);

 

Please write your note or queries in comment.

Thanks for Browning!!!

Advertisement

Powershell Script to Install SSL to Solr for Sitecore

Hi Champs,

Today I bought you the PowerShell Script to install SSL to your Solr Instance.

Important note while doing this you need to change the variables according to your environment which will smoothly work for you.

Note: This is a PowerShell script you need save this with .ps1 extension and then you can utilize this.

param(
[string]$KeystoreFile = ‘solr-ssl.keystore.jks’,
[string]$KeystorePassword = ‘secret’,
[string]$SolrDomain = ‘localhost’,
[switch]$Clobber
)

$ErrorActionPreference = ‘Stop’

### PARAM VALIDATION
if($KeystorePassword -ne ‘secret’) {
Write-Error ‘The keystore password must be “secret”, because Solr apparently ignores the parameter’
}

if((Test-Path $KeystoreFile)) {
if($Clobber) {
Write-Host “Removing $KeystoreFile…”
Remove-Item $KeystoreFile
} else {
$KeystorePath = Resolve-Path $KeystoreFile
Write-Error “Keystore file $KeystorePath already existed. To regenerate it, pass -Clobber.”
}
}

$P12Path = [IO.Path]::ChangeExtension($KeystoreFile, ‘p12’)
if((Test-Path $P12Path)) {
if($Clobber) {
Write-Host “Removing $P12Path…”
Remove-Item $P12Path
} else {
$P12Path = Resolve-Path $P12Path
Write-Error “Keystore file $P12Path already existed. To regenerate it, pass -Clobber.”
}
}

try {
$keytool = (Get-Command ‘keytool.exe’).Source
} catch {
try {
$path = $Env:JAVA_HOME + ‘\bin\keytool.exe’
Write-Host $path
if (Test-Path $path) {
$keytool = (Get-Command $path).Source
}
} catch {
$keytool = Read-Host “keytool.exe not on path. Enter path to keytool (found in JRE bin folder)”

if([string]::IsNullOrEmpty($keytool) -or -not (Test-Path $keytool)) {
Write-Error “Keytool path was invalid.”
}
}
}

### DOING STUFF

Write-Host ”
Write-Host ‘Generating JKS keystore…’
& $keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass $KeystorePassword -storepass $KeystorePassword -validity 9999 -keystore $KeystoreFile -ext SAN=DNS:$SolrDomain,IP:127.0.0.1 -dname “CN=$SolrDomain, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country”

Write-Host ”
Write-Host ‘Generating .p12 to import to Windows…’
& $keytool -importkeystore -srckeystore $KeystoreFile -destkeystore $P12Path -srcstoretype jks -deststoretype pkcs12 -srcstorepass $KeystorePassword -deststorepass $KeystorePassword

Write-Host ”
Write-Host ‘Trusting generated SSL certificate…’
$secureStringKeystorePassword = ConvertTo-SecureString -String $KeystorePassword -Force -AsPlainText
$root = Import-PfxCertificate -FilePath $P12Path -Password $secureStringKeystorePassword -CertStoreLocation Cert:\LocalMachine\Root
Write-Host ‘SSL certificate is now locally trusted. (added as root CA)’

Write-Host ”
Write-Host ‘########## NEXT STEPS ##########’ -ForegroundColor Green
Write-Host ”
Write-Host ‘1. Copy your keystore to $SOLR_HOME\server\etc (MUST be here)’ -ForegroundColor Green

if(-not $KeystoreFile.EndsWith(‘solr-ssl.keystore.jks’)) {
Write-Warning ‘Your keystore file is not named “solr-ssl.keystore.jks”‘
Write-Warning ‘Solr requires this exact name, so make sure to rename it before use.’
}

$KeystorePath = Resolve-Path $KeystoreFile
Write-Host ”
Write-Host ‘2. Add the following lines to your solr.in.cmd:’ -ForegroundColor Green
Write-Host ”
Write-Host “set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks” -ForegroundColor Yellow
Write-Host “set SOLR_SSL_KEY_STORE_PASSWORD=$KeystorePassword” -ForegroundColor Yellow
Write-Host “set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks” -ForegroundColor Yellow
Write-Host “set SOLR_SSL_TRUST_STORE_PASSWORD=$KeystorePassword” -ForegroundColor Yellow
Write-Host ”
Write-Host ‘Done!’

 

Please write your note or queries in comment.

Thanks for Browning!!!

All about Sitecore SXA Part-1

Hi Champs,

Here we go. I have done some basic analysis of Sitecore SXA and Sitecore Controller renderings , some SXA limitations, Upgrade path for Sitecore SXA 1.7 with Sitecore 9.0.2, creating new custom Sitecore SXA renderings.

Sitecore SXA Renderings vs Sitecore Controller base Renderings

SXA Rendering Sitecore Controller Rendering
  • Helix based OOTB components, ready to use themes and grid systems with extended Experience Editor (drag and drop).
  • Rendering variants to render same component in multiple ways.
  • Supports creating custom renderings by inheriting SXA StandardController or VariantsController class.
  • Sitecore renderings have to be built afresh based on the UX need.
  • Sitecore renderings are created by extending Sitecore controller features.
  • Sitecore renderings may / may not adapt to Helix principles.
  • Sitecore renderings have to be assembled separately for each page.

 

Sitecore SXA Limitations

  • SXA as a module is maturing version by version. For any issues in the module we need to depend on Sitecore to provide the fixes.
  • While upgrading of SXA version, there may be a need even to upgrade the current Sitecore version and vice versa.
  • Personalization doesn’t work for the components embedded within the SXA OOTB Tab component.

SXA 1.7 and Sitecore 9.0.2 Upgrade

Direct upgrade path is available from SXA 1.6 to 1.7. To upgrade to SXA 1.7 along with Sitecore 9.0.2 on a sandbox / development environment with 7 layouts and 40-50 components will approximately requires 3 months excluding testing and validation provided components customizations are done following guidelines of SXA 1.6

Creating Custom SXA Renderings

SXA supports customizing existing OOTB renderings and creating new custom rendering.

  • Customizing Existing SXA OOTB Renderings –

https://doc.sitecore.net/sitecore_experience_accelerator/16/setting_up_and_configuring/configuring/walkthrough_building_a_new_rendering

  • Creating Custom SXA Renderings with variants –

https://doc.sitecore.net/sitecore_experience_accelerator/16/building_the_layout/renderings/build_a_rendering_that_includes_variants

If you need any help, please leave comment.

Sitecore DR Strategy

Hi Champs,

Today I am going to explain the DR strategy and Server setup for Sitecore Production Environment.

Note: Software version may vary according to your systems.

To setup the DR we need below things in place.

  1. For DR we need following Servers.
    • DR CD Server.
    • DR CM Server.
    • DR CD SQL Server.
    • DR CM SQL Server.
    • Proposed DR server for Solr and Analytics.
      • DR ANALYTICS MONGODB server.
      • DR PROD Solr Slave1 server.
      • DR PROD Solr Slave2 server.
      • DR PROD Solr Master server.
  1. Server Configurations are as below.
  • Configurations for DR CD Server and DR CM Server are as below.
      • Microsoft Windows Server OS any up to date version.
      • 16 GB of RAM.
      • 250 GB of Disk Space.
      • IIS 8 or IIS8+.
      • DR CD Server will be clone of PROD CD server.
      • DR CM Server will be clone of PROD CM server.
  • Configurations for DR CD SQL Server and DR CM SQL Server are as below.
    • Microsoft Windows Server OS any up to date version.
    • 24 GB of RAM.
    • 1 TB of Disk Space.
    • Microsoft SQL Server 2017 with Microsoft Management Studio 17.3 version.(Any Version can do)
    • IIS 8 or IIS8+.
    • DR CD SQL server will be clone of PROD CD SQL.
    • DR CM SQL server will be clone of PROD CM SQL.
  • Configurations for DR Solr Master Server are as below.
    • Microsoft Windows Server OS any up to date version.
    • 8 GB of RAM.
    • 250 GB of Disk Space.
    • IIS 8 or IIS8+.
    • It will be clone of PROD Solr Master.
  • Configurations for DR Solr Slave 1 and DR Solr Slave 2 Servers are as below.
    • Microsoft Windows Server OS any up to date version.
    • 8 GB of RAM.
    • 250 GB of Disk Space.
    • IIS 8 or IIS8+.
    • It will be clone of PROD Slaves Solr.
  • Configurations for DR ANALYTICS MONGO Server are as below.
    • Microsoft Windows Server OS any up to date version.
    • 8 GB of RAM.
    • 250 GB of Disk Space.
    • IIS 8 or IIS8+.
    • It will be clone of PROD Mongo Server.
  1. Process to Sync the DR Servers.
  • Sync up Process for SQL Servers. (DR CD SQL server and DR CM SQL server)
    • We will have the Log shipping of Database mirroring mechanism in Place.
    • This above method will perform database sync up from PROD CD SQL server to DR CD SQL server and from PROD CM SQL server to DR CM SQL server.
    • This sync up activity will be performed after scheduled intervals.
    • Log will be generated for analysis purpose of sync up process to check the failures.
  • Sync up Process for Applications Servers. (DR CD server and DR CM server)
    • Deployment tool will take care of version control.
    • It will be responsible for deployment of tested UAT code to all the PROD servers.
    • It will also deploy the code to DR CD server and DR CM server once the deployment is done on PROD CD servers and PROD CM server.
    • This deployment will be done on scheduled intervals.
  • Sync up of MongoDB servers. (PROD ANALYTICS MONGO)
    • For copying the data from PROD ANALYTICS MONGO server to DR ANALYTICS MONGO server we need create the batch process.
    • This batch process will run on scheduled interval.
    • This batch process will have a MongoDB script which will have logic to transfer all the collection to DR ANALYTICS MONGO server from PROD ANALYTICS MONGO server.
  • Sync up of Solr servers.
    • This will be a same kind of batch process scheduler as MongoDB Servers.
    • But this process will have the script which will stop the Solr Instance on all Solr DR Servers and then it will sync the index from PROD Solr server.
  1. DR Switch-Over or Failover Plan.
    • We will have the regional distance in Actual Datacenter and DR Datacenter.
    • If any Disaster happens in that case we need to configure the router to route the traffic to DR zone.
    • For this we need to add routing entries in router.
    • And for DR zone we need to have the latest up-to-date environment.
    • DNS configurations need to be set for DR.
    • Above all process needs to be automated by any routing algorithm with any Software like BigIP which needs one Manual invocation by Network DNS changes and Traffic routing changes on Router of Datacenters.

Note: If your PROD environment Datacenter is on One Geo-location then DR Datacenter Geo-location will some other region which depends on data storing policy.

You can actually check and validate and comment out it, if something is missing and which I can update.