12

Is it possible to configure the Deployer to place a published Binary in 2 locations?

I have two development DD4T sites pointing at the same publication. One is a feature branch essentially.

I would like to have the Deployer place the Binaries in both.

I have tried the following:

Adding a second element with a different Id

<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile" defaultFilesystem="false">
    <Root Path="c:\inetpub\wwwroot\phase1" />
</Storage>
<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile2" defaultFilesystem="false">
     <Root Path="c:\inetpub\wwwroot\phase2" />
</Storage>

Then tried adding a second Item element to my Publication element.

<Publication Id="9" defaultStorageId="defaultdb" cached="true">
    <Item typeMapping="Binary" storageId="defaultFile" cached="true"/>
    <Item typeMapping="Binary" storageId="defaultFile2" cached="true"/>
</Publication>

This results in the item being placed in defaultFile2. I'm guessing because it's a Hashmap or similar internally.

I also tried adding a second element to the storage element like:

<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile" defaultFilesystem="false">
         <Root Path="c:\inetpub\wwwroot\phase1" />
         <Root Path="c:\inetpub\wwwroot\phase2" />
</Storage>

This has similar results, with the item being placed in Phase2 but not Phase1

Then I tried having two Publication elements:

<Publication Id="9" defaultStorageId="defaultdb" cached="true">
    <Item typeMapping="Binary" storageId="defaultFile2" cached="true"/>
</Publication>

<Publication Id="9" defaultStorageId="defaultdb" cached="true">
    <Item typeMapping="Binary" storageId="defaultFile" cached="true"/>
</Publication>

Again this results in the item being placed in whatever the second mapping is.

Am I barking up the wrong tree here?

I thought about MkLinking the folders, but I have a subfolder _images/css which is not published and is different for each phase.

I don't want to use Blueprinting to solve the problem as this is not the direction I wish the project to take.

Any ideas apart from running a batch script every few minutes to robocopy everything?

12

The answer seems to be "add two deployers". However, I found a relatively simple solution to my problem using IIS virtual directories:

Create a new folder like below and have the Deployer configured to deploy to this location

  • Website.Phase1
    • _images – folder configured to have Binaries deployed
      • css - contains the CSS images for Phase 1
  • Website.Phase2
    • _images – virtual directory to C:\inetpub\wwwroot\website.phase1\_images
      • css – virtual directory to C:\inetpub\wwwroot\website.phase2\_images\css

This may not work for everyone's situation but certainly works for me.

Edit: I've adjusted the answer as I realised I didn't need the seperate folder.

4

To achieve this you can simply use two deployers. As you know, there are various options for this, but perhaps the simplest is just running two upload sites with different configurations.

4

This matches up with what I experienced about a month ago when I did the same sort of testing. When you have 'conflicting' entries in cd_storage_conf.xml, the last configured entries are the ones which are used by the system.

When I asked a similar but slightly different question Is it possible to configure Tridion’s deployer to send one ItemType to multiple storage types? I recieved some pretty good answers with two ways to solve this issue: Writing a deployer extension or a custom storage layer.

Mihai Cădariu's blog posting Writing to Multiple File Systems from the Same Deployer would seem to directly address your situation (thanks to Jan H. for pointing this article out to me.)

Edit: One thing to consider that may be easier for your specific situation is using Microsoft's DFSR functionality.

Just publish all the binaries to the c:\inetpub\wwwroot\phase1 directory and then setup DFSR to replication the contents of that folder to the c:\inetpub\wwwroot\phase2 directory. You will need to exclude your _images\css folder from the replication set.

3

Looks like you have tried all possible options already, with similar (expected) results. I seem to remember somebody asking it before once, and if I remember correctly the answer was no indeed.

Which means your options would be writing a Storage Extension to duplicate the item, or duplicating it using something like robocopy.

  • 4
    What about cloning the deployer web app and add it as a new Destination in the Publication Target properties? You then have an identical copy of your deployer, but this second deployer only takes care of storing binaries in a different location. – Philippe Conil Apr 11 '13 at 16:31
  • That sounds like it might work indeed – Bart Koopman Apr 11 '13 at 16:43
3

Maybe another solution: you can keep only one single deployer and configure replicated folders (DFSR Replicated Folders on Windows 2008 R2).

Or you can also use external tools to keep these folders synchronized (Windows File Replicator, Syncback, etc...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.