Azure Bot Service set node.js version not working - node.js

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.

Related

Setup NewRelic in java application hosted in azure

I have written an application(Web) using java. I have hosted it in azure app service.
Configuration of App service is
OS : Linux
WebServer : Tomcat 8.5 and Java 8
For configuring newrelic i have downloaded agent and uploaded it in home/site/wwwroot/webapps/ROOT folder of azure app service.
One more step i need to perform is to add following command in catalina.bat
set "CATALINA_OPTS=%CATALINA_OPTS% -javaagent home/site/wwwroot/webapps/ROOT/newrelic/newrelic.jar
When i am trying to update catalina.bat which i found inside /usr/local/tomcat/bin and restarts the app service, my changes are getting reverted back.
Any other way by which i can able to configure newrelic for my application?
I can see two possibility:
Guided install: https://docs.newrelic.com/whats-new/2021/04/java-net/
Try to add / before the path (home/site/wwwroot/webapps/ROOT/newrelic/newrelic.jar --> /home/site/wwwroot/webapps/ROOT/newrelic/newrelic.jar)

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

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

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).

azure cloud service node js "not a valid service package"

I have a cloud service in azure with two .NET worker roles and i want to add a Node JS webrole.
I have installed the Node.JS tools for visual studio which creates templates from which should allow node apps to be deployed as a web role.
Packaging of the service goes smoothly, but after publishing the cloud service via visual studio the following error message is shown:
The file provided is not a valid service package. Detailed error code: presentation Invalid application runtime - a runtime component is missing:/base/x64/WaIISHost.exe.
But when I look in the package file for the cloud service using an archiving tool and go to /base/x64/, the exe "WaIISHost.exe" is there.
I am quite stuck at the moment. There seem to be few other people that have this issue and I have already reinstalled the Azure SDK as suggested here and I am using the latest version (2.9.1).

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