6

I tried the Static website feature for Blob Storage in Azure and it is great!! Just copied my SPA static files (js, html, css, ...) and everything worked. Now to my question: how can I update the files and make sure that they are consistent?

With App Services I could use deployment slots and swap them when they are ready. If I just copy a new version the clients could get an inconsistent version (some files from the older one, some others from the new one).

This would be a huge problem for my .js files. Can I use something like a transaction that will make my files visible just when all of them were copied?

2 Answers 2

3

Consider creating another Storage Account that represents a staging environment and use Azure Traffic Manager to implement a swap.

This will also allow you to perform a blue-green deployment where you can send only a few user (lets say 1%) to your new deployment...

5
  • 1
    Yeah, I'd say TM is one of the options for this. Have to keep in mind the time-to-live of the DNS responses from TM though. So someone who accessed the page would access that version for as long as the TTL is.
    – juunas
    Nov 6, 2018 at 10:03
  • Perhaps instead of TM, consider Cloudflare. Then you don't have to deal with the latency of a DNS update when you swap your blue-green deployments.
    – Rob Reagan
    Nov 6, 2018 at 14:14
  • 1
    Thank you Martin!! This means adding yet another service to my deployment. I liked the idea of using Azure Storage for my SPA assets and Azure Functions for my "business logic" (at least for some small things). I will accept your answer if nobody has another one.
    – Raul
    Nov 8, 2018 at 11:34
  • @Raul How did you manage to get the traffic manager to work with static websites? Whenever I route traffic through the traffic manager to the static website I get an "The request URI is invalid." error by the storage account.
    – JoCa
    Sep 6, 2019 at 14:40
  • Hi @JoCa, we didn't implement it in production as today. We continue to use "classical" App Services that host the static files as well and use the normal deployment slots. Maybe we will reconsider it later or wait for the functionality to be added to Azure.
    – Raul
    Feb 10, 2020 at 8:44
0

For those that can't find how to setup the Azure Storage Account with Traffic Manager like I could not, here:

Setup the traffic manage endpoint as a External endpoint, then add the storage account's FQDN found on the static website page. Then set the custom domain of the storage account to the traffic manager's DNS name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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