Pages

15 March, 2022

Job Plugin - Sitecore CLI Plugin - Sitecore Hackathon 2022

Sitecore Hackathon is a community driven event and we (Sitecore Warriors) chose idea Extend Sitecore CLI.

We chose many ideas and finally ended up completing Job related plugin. 

This Sitecore Job plugin will enable developers/admins to
  1. View currently running, queued and finished jobs. Also lists configured Sitecore Database jobs.
  2. Execute Sitecore Database jobs on-demand
  3. Rebuild the Link database
There are two parts in developing a Sitecore CLI Plugin. 
  1. Plugin (published in nuget.org)
  2. Sitecore Management Service to initiate the action in Sitecore Context.

Installation instructions:
  1. Sitecore instance (10.2) with Sitecore Management Services package installed. Setup a project folder in your workstation. Install and initiate the Sitecore CLI as mentioned in this document. 
  2. As part of this job plugin, we have created a management service which can receive the request from the CLI and execute the action in Sitecore. The management service package is placed here. This package can be installed using Sitecore Installation Wizard. 
  3. To install the job plugin, Sitecore has provided a plugin called plugin. You can pass on the plugin name along with add subcommand. Please note that this plugin is already published to nuget.org here. 
    dotnet sitecore plugin add -n SitecoreWarriors.DevEx.Extensibility.Jobs
  4. To verify whether job plugin has been installed successfully, you can run dotnet sitecore job -h. 
Usage:
dotnet sitecore job [subcommand] [options]
Subcommands:

You can use the following subcommands:
  1. list - Get all jobs list (running, queued, finished and db task jobs). Db task can be started on-demand.
  2. rebuildlinkdb - Start rebuilding a link db.
  3. start - Start a DB task.
Options:

You can use the following options with the list subcommand:

Option Explanation
-c, --config (config) Path to root sitecore.json directory (default: cwd)
-v, --verbose Write some additional diagnostic and performance data
-t, --trace Write more additional diagnostic and performance data
-?, -h, --help Show help and usage information

You can use the following options with the start subcommand:

Option Explanation
-c, --config (config) Path to root sitecore.json directory (default: cwd)
-j, --job-name (job-name) Mention DB Task Schedule Name from Listing.
-v, --verbose Write some additional diagnostic and performance data
-t, --trace Write more additional diagnostic and performance data
-?, -h, --help Show help and usage information

You can use the following options with the rebuildlinkdb subcommand:

Option Explanation
-c, --config (config) Path to root sitecore.json directory (default: cwd)
-db, --database (database) Mention DB name for rebuilding the link DB (default: master)
-v, --verbose Write some additional diagnostic and performance data
-t, --trace Write more additional diagnostic and performance data
-?, -h, --help Show help and usage information

Demo:

dotnet sitecore login
  • Install the job plugin.  
    dotnet sitecore plugin add -n SitecoreWarriors.DevEx.Extensibility.Jobs


  • Get the list of commands in job plugin.  
    dotnet sitecore job -h


  • To view the list of running, queued, finished and DB tasks.  
    dotnet sitecore job list


  • To start a DB task. The last run changes once the job gets executed.
    dotnet sitecore job start -j {JobName}


  • To rebuild the link database.
    dotnet sitecore job rebuildlinkdb -db master


Sitecore CLI is a powerful tool to automate admin tasks and integrate it as part of DevOps. Since additional plugins can be added easily, this tool can integrate not only with Sitecore XM/XP, it can be leveraged for other Sitecore product family with few customization. 

14 March, 2022

Our Sitecore CLI Extension Ideas - Sitecore Hackathon 2022

Sitecore Hackathon is a community driven event and for this year 2022, the ideas were

  1. Build an e-commerce Minimum Viable Product to sell community t-shirts 
    • The submission must include the following technologies: 
      1. Sitecore XM - Rendering host (.net or jss)
      2. Sitecore Send
      3. Sitecore Order Cloud
  2. Extend the Sitecore Command Line Interface (CLI) plugin 
    • https://doc.sitecore.com/xp/en/developers/102/developer-tools/sitecore-command-line-interface.html
  3. Best addition to the Sitecore MVP site 
    • https://github.com/Sitecore/MVP-Site

We, Sitecore Warriors, chose Idea 2 - Extend Sitecore CLI Plugin. 

We came up with multiple ideas to create a plugin as a Dev Collection. Our ideas were

  1. View Running, Queued and Finished jobs
  2. Rebuild Link Database
  3. Start a Sitecore DB Task
  4. Run a PowerShell Report and export an excel
  5. Cache Tools
    1. View Statistics
    2. Clear Cache
  6. View ShowConfig of CD environment
  7. View Sitecore System Performance
  8. Run an Audit to find any commonly known vulnerabilities
  9. Create Anti-Package
  10. View License Details 
Finally we ended up creating only top 3 items in the above list. 

Our submission link: https://github.com/Sitecore-Hackathon/2022-Sitecore-Warriors. Unfortunately we did not allocate time to record a video properly (😉)

Forked: https://github.com/nehemiahj/2022-Sitecore-Warriors


18 February, 2022

Sitecore Managed Cloud App Service Environment (Medium size) missing Experience Editor Optimization Strip (bug)

We started Sitecore Content Testing recently. It is a Sitecore Managed Cloud Environment - App Services. Once the Content Testing configurations were enabled and created a sample test, we found that Experience Editor Optimization Strip was missing. First we thought that we didn't enable certain configuration for Content Testing. Looking at the core DB, the Strip item (/sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Optimization) was missing. 


We had 4 Sitecore managed cloud instances. 2 Extra Small and 2 Medium type. Only in Medium type environments, the optimization Strip was missing. 

To make sure that we do not miss any other items in the core DB, I created a Sitecore Support Ticket. Initially they mentioned that there is no issue with the environment provision script. Also they mentioned that they provisioned a test environment but Optimization Strip was present. 




In the meanwhile, I used Razl tool to compare a Vanilla Sitecore instance and the affected instance and found out that only this Strip and the sub items were missing. I moved it from Vanilla instance and Optimization tab worked as expected. I created a package if you need it. 

Since I stressed that both the Medium type environments provisioned by Sitecore Managed Cloud have the same issues, they checked it and were able reproduce the issue in their test environment. Sitecore Support has registered a bug in their bug tracking system and provided a reference number -519238.
blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }