Upgrading Node.js version on an Azure Linux Web App? - node.js

I've just created an Azure Linux Web App (preview) following this link:
Create an Azure web app running on Linux
I've developped a koajs backend that requires node v7.6.0 or higher.
Also I've read this SO Post: Upgrading Node on an Azure website? but it is related to Azure Windows Web App using iis_node.
So far, I tried to install nvm from the bash kudu console:
https://{mysitename}.scm.azurewebsites.net/DebugConsole
But it did not work
So now my guess is that when I choose the Node.js version from the azure portal, Azure selects a specific built-in docker image. Because there is no image for Node.js v7.6.0 or higher I need to create my own image ?
Is there anyway to get the latest docker image config for node.js from the portal or do I need to create one from scratch ?

Azure WebApp on Linux is a Docker container, according to the offical document Using a custom Docker image for Azure Web App on Linux, you can set a custom Docker image which includes Node.js higher version for a web app or using a node offical higer version image from Docker Hub.
Hope it helps.

Currently, Node.js versions available on the Linux platform are: 4.4.7, 4.5.0, 6.2.2, 6.6.0, 6.9.3, 6.10.3. I would recommend you switch to use Azure Windows Web App which enables you to upgrade the Node.js runtime to v7.6.0 or higher (7.7.4, 8.0.0, 8.1.4).

Related

Azure App Service suddenly stopped with PhantomJS error

We have a Restify API running in Azure App Service on Linux for a while now. Suddenly this app (both test and prod, they run as seperate apps) stopped working. Based on the logs the error is related to a package we are using node-highcharts-exporting which is dependent on PhantomJS. App Service is using Node 8.1.
We tried re-deploying the code, upgrading node version to 8.12 (do not want to use latest version with out testing) but still no luck.
Deployment Logs: (This part is successful. This is just for reference)
Container logs: (Startup fails here)
Tried to replicate the same environment on-prem and everything works fine. Created a new App Service which is also running into same issue. Any help is much appreciated.
Update 1:
I think I figured out what is happening. This is related to font libraries on linux https://github.com/ariya/phantomjs/issues/10904
I need to install libfontconfig but this is not supported on Azure App Service.
Yes, it is due to sandbox restriction on a App Service. Just to highlight, the standard/native Azure Web Apps run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available.
Not supported scenarios on standard App Service - PhantomJS (/Selenium): tries to connect to local address, and also uses GDI+.Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered (system-installed font is used instead) because of sandbox GDI API limitations.See App Service GitHub sandbox page.
Based on your requirement, however you could use a custom container in App Service (You can use a custom Docker image) that lets you make OS changes that your app needs.
Checkout these document for more details on this topic:
Run a custom Linux container in Azure App Service (You can use a custom Docker image): https://learn.microsoft.com/azure/app-service/containers/quickstart-docker
Run a custom Windows container in Azure (Preview):
https://learn.microsoft.com/azure/app-service/app-service-web-get-started-windows-container

Deploying a Python API to Azure App Services

I have a client with an existing API built in Python 2.7.6. Currently it's Dockerized (Docker v1.16(?)) on some VMs at another host. I have seen several posts about putting Python natively on azure app services but I am no expert at either Docker or Python so I wanted to know a couple things:
Can we natively push Python (2.7.6) to azure app services? or would
we need something like Docker?
This Docker version is (apparently) quite old - is it easy to update
this?
If I needed to Dockerize this what SKU on Azure would I need to
procure? I suspect this would not be a standard S1 web app running
Linux?
Following link explains creation of app services using docker hub image:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-docker-go
More detailed explanation:
https://learn.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image
You can also use webapp on linux to deploy your python app directly:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-python
If you are using direct deployment, use Webapp for Linux, rather than Webapp for windows. Windows based webapp are mmore suited for dotnet based applications

Updating Azure Cloud Service to OS family 6

I am using Azure DevOps to deploy a .Net Web Application. I wanted to update to the new Os Family which is based on Windows 2019 so i can Update my projects to .net framework version 4.7.2 as seen here. I have updated my cloud service configuration '.cscfg' file to osFamily="6" but when i try to deploy the app even though the Build succeeds i get this error when i reach the Release step in Azure pipeline:
The OS family 6 you are trying to deploy is not supported by the SDK package. The SDK package supported OS families:3,4,5,1,2,98,97. Please try to deploy to a different operating system. To do this specify a different osFamily and/or osVersion in your .cscfg file.
I am using the Hosted VS2017 agent.
According to the error information it indicates that the OS family 6 are not supported by Hosted VS2017 agent.
Based on the link you mentioned that Compatible SDK versions should be Version 2.9.6+.
So my workaround is that you could use the Self-host agent with latest Azure SDK installed. We could download the latest Azure SDK from this link.
or you could have a try to install the Azure SDK on the Host 2017 agent (without test)
You also could give your feedback to Azure Devops team.

Azure Bot Service set node.js version not working

Specifying a Node.js version in Azure Bot Service doesn't seem to work.
In Azure portal, navigate to the bot service instance, then in application settings set the environment variable WEBSITE_NODE_DEFAULT_VERSION to 7.7.4, which is the highest version available as of 22/05/2017. However it turns out the node.js runtime is still v6.5.0!
In Kudu -> Environment it shows:
WEBSITE_NODE_DEFAULT_VERSION = 7.7.4
and
Path = D:\home\site\deployments\tools;... D:\Program Files (x86)\nodejs\7.7.4;...
Couldn't find where this v6.5.0 node.js version was set. Maybe in IIS settings? It would be good if azure bot service allows to use customized node.js version rather than the system provided lag version. So is there a fix or work-around? Thanks.
Currently Azure Bot Service (Preview) only supports Node.js v6.5 LTS and does not provide any advanced version configuration options as you described.
Keep in mind that when you create a bot with Azure Bot Service (Preview), you are creating an Azure Functions app (in the background). Azure Functions has their Node.js version locked at v6.5 as described in their documentation.
The node version is currently locked at 6.5.0. We're investigating adding support for more versions and making it configurable.
If you would like to install and run a specific version of Node.js, you will need to setup a VM and configure it to your specifications.
Alternatively, you can deploy your SDK Bot (aka not using Azure Functions) to Azure App Service on Linux (Preview), which will allow you to select a Node.js version in the v6.x LTS range, for example v6.10.2 + npm v3.10.10. In this scenario, you must specify the specific Node.js and npm version in your package.json "engines" section. You can read more about this option in my blog article: Deploying Bot Framework To Azure On Linux
For other people who want to customize their node.js version for their bots, I've found a way: use Azure App Service instead of Azure Bot Service. Here is how:
Create your Azure app from the Azure portal, and choose the node.js template
(optional) Configure Continuous Delivery
Register your app in Bot Framework portal
start Kudu Cmd console
cd D:\home\site\wwwroot
md bin
cd bin
then download the node.js version you like, e.g.
curl -O http://nodejs.org/dist/latest/win-x64/node.exe
Using Kudu, modify D:\home\site\wwwroot\web.config to point to your entry .js file (default is server.js) and add the following line:
<iisnode watchedFiles="web.config;*.js"
nodeProcessCommandLine=""D:\home\site\wwwroot\bin\node.exe""
/>
Following the steps above, you are no longer restricted by the locked node v6.5, and use the latest node.js feature as you wish.

Hosting existing node.js apps on Windows Azure

Is it possible to port existing node.js applications to Windows Azure platform? I currently develop on my Mac but will need to deploy the application to Windows Azure in a near future.
You may also want to check a video on Channle 9.
node.js on Azure : http://channel9.msdn.com/Events/Patterns-Practices-Symposium-Online/Patterns-Practices-Symposium-Online-2012/node-js-on-Azure
Yes it is very much possible. You may also need to consider to make changes to use Azure Blob storage where your node.js code is using local file system (if required). The deployment is very similar to any other Windows Azure App and one you have Azure SDK for node.js you can use powershell cmdlets to make your job easy.
Download Node.js SDK for Azure
https://www.windowsazure.com/en-us/develop/nodejs/
Here you can learn the basics to deploy node.js app to Azure:
https://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
Porting node.js apps to Azure is possible but not yet a yes/no answer.
You can run your Node apps in Azure but you need to look at the modules you're using to make sure you aren't depending on a tool or command or other facility that isn't yet available on Azure. For example, are you using a database like redis or couchDB or mysql? These don't exist natively in Azure so you may or may not be able to port that layer -- you'll have to check.
Since you're on a Mac, there isn't yet a native OS X deployment tool. Microsoft and the Cloud9 folks have been showing a way for Macs to deploy from the Cloud9 IDE which works but the Mac story will most assuredly improve over time. I work on a Mac but I keep a Windows VM open (Parallels) and if I deploy from the desktop I've been using the Powershell cmdlets in the Windows Azure SDK for Node.js which makes things fairly turnkey from Windows.
You will want to follow a couple of repos and their contributors: Azure SDK for Node, which allows native access to Azure Storage via npm install azure and iisnode (on Github) which is a component that assists your node app running under IIS (the Windows Web Server) on Azure.
It's been great to see the Node story on Azure evolve; it's still just a little early but they seem to be making great progress quickly.

Resources