How to achieve zero downtime in an Azure web application with a database upgrade?

I am trying to achieve zero downtime for an Azure web application, where database schema schemas must be used as part of the deployment.

I have the following setup:

Create a web application with the string production-db .

Split deployment using staging-db string.

My pseudo deployment process is something like:

  • Make a copy of the production-db database
  • Set up a Simple slot to use a copy of the database
  • Deploy the code in a simple slot
  • Apply schema updates to a copy of the database
  • Test the application in the Staging slot (with an updated database) and pre-heat it.
  • If everything works, do a hot swap so that the preheated application in the Staging slot continues to work, i.e. becomes a production slot, still using updated database

In other words, after a hot swap, I want both the new code and the updated database to be live.

If something goes wrong at this moment, I can simply swap the slots by making the old production application (and its database) live.

As I understand it, now when I change the slots, the application will use the connection line of the production slot, restarting the application and forcing me to apply database schema updates after updating the updated code.

I hope I described it correctly. :) It seems that this should be a fairly common scenario?

Any help or pointers are appreciated!

PS. I looked at Azure unchanged when the database schema changes , but this answer is not valid since I can't apply schema updates without affecting the application.

Edit: Just a thought: maybe I should skip setting the connection string as a portal parameter, and instead just save it to web.config. Thus, during the replacement, the application will not restart, and since web.config will be included in the swap, the new production slot will use the updated database.

Edit 2: I think I made a mistake in reloading the application when the application settings or connection strings differ between the slots. It seems that I really can establish a different connection string (pointing to a copy of the database) for the deployment slot, and then swap without restarting the application, affecting website visitors.

+5
source share
1 answer

Could you make the connection string sticky in the slot?

enter image description here

Details here .

0
source

Source: https://habr.com/ru/post/1260240/


All Articles