configuration - Azure Web App deployment slots with database migration -


i'm running webapp several deployment slots (e.g. dev, staging, production). every slot connected database (db_dev, db_staging, db_production). want deploy staging slot , switch production. how database migrations fit in here?

i mean, if deploy new build db migrations staging db_staging gets updated. happens if switch slots? migrations applied db_production? downtimes?

from understanding urls switched, after switch app in staging slot point db_production? not make sense.

i deploy staging slot , point db_production (with migrations), db updated , possibly break app in live slot.

instead of hard coding connecting string in source code, put them under connecting strings section of app service settings , access environment variable. it's not safer allow have 1 code environment , checking setting "slot setting" no matter if swap or not, slot, configuration remains fixed.

enter image description here

more info here:

https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/

update:

in case of database update, i.e, necessary scripts need run in order update database schema new app version, can use applicationinitialization section of web.config. used warm-up app, should work case well.

<system.webserver>     <applicationinitialization >       <add initializationpage="/init-script.php" hostname="xxxxxx.azurewebsites.net"/>     </applicationinitialization>   <system.webserver>  

the appinit module wait until code completes before finishing swap process allowing production traffic app. basic logic checking if database running expected version , if not other logic executed in sequence.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -