mac azure git_从一个Git存储库将两个网站部署到Windows Azure

mac azure git

mac azure git

Deploying to Windows Azure is very easy from Git. I use the Azure Cross-Platform Command Line (open source on github, written in node) that I get from npm via "npm install azure-cli --g" to make the sites.

从Git部署到Windows Azure非常容易。 我使用通过“ npm install azure-cli --g”从npm获得的Azure跨平台命令行(github上的开放源代码,在节点上编写)来制作站点。

When you make a new site with the Azure command line, you'll usually do this:

当您使用Azure命令行创建新站点时,通常会执行以下操作:

azure site create --location "West US" MyFirstSite --git

And the tool will not only make the site, but also add a git remote for you, something like https://username@MyFirstSite.scm.azurewebsites.net:443/MyFirstSite.git. When you push to that git remote, Azure deploys the site. You can git push sites with PHP, node, ASP.NET, and Python.

而且该工具不仅可以创建站点,还可以为您添加一个git远程站点,例如https://username@MyFirstSite.scm.azurewebsites.net:443 / MyFirstSite.git 。 当您推送到该git远程时,Azure会部署该站点。 您可以使用PHP,node,ASP.NET和Python git push网站。

Two Deployments in Azure using Git

You may have multiple remotes with your git repository, of course:

当然,您的git仓库可能有多个遥控器:

C:\MyCode>git remote show
azure
origin

When you push a folder with code to Azure via Git, unless you're pushing binaries, Azure is going to compile the whole thing for you when it gets pushed. It will restore npm modules or restore NuGet packages, and then build and deploy your app.

当您通过Git将包含代码的文件夹推送到Azure时,除非您推送二进制文件,否则Azure在推送时会为您编译整个内容。 它将还原npm模块或还原NuGet软件包,然后构建和部署您的应用程序。

If your repository has a lot of .NET projects, you usually only want one project to be the actual deployed website, so you can add a .deployment file to specify which project contains website you're git deploying:

如果您的存储库中有很多.NET项目,则通常只希望一个项目成为实际部署的网站,因此您可以添加.deployment文件以指定哪个项目包含您正在git部署的网站:

[config]
project = WebProject/MyFirstSiteWebProject.csproj

However, in lieu of a .deployment file, you can also set an application configuration setting with the Azure Portal to to the same thing.

但是,代替.deployment文件,您还可以将Azure门户的应用程序配置设置设置为相同。

Setting Kudu Projects with Config options

Or, of course, set the configuration values for each site using the Azure Command Line:

或者,当然,使用Azure命令行为每个站点设置配置值:

c:\MyCode>azure site config add Project=WebProject/MyFirstSiteWebProject.csproj [sitename]

What's nice about setting the "Project" setting via site configuration rather than via a .deployment file is that you can now push the same git repository containing two different web sites to two remote Azure web sites. Each Azure website should have a different project setting and will end up deploying the two different sites.

通过站点配置而不是通过.deployment文件设置“项目”设置的好处是,您现在可以将包含两个不同网站的同一git存储库推送到两个远程Azure网站。 每个Azure网站应具有不同的项目设置,并且最终将部署两个不同的网站。

Git Deploying from one Repo to two separate Azure Web Sites

I do this by setting the git remotes manually like this, using the correct git remote URLs I get from the Azure Portal:

通过使用从Azure门户获得的正确git远程URL手动设置git远程,可以做到这一点:

C:\MyCode> git remote add azureweb1 https://scott@website1.scm.azurewebsites.net:443/website1.git
C:\MyCode> git remote add azureweb2 https://scott@website2.scm.azurewebsites.net:443/website2.git
C:\MyCode> git remote show
azureweb1
azureweb2
origin
C:\MyCode> git push azureweb1 master

I have a number of solutions with two or more web sites, or in one case, a web site I want separate from my web api, and I deploy them just like this.

我有许多具有两个或多个网站的解决方案,或者在一种情况下,是我想要与Web api分离的网站,因此我就这样部署它们。

Hope this helps!

希望这可以帮助!

翻译自: https://www.hanselman.com/blog/deploying-two-websites-to-windows-azure-from-one-git-repository

mac azure git

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值