Azure: Web Service showing default screen and not code - node.js

Followed this tutorial and did all the steps. https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs
For some reason, when I load the page, it shows a default "Hey, Node Developers" page, instead of the expected output "hello world". I am using a Linux server.
The code is on Azure's machine, but it is running the default page instead.
Any reasons why this might be?
Thanks.

Problem was that I was uploading a folder with the desired repo inside of it, instead of the repo itself.

Related

Azure Service Editor config changes are not applicated

I have a problem with my QnA Bot App. I made some changes to basic responses (No answer found, Hello and Goodbye) in Azure Service Editor. I have also changed a default HTML webpage. Changes made in a HTML website were made instantly, but the config files with new welcome responses were not.
I am sure that I once watched a tutorial that provided information that after you change some stuff in configs files you need to commit them using Kudo Console. I tried restarting the app but it did not work.
I am beginner. Does anyone remember what is the command?
I tried searching through my whole browser history but I still cannot find it.
I used command deploy and it worked.

How could I prohibit anonymous access to my NodeRed UI Dashboard on IBM Cloud(Bluemix)?

I'm working with node-red, on boilerplate IBM cloud. I know that there is a way, changing the value of enviroments variables(NODE_RED_USERNAME and NODE_RED_PASSWORD), to change username and password of the editor flow. But, what about UI dashboard? I mean using dashboard nodes. Forbid access to
https://noderedservicename.mybluemix.net/ui/
I know that on the code, changing the variable httpNodeAuth on the file settings.js I can do what I want. What is the way for doing that on IBM Cloud?
Thank you in advance!
You need to add the httpNodeAuth (not the httpAdminAuth as this is for controlling access to the Node-RED editor and can done with the environment variables discussed in the other answer.) to the app/bluemix-settings.js file.
Something like this:
...
httpStatic: path.join(__dirname,"public"),
httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
functionGlobalContext: { },
...
Details of how to generate the pass can be found here
There are a number of ways you can edit the file, some of which include linking the Node-RED deployment to a git repository or downloading the whole app, editing the file and pushing it back to Bluemix (when you first deploy Node-RED from the starter pack it gives you instructions on how to download the source to make changes and then push them back. You can get to these instructions by clicking on the "Getting started" link in your Node-RED Bluemix console page).
But the quickest/simplest/dirtiest way is probably to just SSH into the instance and change the file with something like vi. Details on how to ssh to an app instance can be found here. But the following should work:
cf ssh [app name]
Once you have edited the file you will need to tell bluemix to restart the app. You can do this from the web console or with the cf command line tool.
(The changes made by this method will not survive if the app is restaged, or bluemix decides to move your instance to another machine internally because it will rebuild the app from the pushed sources. The permanent solution is to download the source, edit and push back)
This link will help you but it's written in Japanese.
http://dotnsf.blog.jp/archives/1030376575.html
Summary
You can define the "user-defined" environment variables through the IBM Cloud dashboard.
It contains the variables to protect Node-RED GUI.
You have to be set as follows
NODE_RED_USERNAME : username
NODE_RED_PASSWORD : password

How to get standard out from a Node.js application in Azure?

We have a Node.js application with a pretty big codebase that we're trying to deploy to an Azure Web Site. My problem is that when I deploy the app and try to access it, I just get a message saying "The page cannot be displayed because an internal server error has occurred".
According to http://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-debug/ I should be able to configure some settings and have my standard out be logged to a file - well, it's not working. in /LogFiles I can see /git, /html, and /DetailedErrors, but none of these folders contain the stdout logs.
I have deployed the app using Visual Studio. I created a blank Azure project, and manually added all the folders and files I need. I also created an iisnode.yml file that contains the following config:
loggingEnabled: true
devErrorsEnabled: true
logDirectory: ./logs
debugHeaderEnabled: true
The last two lines I added later, the first ones are from the tutorial. I also have a web.config file, the contents of which I haven't really touched.
I've attempted to configure the settings that are available in the Web Sites UI, but I haven't really been able to make any headway. I think currently they are pretty much default.
I'm sorry that I can't provide you with more information. I'm really kind of banging my head against the wall here, since all the tutorials I've found basically state that if I do this and that, everything should work. The problem is, it doesn't. Sad face.
Edit: I should probably add that my server.js is in a folder called /NodeServer. It's not in the root as Azure seems to presume.
Edit2: I deployed a Hello World example and got it to work, but when I try to move the server.js file from the root I can't get it to work anymore.
I've added a tag to the web.config, so that the structure is basically
configuration
location path="NodeServer"
system.webServer
I've also edited my package.json so that it says
"main":"NodeServer/server.js",
"scripts":{
"start":"cd NodeServer && node server.js"
}
If the app is started successfully, you should be able to find the stdout at
D:\home\LogFiles\Application
in Azure Websites, without configuring anything.
But here it looks like an error related to incorrect/missing web.config. The node app may not get launched. You can try:
Publishing your app using git to Azure Websites.
Or if you are familiar with IIS and iisnode, make sure your app works locally with IIS and iisnode. See http://tomasz.janczuk.org/2011/08/hosting-nodejs-applications-in-iis-on.html
Or try publishing an "hello world" node.js app to Azure Websites, take the generated web.config and modify it for your app.
Edit: When you change the location of server.js, you have to change web.config too. The change in web.config is not correct. And package.json is only used as hints to generate web.config during git deployment. To get your "hello world" to work, you can either
In your web.config, replace all "server.js" with "NodeServer/server.js".
Or deploy the modified app using git. Make sure it does not contain the wrong web.config.
Then you can try to get your larger app to work.

Path of image gets changed to localhost, even on production server, in Orchard CMS

Problem
I uploaded an image using the inbuilt tool and added it to a blog post. All this on the production server, across the pond in Montana, US.
It displays fine (using the correct absolute path it should: "/Media/Default/BlogPost/...") in the preview of the blog post. But once I publish it, I get a broken image in the live site. The reason being that the path renders as:
http://localhost:[port number]/Media/Default/BlogPost/...
Obviously, if running on a Dev machine, this will still work, but once on the live web server, this no longer works.
History
I downloaded WebMatrix onto my machine, downloaded orchard, installed the Minty theme, made a new theme that uses Minty as the BaseTheme. Then, once everything was almost there, uploaded onto the live web server.
I can't see how this can affect how the server interprets an absolute path, but maybe I am missing something?
Fudged solution
I can fudge a solution by using the URL of the site i.e. I open the image picker and in the URL for the image resource text box I put:
http://blogs.mysite.co.uk/Media/Default/BlogPost/...
With this full URL, the problem goes away, but it is a fudge and I shouldn't need to do this.
Any suggestions?
#gelistir from the Orchard discussion pages answered this.
It is caused by a module, the Vanderlay Relative URL Filter module. Disabling the module (that I wasn't using anyway, not even sure what it does...) solved the issue.
For whatever this is worth, more than 2 years have passed since the question was asked. Anyway, if the problem described here happens to you, on the dashboard go into Settings and under "General", set your base url to your "http://www.yourdomain.com", instead of to "http://localhost[portnumber]". This is where the Vanderlay module gets the url to rewrite from.
Regards,

Directory Listing Denied in Orchard

I have a new Orchard site which successfully runs the setup and database configuration when running locally. But when I tried to deploy it to the actual server and point a browser to the site, I get a "Directory Listing Denied" error.
Anyone seen this and fixed it?
I figured it out. Running on a shared web server, if IIS is configured for my site to use the default app pool, Orchard is precluded from reading its own files. (Remember that Orchard uses libraries and needs deep read/write access to subdirectories).
So the solution was simply to configure the site to run in its own isolated application pool.
Looks like this on my site's control panel:
Hope this solution helps someone down the line.
My guess is that you deployed the whole source code instead of src/orchard.web.

Resources