1
votes

I'm using the ASP.NET Core & Angular startup template from ASP.NET Boilerplate with Multi-Tenancy disabled: 1 database with a single tenant(Default).

I'm also using TeamCity to build/test/publish the projects available in the startup template so I end up with 3 NuGet packages that are getting pushed to Octopus Deploy:

  1. API (Host project, ASP.NET Core Web Application)
  2. Migrator (Console application, capable of migrating the database(s))
  3. UI (Angular App)

I want to deploy this setup to Azure with Octopus Deploy(self hosted, v2018.9.0) in the following way using 2 App Services(Host & UI) and 1 Azure SQL database(Host):

  1. Take the UI and API applications offline, displaying a friendly maintenance message while updating the projects.
  2. Migrate the database using the Migrator package
  3. Deploy the API application package
  4. Deploy the UI application package
  5. Put the API application online, maybe some more tests to check that it's working correctly
  6. Put the UI application online.

If all this was on-prem, I would have no questions. It's the Azure part that I can't figure out because I don't know how to do these things on Azure via Octopus Deploy:

  1. Put an Azure App Service offline/online (using an app_offline.htm file)
  2. Deploy the Migrator package to the API Azure App Service in a special folder(so that I don't overwrite the API deployment) and run the migrator: dotnet [migrator.dll] -q

I tried using the Octopus Deploy "Deploy an Azure Web App" but this step won't let me also deploy the migrator package and run it before the API package is deployed. Or does it? I don't know how.

I tried using the "Run an Azure PowerShell script" but this executes on the Octopus Deploy server and not on the Azure App Service environment right?

Maybe there are other, even better, approaches deploying this setup to Azure?

1
Are you trying to make simple schema updates to your database while keeping the data or are you bringing a whole new db? Are you going offline by choice because with App Services you could deploy and update without ever going offline.Simon Bourdeau
Simple schema changes, it's EF Core using migrations. When I update the database(before the API is updated), it can cause issues with the API project not updated yet right? E.g. column renames etc. As I understand when deploying a new version of a Web App it's a new instance right? So no need to go offline indeed if the schema changes are backwards compatible, but what if they aren't?Jorg
As a rule of thumb I don't make schema changes that are not backwards compatible on a production load db.Simon Bourdeau

1 Answers

0
votes

You can use App service slots to swap in/out version of your logical applications. When you swap there's a warming up that occurs and no loss of traffic.

So basically deploy to backup slot, then swap production with backup slot.

For the db I don't think your strategy is valid. There are some assumptions you are making that will not make your life easy. I would look at handling the db deployment separately with no breaking changes but that's my opinion.

I'm not familiar with Octopus or TeamCity so I won't go into details about those.