It’s time to revisit my old blog series from a couple of years ago. I’ve blogged about ways to setup a pre-production preview environment back in 2009 and 2010. I suggest reviewing those before reading this post further, as I am not going to provide a lot of context. Since the last post, I was getting even more questions about how to set this up, so here is another take on the same problem that involves less customization, and in my book, it’s much easier to setup.
The idea is simple and rotates around the notion of running kind of a “Live mode” on separate Pre-Production Preview server.
This server will source out content from the master database instead of “pre-prod web” database. This will let you get away from using publishing, thus reducing complexity.
As a content user I should have ability to access pre production version of my website without the need to log into Sitecore authoring environment. I also need to send a link to my management before a page goes live. I want the pre production environment to show items only from specific workflow state (i.e. only items in ‘Pre-Approved’ state, but not in ‘Draft’ state).
- Workflow present and configured
- Dedicated Pre Production Preview Sitecore instance (not required but this solution, but may be a good idea if you have integration dependencies that are not present in the Authoring environment)
- ScalabilitySettings enabled (EventQueue) – needed if dedicated instance is setup.
1. Enable “LiveMode” with ‘enableWorkflow’ flag disabled and custom ‘filterByWorkflow’ flag enabled:
<site name="website"> <patch:attribute name="database">master</patch:attribute> <patch:attribute name="filterItems">true</patch:attribute> <patch:attribute name="enableWorkflow">false</patch:attribute> <patch:attribute name="filterByWorkflow">true</patch:attribute> </site>
2. Extend the “FilterItem” pipeline by adding a custom processor performing filtering by workflow state:
<pipelines> <filterItem> <processor patch:before="*[@type='Sitecore.Pipelines.FilterItem.EnsureFilteredItem, Sitecore.Kernel']" type="scLabs.PreProdPreview.Pipelines.FilterItems.FilterByWorkflowState,scLabs.PreProdPreview" /> </filterItem> </pipelines>
3. Deploy this to the Sitecore instance acting as a pre-production server (there is no need to deploy this to the Content Delivery servers).
I should mention that enabling the “FilterItem” pipeline puts extra pressure on item resolving, so if you consider implementing this on the Authoring server and it is already running out of juice, setting up a dedicated Sitecore instance would be a good idea.
Complete Solution can be found here on GitHub. Another disclaimer: though I’ve seen similar solutions working in production environments, this particular code is still experimental, so no guarantees. Carefully test this before going live with it.
Hope this is going to work beautifully for your needs. Any feedback is appreciated!