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.
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
Post a Comment