简体   繁体   English

自动天蓝色部署

[英]Automatic azure deployment

We've developed a MVC application that uses a SQL database to store data. 我们已经开发了一个MVC应用程序,该应用程序使用SQL数据库存储数据。 We chose the approach to have a separate web app in azure (customer.ourdomain.com) per customer, as well as a separate database per customer running on our SQL server. 我们选择的方法是,每个客户在azure(customer.ourdomain.com)中都有一个单独的Web应用程序,以及在我们的SQL Server上运行的每个客户一个单独的数据库。 This database is pointed to by the MVC application in the web.config file. MVC应用程序在web.config文件中指向此数据库。

I've also created a website where new customers can register to use / try our product. 我还创建了一个网站,新客户可以在此注册使用/试用我们的产品。 Now every time somebody registers for our product I want the following to happen: 现在,每次有人注册我们的产品时,我都希望发生以下情况:

  • Create an Azure web app with the name of the company / customer that registers 使用注册的公司/客户的名称创建一个Azure Web应用
  • Create a new database including the tables and relationships that our application needs 创建一个新的数据库,其中包括我们的应用程序所需的表和关系
  • Publish the stable release of our application to the web app in azure and configure the application to use the newly created database 将我们的应用程序的稳定版本发布到Web应用程序中,并将其配置为使用新创建的数据库

I've managed to do the first step using Azure ARM templates and the second step using dacpac and the Azure API, but I don't know how to use TFS (or any other method) to publish a stable release and change the connection strings before publishing the application to the azure app. 我已经设法使用Azure ARM模板完成了第一步,并使用了dacpac和Azure API完成了第二步,但是我不知道如何使用TFS(或任何其他方法)发布稳定的版本并更改连接字符串在将应用程序发布到Azure应用程序之前。 (I've not even managed to publish anything with C# code). (我什至没有设法用C#代码发布任何东西)。

Is the approach I'm taking in general okay or should I take a different approach? 我通常采用的方法还可以吗?还是应该采用其他方法? What is the best way to publish a stable release to the web app and most importantly, change the connection string so the published version will connect to the new database? 将稳定版本发布到Web应用程序的最佳方法是什么,最重要的是,更改连接字符串,以便发布的版本将连接到新数据库?

If you get vsts to package up your stable release and upload it to blob storage, you can reference that web app as part of the ARM template deployment, ie. 如果您获得vsts打包稳定的发行版并将其上传到Blob存储,则可以将该Web应用程序作为ARM模板部署的一部分进行引用,即。 include the web app code deployment along with the web app service itself. 包括网络应用程序代码部署以及网络应用程序服务本身。

This page shows how it can be done. 此页面显示了如何完成。 I think you can also get the web app and ARM template to pull a release from vsts (I'm pretty confident you can do it via GitHub) using the app service's source control integration/CD settings as well, but cant find any details on this. 我认为您也可以使用应用程序服务的源代码控制集成/ CD设置来获取Web应用程序和ARM模板以从vsts(我很确信您可以通过GitHub来完成)中发布版本,但是找不到有关的详细信息这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM