cms · processor · storage

Storing Sitecore media assets on the file system and how to get synced at your machine

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

Setup Prerequisites

How to set it up

  1. 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
  2. Install Microsoft Sync Framework 2.1 Software Development Kit (SDK)
  3. Copy-paste \App_Config\ConnectionStrings.config of CA to overwrite the one of CD to make sure 02 Sitecore instances using the same databases
  4. Install Vhs.SyncMediaFolderProcessor Sitecore package to CA via Installation Wizard
  5. 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)
      • smp_1.png
    • Vhs.SyncMediaFolderProcessor.TargetSyncMediaFolderyour fullpath CD‘s media folder (it’s \App_Data\MediaFiles by default)
      • smp_2

Note: there are 02 patching configs in \App_Config\Include\z.Vhs.SyncMediaFolderProcessor.config as well

  1. Enabling storage of media as files rather than database records
    • smp_6
  2. 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)
    • smp_7

How to verify it

  1. Log into CA Sitecore
  2. Upload a media file successfully and make sure File Path field has data like this
    • smp_3
  3. Look at \App_Data\MediaFiles of CA, you should see something like this
    • smp_4.png
  4. Back to CA Sitecore then publish that media item successfully
    • smp_8
  5. Look at \App_Data\MediaFiles of CD, you should see something like this
    • smp_5
  6. Log into CD Sitecore, you should see something like this
    • smp_3

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s