0
votes

Let's say I have an Azure App Service web app at foo.azurewebsites.net. The code for the web app (a simple Node.js server and React frontend) is hosted on VSTS, and a custom deployment script is configured build and deploy the web app every time code is pushed to the repository's master branch. In other words, the standard web app configuration.

Now, all of my API code (just a Node.js server) is in another repository on VSTS. I'd like to be able to do the following:

  1. Have all requests to foo.azurewebsites.net/api be handled by the API server (an implication of this, which I would nonetheless like to state explicitly, is that the server can ask the browser to set cookies that the web app can then read, and vice versa).
  2. Set up similar continuous deployment for the API server, such that it gets redeployed whenever there are code changes in the API repo.
  3. Be able to maintain the web app and API repositories completely separately.

This seems like a fairly standard scenario...is there an accepted solution? I came across this, but it seems like a pretty hacky way to do it, not to mention the fact that I have no idea what the correct URL is for the web hook for VSTS and can't seem to find any information on it. Also, that example doesn't cover how to deal with point (1) above.

EDIT: Additional clarification

Note that the accepted answer on this question is not what I'm looking for. It describes how to pull from a second repository at deployment time, but not how to have that second repository trigger deployments, or how to handle the fact that the the second repository is its own server. Additionally, it introduces a dependency between the two repositories, since the deploy.cmd is presumably under source control in the first repository.

EDIT: Virtual Directories

Thanks to @CtrlDot for pointing out that Virtual Directories are the way to solve (1). Still seeking guidance on (2) and (3).

1

1 Answers

2
votes

I think the concept you are referring to is called Virtual Directories

I'm not sure which VSTS task you are using to deploy, but based on the article provided, you should be to configure it to target only the virtual directory you want to deploy to.

EDIT

Sorry for not being more clear. The AzureRmWebAppDeployment task has a parameter for virtual application name. You would simply set that in your deployment pipeline for the API project (/api) and for the main project (leave it blank)