Copied to clipboard

Flag this post as spam?

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


  • Alex Mantoura 3 posts 73 karma points
    Oct 19, 2021 @ 18:12
    Alex Mantoura
    0

    Images disappear on Azure Devops build/swap - Umbraco 8.14

    Our server setup is an Azure server with 1 deployment slot and one live slot with Azure front door in front of the live slot. Media is served through Azure Blob Storage and I can confirm the images that disappear all still exist and didn't move.

    I have an Azure Devops pipeline pushing to the deployment slot. After a build I navigate to the slot first to make sure the server is warmed up and it looks good. The images are all present on the slot. I then use Devops to swap the slot to the live slot. When the swap is done, (almost) everything is gone on the live slot. The images still exist on blob storage but I just get "System.Web.StaticFileHandler.GetFileInfo: File does not exist" errors instead on the live server. This does not happen to all images, just a vast majority. If I restart the server everything comes back as if nothing was wrong. I tried deleting the examine indexes in the App_Data folder in case they were just bad files. I do have the settings outlined here for Umbraco 8

    https://our.umbraco.com/Documentation/Fundamentals/Setup/Server-Setup/azure-web-apps-v8

    <add
         key="Umbraco.Core.MainDom.Lock"
        value="SqlMainDomLock" />
    <add
        key="Umbraco.Core.LocalTempStorage"
        value="EnvironmentTemp" />
    <add
        key="Umbraco.Examine.LuceneDirectoryFactory" value="Examine.LuceneEngine.Directories.SyncTempEnvDirectoryFactory, Examine" />
    

    I also found if I swap the slots again (without restarting to "fix" the issue) the images will come back and now the deployment slot is the one that is bad. This is less consistent though.

    My issue also sounds very similar to this one, https://github.com/umbraco/Umbraco-CMS/issues/7868, but this is from 8.6 and sounds like it was resolved.

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Oct 23, 2021 @ 11:59
    Marc Goodson
    0

    Hi Alex

    How are you configuring ImageProcessor's cache? Are you storing the Cache in blob storage too? or on the local disk?

    https://our.umbraco.com/Documentation/Extending/FileSystemProviders/Azure-Blob-Storage/index-v8#using-azure-blob-cache

    When you request an image from Umbraco, the FileSystemProvider config is pointing to blob storage and storing/retrieving your image....

    ....if there are any querystring params on the request (or ImageProcessor is configured to process all image requests) then ImageProcessor 'processes the image' and stores a copy of the processed image in a cache... subsequent requests for the image are served directly from the cache...

    so I'm wondering if your cache is set to disk whether that could be mucking things up when you switch?

    When this occurs, if you request the same image that is not displaying but with different querystring parameters - does this return the image?? eg this would be a fresh processing request for the image, so if it's actioned and returns an image, it will show it's not an issue with Image Processor, but more to do with how an existingly processed image is cached.

    You can either move the cache to blob storage, or perhaps clear out the Image Processor cache on disk, if that's how you have it configured, eg /app_data/temp/cache

    regards

    Marc

  • Alex Mantoura 3 posts 73 karma points
    Oct 25, 2021 @ 14:09
    Alex Mantoura
    0

    I have the cache.config and security.config configured to use blob storage for everything (I think). I can confirm that images uploaded to Umbraco have ended up on blob storage and in the cache container, as I expected. On build, they just don't appear on the site until a restart. As a backup for now, I have moved them from blob storage back into the actual file system Media folder until I can figure out this issue though. The following are my configs and how I access the images.

    cache.config

    <?xml version="1.0" encoding="utf-8"?>
    <caching currentCache="AzureBlobCache">
    <caches>
        <cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache" maxDays="365" browserMaxDays="7" folderDepth="6" trimCache="true" memoryMaxMinutes="1">
            <settings>
                <setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key];EndpointSuffix=core.windows.net" />
                <setting key="CachedBlobContainer" value="[blob-container-name]-cache" />
                <setting key="UseCachedContainerInUrl" value="true" />
                <setting key="CachedCDNRoot" value="https://[name].blob.core.windows.net" />
                <setting key="CachedCDNTimeout" value="1000" />
                <setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key];EndpointSuffix=core.windows.net" />
                <setting key="SourceBlobContainer" value="[blob-container-name]-media" />
                <setting key="StreamCachedImage" value="true" />
            </settings>
        </cache>
    </caches>
    

    security.config

    <?xml version="1.0" encoding="utf-8"?>
    <security>
    <services>
        <service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
            <settings>
                <setting key="Container" value="[blob-container-name]-media" />
                <setting key="MaxBytes" value="8194304" />
                <setting key="Timeout" value="30000" />
                <setting key="Host" value="https://[name].blob.core.windows.net" />
            </settings>
        </service>
        <service name="AzureImageService" prefix="media/" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureImageService, ImageProcessor.Web.Plugins.AzureBlobCache">
            <settings>
                <setting key="StorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key];EndpointSuffix=core.windows.net" />
                <setting key="Container" value="[blob-container-name]-media" />
                <setting key="AccessType" value="Blob" />
            </settings>
        </service>
    </services>
    

    On the site I access images uploaded to umbraco using the MediaItem.Url() function. Some are lazy loaded, some are not, but they all end up with the same code.

    <img data-src="@blockItemContent.Image.MediaItem.Url()" alt="image" class="lazyload" />
    

    Some images used to have this wrapper

    @Url.GetCropUrl(blockItemContent.Image.MediaItem)
    

    but I unified them all to the first version when this didn't seem to make a difference.

    If I am exclusively using azure blob storage, do I need both, CloudImageService AND AzureImageService, only one of them, or is anything else missing from there?

    Lastly, (and least) Do I need the "EndpointSuffix" attribute in any of the StorageAccount settings?

Please Sign in or register to post replies

Write your reply to:

Draft