locked
Build and deploy node app to azure RRS feed

  • Question

  • I've created a build definition on VSO to check out a node app from a git repository, run npm install, run some grunt tasks then deploy the grunt output to an Azure web app.

    The deployment part takes the form of a command line task to run msdeploy to package the grunt output folder, followed by an "Azure Web App Deployment" task to push out the created deployment.zip package to Azure.

    Can someone please advise:

    1) Is there a better way of doing this?

    2) When doing this I get an error in the Azure Web App Deployment task: 

    Unable to perform the operation ("Create Directory") for the specified directory ("wwwroot"). This can occur if the server administrator has not authorized this operation for the user credentials you are using.

    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.

    My msdeploy command line looks like this:

    msdeploy.exe -verb:sync -source:contentPath="$(Build.Repository.LocalPath)\MyNodeApp\wwwroot" -dest:package="$(Build.StagingDirectory)\deployment.zip"

    I've also tried this with \wwwroot\ (i.e. a backslash on the end)


    Sunday, October 25, 2015 4:03 PM

Answers

  • I've managed to do this by doing to following:

    1) In the azure web site config, configure the site to deploy automatically from a local git repository

    2) I have created a VS Online powershell script (below), that takes my grunt output and uses git to push the grunt output to the azure git repository created by step 1.

    Script:

    param($gitUrl)
    
    "Initialising local git repository"
    	
    git init
    
    git config core.autocrlf false
    
    git config user.email "buildagent@buildagent.com"
    git config user.name "Build Agent"
    
    git add .
    
    git commit -m "everything"
    	
    git remote add azure $gitUrl
    
    git push azure master -f

    In this script the gitUrl parameter needs to contain the username and password for the azure git repository.

    • Marked as answer by Slicc Wednesday, October 28, 2015 6:49 AM
    Tuesday, October 27, 2015 6:30 PM

All replies

  • Hi,
     I would suggest you to refer the below link it may provide you the information on Deploying an Azure webapp in Visual Studio Online:
     http://blogs.msdn.com/b/visualstudioalm/archive/2015/06/12/deploying-an-azure-web-site-using-the-new-build-system-in-visual-studio-online.aspx
     You may also refer this:
     https://azure.microsoft.com/en-in/documentation/articles/web-sites-publish-source-control/
     http://stackoverflow.com/questions/31614079/how-to-deploy-a-node-js-app-to-azure-in-visual-studio-online
     If this doesn't helps you let me know,we can explore other avenues.
     
     Regards,
     Asha
    Monday, October 26, 2015 5:19 AM
    Moderator
  • Thanks for the reply, but unfortunately I can't see anything in those links that I'm not already doing or can do further.

    The first link assumes I have a .sln file, I don't. I have written this app using VS code. This is why I am running msdeploy to package my grunt output. I guess my problem stems from this?

    I do not believe this is a credentials issue as I have managed to deploy a different app with a .sln to the same site with the approach described in the first link.

    Anything else you can suggest?

    Monday, October 26, 2015 6:15 AM
  • I've managed to do this by doing to following:

    1) In the azure web site config, configure the site to deploy automatically from a local git repository

    2) I have created a VS Online powershell script (below), that takes my grunt output and uses git to push the grunt output to the azure git repository created by step 1.

    Script:

    param($gitUrl)
    
    "Initialising local git repository"
    	
    git init
    
    git config core.autocrlf false
    
    git config user.email "buildagent@buildagent.com"
    git config user.name "Build Agent"
    
    git add .
    
    git commit -m "everything"
    	
    git remote add azure $gitUrl
    
    git push azure master -f

    In this script the gitUrl parameter needs to contain the username and password for the azure git repository.

    • Marked as answer by Slicc Wednesday, October 28, 2015 6:49 AM
    Tuesday, October 27, 2015 6:30 PM
  • https://msdn.microsoft.com/library/vs/alm/build/azure/nodejs

    You can use grunt it's self to create the package and the task will push the package for you.


    Thursday, March 10, 2016 6:27 PM