How to deploy to Azure App Service, using deployment slots, without downtime

Vote:
 

I've been using Azure DevOps Pipelines for deploying an Episerver website to an Azure App Service. 

My deployment to production goes like this:

  • Deploy to preprod deployment slot.
  • Warm up preprod, and verify that it works.
  • Swap preprod with production.
  • Verify that production works.

This works fine, and deployments can be done without affecting users. As long as there are no changes to the database schema or page types.


Because preprod and production use the same database. This does not work well when there are changes to the database schema.

When there are changes to page types and properties it does not work well either. Then I normally run two deploys right after one another, to get the new code deployed to both preprod and production.

Have anyone a solution to this problem?

#211394
Jan 07, 2020 12:42
Vote:
 

Hey Tomas,

I assume this is pure Azure and not DXC?

Have you considered using ReadOnly Database mode?

I'd say you could put the production DB in ReadOnly mode, create a preprod DB from the ReadOnly production DB, that you connect your preprod slot to, take it out of ReadOnly mode and update the DB. Once you've verified preprod, swap the slot.

https://world.episerver.com/documentation/developer-guides/CMS/Deployment/database-mode/

If this DXC, I'd recommend you speak to Episerver, as there is currently a zero downtime deployment (read-only) feature in Closed Beta. 

#215867
Edited, Jan 16, 2020 9:45
Tomas Hensrud Gulla - Jan 16, 2020 9:47
Thanks for your feedback, Darren!

You assume correct, pure Azure and not DXC.
Well, I have thought the solution may include ReadOnly database mode, but I'm not sure how to do it. I'm not sure if I follow your explanation.

Is this what you mean?
- Set production db to ReadOnly
- Create a copy of the production db.
- Deploy to preprod, use the fresh db copy from last bullet point. This database is now in ReadWrite mode.
- Verify that preprod works.
- Swap slots.
- Set preprod db to ReadWrite
- Delete, now unused, db created during the previous deploy
Darren S - Jan 16, 2020 11:33
Yes thats exactly what I mean. But you could probably set the fresh DB to ReadWrite sooner if needed (before slot swap).
Tomas Hensrud Gulla - Jan 16, 2020 11:59
Thanks.

You are correct about setting ReadWrite sooner. I actually meant to do that in my third bullet point («This database is now in ReadWrite mode»).

In my sixth bullet point, I was going to set the oldest db, the one swapped from production to preprod, to ReadWrite. I guess that is not neccessary.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.