Azure Node hosting file/folder permissions - node.js

I have launched my sails.js app to Azure Node.js shared infrastructure.
App does not lift due to file permission. Seems like grunt tasks cannot create
concatenated files in .tmp directory in the root.
I tried to give write access via FileZilla but it did not worked. When ever I try to hit URL
I see file permissions are getting set into default values.
I also did not see any settings to give Folder permissions at Azure Dashboard.
Is there any workaround on this issue?
Error:
** Grunt :: An error occurred. **
------------------------------------------------------------------------ [31mAborted due to warnings.[39m Running "sails-linker:prodJs"
(sails-linker) task[24m Autoinsert script tags in an html file
[33mWarning: ENOTSUP: operation not supported on socket, scandir
'D:\home\site\wwwroot.tmp\public\concat\production.css' [39m
------------------------------------------------------------------------ Looks like a Grunt error occurred-- Please fix it, then restart
Sails to continue running tasks (e.g. watching for changes in
assets) Or if you're stuck, check out the troubleshooting tips below.
[4mTroubleshooting tips:[24m
*-> Are "grunt" and related grunt task modules installed locally?
Run npm install if you're not sure.
*-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
*-> Or maybe you don't have permissions to access the .tmp
directory?
e.g., D:\home\site\wwwroot\.tmp ?
If you think this might be the case, try running:
sudo chown -R YOUR_COMPUTER_USER_NAME D:\home\site\wwwroot\.tmp

According to the error information below, it seems that the sails app default start up for websocket on the port 1337, but the Azure webapp only enable the ports 80 and 443.
Warning: ENOTSUP: operation not supported on socket
There was an SO thread Deploy sails.js to Windows Azure Website that discuss about deploying the sails app on Azure WebApp.
Hope it helps. Best Regards.

Related

How can I fix IISNode internal server error? listen EACCESS permission denied

I added a node application as a website on IIS with a web config file and whenever I try to browse the website it gives this error:
Error on web browser.
I have tried using the taskkill command to stop the process listening to this port and I also tried giving IIS_IUSRS user full permission on the root folder, but this issue persists
web.config file:
config file image
So I was able to find my way around this issue. I removed the application from IIS and I used pm2 to start the node application and I didn't encounter any error after using this approach.

Unable to complete Kudu deployments on Azure Websites

I have set up a deployment following the guidelines here:
https://learn.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment?tabs=github
The deployment was working successfully when first set up. Today I made changes to my code for a redeploy and it stopped working.
I get the following error:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment with MSBuild16.7.0.
Access is denied.
Failed exitCode=1, command="D:\Program Files (x86)\MSBuilds\16.8.3\MSBuild\Current\Bin\MSBuild.exe" /restore "D:\home\site\repository\myproject\myproject.Web.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="D:\local\Temp\8d8f7e05bbfa782"
An error has occurred during web site deployment.
Access is denied.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\92.30310.5111\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
I then connected to the Kudu debug portal and attempted to run the command myself. It failed. Then I attempted to navigate to D:\Program Files (x86)\MSBuilds\16.8.3\MSBuild\Current\Bin
That version of MSBuild is missing. The only versions present are:
03/27/2021 09:33 AM <DIR> MSBuild-15.3.409.57025
03/27/2021 09:33 AM <DIR> MSBuild-15.9.21.664
03/27/2021 09:33 AM <DIR> MSBuild-16.4
How do I get 16.8.3 installed?
Azure web app is run in a sandbox environment, and the contents of the folder under D:/home have read and write permissions. All other folders have read-only permissions.
Azure web app has a web environment that supports deployment in various languages, so there is no need to install the 16.8.3 version of MSBuild.
For your question, I can only provide the following troubleshooting steps:
Check what version of your project is. Net framework, .net core 2.2 or 3.1, .net5 ?
Check if the Stack settings of your azure web app is consistent with the project.
(Optional step) Set the Stack settings to .Net5, and modify any file in github, such as a new file. Check the deployment results.
Download your project and run it locally to see if it can run normally.
Create a test slot, redeploy to see if it can be deployed normally, and set the traffic to temporarily not affect your web operation. See if the problem will recur. If the problem persists, please contact Microsoft.
Related Posts:
1. Error - Access is denied - deployment to Azure App Services

How to deploy shield with Kibana on Bluemix

I am trying to deploy Kibana on Bluemix PaaS. Because Kibana is a Node.js application, it can be deployed as such on Bluemix. All i have to do:
Provide a simple manifest.yml file that details the app name and a couple of other things
Provide a Procfile that has just one line as web: bin/kibana --port=$PORT
Thus, I can run Kibana on Bluemix. Note that this is pushed via Cloud Foundry.
Also, I was able to install the marvel and sense plugins for Kibana.
Now, I installed the shield plugin. This plugin requires an ssl key and an ssl cert file to run. The path to these files must be provided in the kibana.yml file.
After installation, I tested the shield plugin natively and it worked just fine.
Here is the layout of the directory structure:
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
(d) represents directories. The sslFiles folder contains the ssl key and ssl cert files.
Before I could push to Bluemix, I knew that the paths to the SSL files would have to be relative to the app in Bluemix. Thus, in the kibana.yml file, I specified them as:
kibana.ssl.key:app/sslFiles/kibana.key
kibana.ssl.cert:app/sslFiles/kibana.cert
I did this as in Bluemix, I could see the following directory structure:
app(d)
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
Indentation represents containment. So, I pushed it to Bluemi using Cloud Foundry, but now I get a 502 Bad Gateway: Registered endpoint failed to handle the request error. I tried changing the paths to sslFiles/kibana.key but then I got a cannot find path sslFiles/kibana.key staging error.
What is responsible for my 502 error? Is it the path to the sslFiles? If so, how can I properly provide the paths?

Error: ENOENT, no such file or directory './assets'

After setting up koa-static-folder, my image loads great when I test over localhost with http://localhost:3000/assets/myimage.jpg
But after deploying our node code to an Ubuntu server, we get:
Error: ENOENT, no such file or directory './assets'
What's Ubuntu's issue here? Not sure how to resolve this.
The code that is working locally is:
var koa = require('koa')(),
serve = require('koa-static-folder');
koa.use(serve('./assets'));
Sounds like a permission issue (but I could be wrong!) such that the user that node.js is running under does not have access rights to the assets folder. If this is the problem you have to change access permissions to the folder (see chmod) or run node.js as a user that has the access rights.
If the server isn't publicly accessible you could run the application as sudo to verify if it is a permissions problem or not. Note that using sudo is not a long term solution since it is highly irresponsible/unsecure to run the application as the root user.

Where is the log file using Production profile with NServiceBus GenericHost and default log4net settings when installed as a service?

I have a very simple NServiceBus.Host.exe application that is using the default logging and the Production profile. According to the documentation, this should result in an appending file log that should appear in the same folder as the EXE. However, when I run the application as a service, the log file doesn't appear in the same folder as the EXE, and thus far I've been unable to locate it at all. The service is running as Local System. Do I need to run it as a user account and look for the file in the AppData folder somewhere? Is it under c:\windows somewhere? Where is it and is there a way for me to have it actually log to a file in the same folder as the EXE as advertised?
Update:
Using ProcMon and ProcExp from SysInternals, I can see that there is no attempt to create any log file in the folder where my EXE exists, nor are there any file permission errors while trying to create a log file anywhere, at least not from the PID of the service (if for some reason log4net spins up another process to do this work then I might have missed it).
It turns out that the service wasn't actually running in the Production profile. I had for some reason gotten it into my head that services would run in the production profile by default, while running it in interactive mode would use Lite by default. Not so - the service will use the Lite profile unless you specify otherwise. I changed my command to install the service from:
NServiceBus.Host.exe /install /displayName:MyService
to
NServiceBus.Host.exe /install /displayName:MyService NServiceBus.Production
and this fixed the issue.

Resources