Deploy NodeJS app to Azure from VS Code - node.js

Created simple nodejs app in VS Code (Linux). Also created NodeJS app in Azure. How to deploy app from VS Code to this Azure app now? AZ CLI installed. I've downloaded some MyApp.PublishSettings file however seems it used in VS not VS Code. What is the best way to deploy then with or without git (github)?

Local Git deployment from command line (or VS Code terminal):
git remote add azure https://<username>#<app_name>.scm.azurewebsites.net/<app_name>.git
git push azure master
If empty application already there use force flag:
git push azure master -f
Useful links deploying Bot Framework To Azure On Linux:
https://code.visualstudio.com/tutorials/nodejs-deployment/deploy-website
https://blog.botframework.com/2017/04/27/Deploying-Botframework-To-Azure-On-Linux/
P.S. Could be outdated since 2017.

Related

Could not auto-detect the runtime stack of your app - Azure webapp up

I am following this tutorial on how to create a HTML web app within Azure
When I enter the az webapp up command I receive the error:
Could not auto-detect the runtime stack of your app, see 'https://go.microsoft.com/fwlink/?linkid=2109470' for more information
The version of Azure CLI I'm running is:
azure-cli 2.0.78 *
command-modules-nspkg 2.0.3
core 2.0.78 *
nspkg 3.0.4
telemetry 1.0.4
Extensions:
azure-devops 0.16.0
Any help with this would be much appriciated!
I ran into the same problem and it looks like there is a problem with static html site. Today version 2.0.79 was released and it supports an --html flag. At least my app is now working.
The tutorial guide you use the Azure Cloud Shell to deploy it, but as you know the CLI in the Cloud Shell is version 2.0.78 and it does not support the parameter --html and you also cannot upgrade the CLI in the Cloud Shell.
The parameter now is only supported in version 2.0.79. So the solution is to install the CLI in your own environment. Follow the steps here to install the CLI then it will work well with the parameter --html.
It just seems the issue is with the current directory from which the command is run.
It probably needs to detect files specific to a run-time stack before uploading the app; Such files, like the 'package.json' file for Node.js would on exist within the app's directory. So please try 'cd' into the app's directory

Web app deployment failure with zip deployment?

i have just begun with Azure.
Here i have simple flask api and i tried to deploy the app with azure cli in vscode then it ends up with following error. I'm completely new to Azure so can anyone please sort out this for me. Thanks in advance.
I cannot reproduce your issue, but here is what I did and it can publish successfully using python 3.7. Note: I'm using azure cli version 2.0.75. Please check your cli version using az --version, and upgrade it as per this link if you're using old version.
1.Create a web app for Linux, the screenshot as below:
2.After step 1 is completed, then in visual studio code, open the folder where your project locates, and follow this doc:
In visual studio code -> terminal, use the following commands first(you need to nav to the folder where the project locates):
py -3 -m venv env
env\scripts\activate
pip install -r requirements.txt
Set-Item Env:FLASK_APP ".\application.py"
flask run
Then, input the commands to publish the flask api:
az webapp up --sku F1 -n <app-name> -l <location-name>
it can be published successfully. The screenshot as below:

NodeJS App Deployment via Azure DevOps 32bit issue

i am using Azure DevOps Build & Release to build my node.js react app that uses node-sass. So the Build is using the Node.js Tool Installer to specify the node.js version and then runs the npm install command. It all runs with a hosted agent that requires node.js and npm. The azure app service which runs the application is a default windows site.
After that i want to deploy it via Azure DevOps Release. I am using the Task "App Service Deploy" to deploy it. If i don't specify a deployment method it uses "Run from Package" and everything is fine. (Except that i cannot make changes in the root folder, but thats the concept of the run from package). If i change it to deploy via "Zip Deploy" i get the following error:
Error: Missing binding
D:\local\Temp\zipdeploy\extracted\node_modules\node-sass\vendor\win32-ia32-57\binding.node
Node Sass could not find a binding for your current environment:
Windows 32-bit with Node.js 8.x Found bindings for the following
environments: Windows 64-bit with Node.js 8.x
So i got this one already in my dev environment, but there i could get a simple workaround - install and use the 32bit version of node.js and then deploy it to azure (via VS Code extension). Now it is not possible to use 32bit nodejs in the Azure DevOps Build task as i saw as a limitation of the windows app services in azure.
How can i get Azure DevOps to use 32 bit when using npm install? Is the only possible way to switch to a linux app service (which runs 64bit) in azure?
Thanks!

Why is the "Build an image" step failing for Docker on Visual Studio Online?

I'm trying to build a Docker image, which seems to build and run fine on my local machine, but it keeps failing with the following error:
2018-05-06T13:56:15.2331697Z failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage C:\ProgramData\docker\windowsfilter\3b555fe81a5123419e06c66652d9e73adbbb17b10f52ddd9f59da3b7fb87adab\UtilityVM: The system cannot find the path specified.
2018-05-06T13:56:15.2531044Z ##[error]C:\Program Files\Docker\docker.exe failed with return code: 1
It fails on the "Build an Image" step. I'm trying to use an Azure registry type.
I'm trying to set up Continuous Deployment using Visual Studio Online. I selected the Hosted 2017 build agent (but have tried other ones with no success there either).
My app is a .Net Core app. I think it's trying to use a Nano Server, and from what I read, that might be part of the problem (maybe the Hosted agent doesn't support the Nano Server).
All of these technologies (.NET Core, Docker, Nano Server) are new to me (and probably new to mostly everyone), so I'm limited in my knowledge about them and where to start troubleshooting.
Any ideas?
The step of the Docker file that it's failing on is this one
FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
It is not supported on Hosted agent of VSTS, check this issue: Docker images based on nanoserver-1709 not building on hosted VS2017 agent

heroku like deploy tool for vps

Deploying your web app to heroku is easy
What I want to know it is there any open source tools installed on your linux server so you can have the same deploying experience, since heroku buildpacks is all open source.
Dokku is single-host version of Heroku. It allows you to push Heroku-compatible applications to via git.

Resources