Deploy meteor app in Azure on Windows - azure

Hello i am have meteor app and want deploy on Azure on Windows, i try it by Meteor Up but can't do it
***\project2>npm install -g mup
***\project2>mup init
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
Empty Project Initialized!
***\project2>mup setup
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
Started TaskList: Setup (linux) [23.101.74.119] - Installing Node.js events.js:85
throw er; // Unhandled 'error' event
^ Error: connect ETIMEDOUT
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)
this error in Command Prompt of window from my local system

Looking at the error description it might be a connectivity issue. If you could share your mup.json file we might be able to spot the issue there.
Did you create an endpoint on TCP port 80? Check you nodeVersion setting so it corresponds to you Meteor app. The ROOT_URL should be in the format http://[myappname].cloudapp.net.
Using mup logs -n 50 you might detect some clues.

Related

Error on npm start on Azure - EADDRNOTAVAIL

I'm trying to get a nodejs app running on Azure (which runs perfectly fine on Heroku).
After running npm start on the app, the following error happens:
Error: connect EADDRNOTAVAIL 127.0.0.1 - Local (0.0.0.0:56256)
at internalConnect (net.js:907:16)
at defaultTriggerAsyncIdScope (internal/async_hooks.js:301:12)
at net.js:998:9
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
errno: 'EADDRNOTAVAIL',
code: 'EADDRNOTAVAIL',
syscall: 'connect',
address: '127.0.0.1'
}
I've tried setting various ports which are free, but no matter what, I get this error.
UPDATE
I know that your current program runs normally in Heroku, and it runs very well locally.
But what I want to tell you is that in azure webapp, there is no need to execute the npm start command to start the webapp. After you pass the deployment, you can set the Startup Command in the portal to start your application. For general nodejs projects, the startup command is npx serve -s.
So you said that the execution of npm start produces an error. If you execute this start command in kudu, it is inappropriate.
If an error occurs when running locally, such as connect EADDRNOTAVAIL 127.0.0.1-Local (0.0.0.0:56256), it is recommended that you use netstat -ano|findstr "56256" to check which process uses the port and deal with.
PRIVIOUS
You need to macke sure use process.env.PORT || 3000 in your project. And you need to know, the port in azure webapp just support 80 and 443. So in your project, So in your code, there can only be one PORT value. After deployed, 443 and 80 will work.
And you can run your app perfectly on HeroKu. So I suggest you upload your code to github.
Then you can deploy your webapp by git. And your issue will be solved. If also have error when deploy, you can check the error in Action on git.

Get [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] when I deploy my project in heroku

My project works fine locally.
And I push my project into GitHub and Heroku by using command:
git add .
git commit -m "msg"
git push
git push Heroku
I got error when I tried to access https://still-shelf-36108.herokuapp.com/
I checked Heroku logs. The error is below:
READY Server listening on http://127.0.0.1:12211 15:03:24
2019-02-28T15:03:24.419308+00:00 app[web.1]:
2019-02-28T15:03:24.729864+00:00 app[web.1]: (node:42) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
Anyone can help to solve this?
The reason you are getting this is that your localhost and the Heroku's localhost are not the same. Therefore a database hosted on your localhost is not accessible from https://still-shelf-36108.herokuapp.com/.
To solve this, you can create a free MongoDB instance at https://www.mongodb.com/cloud/atlas and then connect from both your localhost and from your Heroku app.

Run first Nodejs app on cpanel godaddy hosting

I'm trying to run my first Node.js application, but I'm having trouble. This could be an error with the firewall on CPanel, but I'm not sure.
I'm running Node.js version 5.0.0
And this is my js:
var net = require('net');
var server = net.createServer(function (socket) {
socket.write('Open Serverrn');
socket.pipe(socket); });
server.listen(674, 'my.ip.add.ress');
console.log('Server running at http://my.ip.add.ress:674/');
And final : this is my notification :
node test.js
Error is:
Server running at http://my.ip.add.ress:674/
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EACCES my.ip.add.ress:674
at Object.exports._errnoException (util.js:860:11)
at exports._exceptionWithHostPort (util.js:883:20)
at Server._listen2 (net.js:1221:19)
at listen (net.js:1270:10)
at net.js:1379:9
at doNTCallback3 (node.js:461:9)
at process._tickCallback (node.js:367:17)
at Function.Module.runMain (module.js:459:11)
at startup (node.js:136:18)
at node.js:972:3
When I open my console with port 674, it's always loading and timing out after a few seconds. Why is that? Plz help me this issue.
I do not believe GoDaddy has Node.js support, as per this: How to install nodejs application in Godaddy server
Common hosts for Node apps would be:
Digital Ocean, Nodejitsu (owned by GoDaddy anyway), Modulus, Heroku, Joyent, and AWS, I believe.
You need to use port higher than 1024. To bind lower ports you need root privileges or allow program to bind via setcap - can't be implimented at GoDaddy or other shared hosting.

Nodejs in Openshift MongoDB Error

This could probably be very stupid and naive question, but I have tried all my ways to find the solution, but I'm unable to solve. Hope anyone can solve my problem. Thanks in advance.
Recently, I deployed my nodejs application in Open Shift using Mongolab driver for the MongoDB. When I run the application using 'rhc app start -a nodejs', it gives me an ECONNREFUSED error in mongooose.
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
But, when I SSH into the server, go to $OPENSHIFT_REPO_DIR directory and use npm start, the app works very fine.
I connect to the mongodb by defining the URI as shown
mongoose.connect(process.env.MONGOLAB_URI || 'mongodb://localhost/<dbname>');
I defined the MONGOLAB_URI as an environmental variable in the server.
There would probably be something that I'm missing. But, please bare with this naive.

EADDRNOTAVAIL when Dockerizing Node.js app

With the following app, I am able to start it manually via npm install / node app.js. The issue is with trying to run the app via a Docker container.
Apart from what the rest of the app is (which doesn't matter because running the Docker container doesn't even get that far), the Dockerfile pulls the code from GitHub, switches to that directory, then runs app.js (which pulls the host and port from a config.json file). Attempting to run the container with the IP address of the server (what it should be listening on) results in the following error:
uncaughtException: Error: listen EADDRNOTAVAIL
Error: listen EADDRNOTAVAIL
at errnoException (net.js:905:11)
at Server._listen2 (net.js:1024:19)
at listen (net.js:1065:10)
at net.js:1147:9
at dns.js:72:18
at process._tickCallback (node.js:442:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:929:3
Changing the port does nothing to resolve the issue. I've included the relevant files below (with certain sections replaced with {pseudocode}). Any help would be immensely appreciated, because I'm absolutely hopeless when it comes to Docker.
Dockerfile:
FROM centos:centos6
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum install -y npm git
RUN git clone {repo.git}
COPY . /src
RUN npm install
CMD ["node", "app.js"]
config.json:
{
"app_host": "{IP of server}",
"app_port": "20000"
}
app.js:
var server = app.listen(config_json.app_port, config_json.app_host, function () {
var host = server.address().address;
var port = server.address().port;
console.log('\n listening at http://%s:%s', host, port);
});
module.exports = app;
Turns out robertklep in the comments to my question was correct: the issue was trying to explicitly pass the IP of the server into app.js. That's the way the app was configured to work just by itself with Node, but that can't be done with Docker.
The only code change needed was removing config_json.app_host from app.listen in app.js. Then, running the container by binding the exposed port to any available port on the server causes it to work.

Resources