Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Örneholm 6 posts 27 karma points
    Feb 06, 2015 @ 21:16
    Peter Örneholm
    0

    Using Courier with custom FileSystemProvider

    I'm using Courier in my project where I also have a custom FileSystemProvider (that uses Azure Blob Storage).

    The "default" FileSystemProvider will store all files with a url that is relative to the current website, by default in /media/... So when media files are beeing transfered with Courier they will have the same url in the target environment (If I've understood it right).

    When using the custom FileSystemProvider the URLs returned are absolute and pointing to the storage account specified in config. In my case I have one storage account for each environment I have Courier for. I was expecting Couirier to "recalculate" the urls for the media items as part of the deployment, but it does not seem to do so. The result is that the urls will point to the storage account of the source website.

    Is there any way to force Courier to regenerate/recalculate all URL:s for the media items as part of a deployment? It would also need to do this for images in rich text editors and in the grid.

  • Paul Sterling 718 posts 1534 karma points MVP 8x admin c-trib
    Feb 06, 2015 @ 21:51
    Paul Sterling
    0

    @Peter

    You can't "force" umbraco to regenerate these, but you could easily create a custom event handler that updates the media Url to the correct one for the environment being deployed to.

    Have a look here for a good place to start:

    http://umbraco.com/follow-us/blog-archive/2011/12/12/extending-courier-2-with-a-custom-event
    https://github.com/umbraco/Courier ;

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 02, 2017 @ 14:40
    Jeroen Breuer
    0

    Hi Peter,

    Did you ever got Azure Blob Storage working with Courier?

    Jeroen

  • Peter Örneholm 6 posts 27 karma points
    Oct 03, 2017 @ 06:54
    Peter Örneholm
    1

    No, it would probably have worked with implementing the event as proposed, but in this case we choosed to deploy to on premises instead.

    Recently I've been deploying Episerver sites to Azure using Blob Storage as storage for media, and they have a much better approach to media URLs as they are resolved on the fly (while still being cached).

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 03, 2017 @ 07:29
    Jeroen Breuer
    0

    Thanks for the update. Will try if it's possible with an event. Would have been nice if someone already had an example event for this ;-).

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 02, 2017 @ 15:25
    Jeroen Breuer
    0

    In our situation there is 1 blob storage for 2 environments. The content and media can be transferred between environments. Since the media has the same blob storage nothing needs to change, but instead the media is created in the media folder on the other environment.

    The same issue is reported here: https://github.com/umbraco/Courier/issues/14

    Jeroen

  • Bartosz Ladziński 20 posts 154 karma points
    Oct 03, 2017 @ 08:59
    Bartosz Ladziński
    0

    This is a long known issue, where Courier completely disregards the FileSystem that your Umbraco instance uses. Courier doesn't use the same interface as Umbraco for handling file system, so to fix this, large parts of Courier need to be rewritten.

    I'm working on a custom solution right now, if you use Blob Storage of Azure you could implement it on your own, too. The idea is to use the Shared Access Signatures described here: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-dotnet-shared-access-signature-part-2

    I'm generating a connection string that I want to package together with the media file I'm transferring. Then when extracting, I want to create a temporary blob service that finds the file you've just couriered and then copies it to the actual blob storage of your environment.

    In theory, this should work. In practice, I'm trying to find the best way to actually package the connection string when Couriering, so far I know the resources and dependencies are not the way to go, so I'm probably going to manipulate the data of the property instead, unless there's another way to package custom data when Couriering - ugly but should do the trick. Couldn't find anything in the Courier documentation, but it's a bit lacking.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 03, 2017 @ 09:04
    Jeroen Breuer
    0

    Sounds like a good solution. In our situation both environments use the same blob storage so nothing needs to be transferred. Still Courier should not transfer the file to the regular media folder.

    Is your custom solution available somewhere?

    Jeroen

  • Bartosz Ladziński 20 posts 154 karma points
    Oct 03, 2017 @ 09:20
    Bartosz Ladziński
    1

    Not really, it's just something I'm working on right now as a workaround.

    To prevent the default behaviour of copying the images to media folder I think you can just remove/comment out the elements within <mediaPickers> in the courier.config file. That way Courier should use the default packaging for your pickers (data only) without adding the files as resources as it does for media items.

    I'm using custom pickers within my solution (not the Umbraco.MediaPicker) and Courier does not transfer the media files for me and, I'm just guessing here, the reason is my pickers not being included in the courier.config and therefore being packaged the 'regular' way.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 04, 2017 @ 13:24
    Jeroen Breuer
    0

    Since our environments are using the same blob storage it seems all we need to do is not transfer the physical media. So when you transfer content with courier just uncheck media in files to be deployed. After that the media on the other environment just works.

    Jeroen

  • Bartosz Ladziński 20 posts 154 karma points
    Oct 12, 2017 @ 16:06
    Bartosz Ladziński
    2

    If anyone's interested, I've managed to get this working the way I've described it above.

    Basically, I've created new DataResolverProvider for Image Cropper and on PackagingProperty I generate the SAS URI for only that one Blob and then add it to a fake property on the image. Then in ExtractingProperty this fake property is read and a CloudBlockBlob is created using the sent SAS URI. After that it's basically just downloading the image from the Blob and uploading it to the actual Container that the Umbraco instance uses.

    The extraction step should probably be delegated somewhere (I delegated it to a worker project) so that it doesn't put load on the CMS and slow down the Couriering.

  • Shubhashini 2 posts 72 karma points
    Apr 03, 2018 @ 10:47
    Shubhashini
    0

    Hi Bartosz,

    I m struggling on this Courier issue where media files are not getting stored on Azure Blob. Can u plse share the solution , which u have tried.

  • Matt Barlow | jacker.io 164 posts 740 karma points c-trib
    Dec 20, 2018 @ 15:07
Please Sign in or register to post replies

Write your reply to:

Draft