Question

I am having trouble deploying express app on nodester.

After successfully running the default hello world app of nodester I ran the following commands on nodester CLI

nodester npm install express

Thereafter I installed the express on the local git of my app

npm install express  
express  
mv app.js server.js // Changed the port from 3000 to the port given to me
git add .
git commit -m 'message'
git push origin master

I seem to have followed all the instructions given by various blogs but when I hit the url (http://dlq.nodester.com) the app shows offline.

Even though running the same app locally does the job. i.e. node server.js runs the app on my local (hitting the url shows Express page). Same app when pushed to nodester doesn't seem to work.

Kindly help

Was it helpful?

Solution

Update:

A Nodester Core Developer (alejandromg on IRC) has taken a look at your problem. You were having a merge problem within your git repository. It seems to have been a merge conflict. You can find the gist of your git merge conflict on GitHub. Alejandro was kind enough to resolve the conflict on the Nodester platform. Your app should now be running flawlessly on http://dlq.nodester.com/.

I will keep the rest of the answer as a possible way to solve this problem.


Hello fellow Nodester(er)!

Nodester, as a PaaS, uses internal port translation to allow every Nodester app to run on port 80, so that it can be easily accessed from the web. Since Nodester is running on a single EC2 instance, we assign you a certain port. That port will be internally forwarded to your dlq.nodester.com:80, but your app will have to use the one issued by Nodester.

I am aware you changed your port, but try using the alternate method described below.

You can access the port you were assigned by running nodester app info dlq. It should show you that your app is either running or stopped and the port.

To tell Express to use the port (as mentioned on the Help page (check the FAQ section), you can use either the number and hardcode it or take the environment variable that every Nodester app can access for itself.

This should work:

app.listen(process.env['app_port'] || 80)

Or

app.listen(process.env.port)

The first one allows you to develop locally on port 80 (or whichever you chose), the latter will need you to set an environment variable that contains either a string or a number of the port that you were issued.

Change that, push your code to Nodester (which seems to work, I'm glad!). After that, the app should start automatically and (hopefully) work. If you still run into problems, let us know here of on the Nodester IRC channel #nodester on irc.freenode.org or use the webchat client.

Additional Troubleshooting:

You seem to have used the nodester npm command incorrectly (judging by your information up there). It should be:

nodester npm install dlq express

(Thanks to Chris for that hint)

OTHER TIPS

For those having issues with: nodester npm install express

The way I got express running on nodester (from memory):

nodester app create myapp
cd myapp
npm install express -g      [if you don't have it yet]
express
mv app.js server.js

open server.js and listen to process.env['app_port'] || 80

git add .
git commit -m 'init express'
git push origin master

see nodestor logs and look for app restarted

NOW we can

nodester npm install express
nodester app restart

And all should be working at this point

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top