This post is to present an approach for storing Sitecore media assets on the file system and how to get synced between CA and CD at your machine (another one is Microsoft Web Deployment tool). However, it might be an initiative of your own approach.
Assumptions
- Storing Sitecore Media Assets on the File System
- Using Microsoft Sync Framework 2.1 to synchronize data
- Creating a Sitecore custom processor which would be executed after Sitecore Publish Process Queue Processor so that the publishing process looks natural (the publishing dialog should wait for the sync completed before closing)
Setup Prerequisites
- Sitecore 8.2 Update 2
- Microsoft Sync Framework 2.1 Software Development Kit (SDK)
- Vhs.SyncMediaFolderProcessor Sitecore package
How to set it up
- Use SIM to setup 02 new Sitecore 8.2 Update 2 instances:
- 01 CA whose site name should be viethoang.ca.local
- 01 CD whose site name should be viethoang.cd.local
- Install Microsoft Sync Framework 2.1 Software Development Kit (SDK)
- Copy-paste \App_Config\ConnectionStrings.config of CA to overwrite the one of CD to make sure 02 Sitecore instances using the same databases
- Install Vhs.SyncMediaFolderProcessor Sitecore package to CA via Installation Wizard
- Open \App_Config\Include\z.Vhs.SyncMediaFolderProcessor.config and update 02 Sitecore settings:
- Vhs.SyncMediaFolderProcessor.SitecoreMediaFolder: your fullpath CA‘s media folder (it’s \App_Data\MediaFiles by default)
- Vhs.SyncMediaFolderProcessor.TargetSyncMediaFolder: your fullpath CD‘s media folder (it’s \App_Data\MediaFiles by default)
- Vhs.SyncMediaFolderProcessor.SitecoreMediaFolder: your fullpath CA‘s media folder (it’s \App_Data\MediaFiles by default)
Note: there are 02 patching configs in \App_Config\Include\z.Vhs.SyncMediaFolderProcessor.config as well
- Enabling storage of media as files rather than database records
- Patching SyncMediaFolderProcessor after Sitecore Publish Process Queue Processor so that the publishing process looks natural (the publishing dialog should wait for the sync completed before closing)
How to verify it
- Log into CA Sitecore
- Upload a media file successfully and make sure File Path field has data like this
- Look at \App_Data\MediaFiles of CA, you should see something like this
- Back to CA Sitecore then publish that media item successfully
- Look at \App_Data\MediaFiles of CD, you should see something like this
- Log into CD Sitecore, you should see something like this
Not Good Enough? Please feel free to download the source code and add your own enhancements if necessary.
Got issues?
Please send your issues (with screenshots if possible) to viet.hoang.sitecore@gmail.com so that I have a chance to understand your problem and be able to suggest the solution.
Happy Sitecore Coding!
REFERENCES