Getting a NodeJs app working

Hey Reclaim,

I’ve been chiselling away at setting up a staging server for the Remixer machine, and it was all going so well. I set up a NodeJS environment, and hooked up a deployment from a github repo. I used a post hook to run a build on repo update. As far as I can tell, that works fine. I’m using Nuxtjs, which allows Server Side Rendering of Vuejs apps. After a few issues with getting Nuxt to build cleanly, it does. So npm libraries are installed. On setting up the NodeJS environment, I’ve gone for pm2 as the process manager, as I’d used it before. I’ve setup pm2’s “ecosystem.config.js” file to point to the Nuxt js file (as instructed by Nuxt’s deployment guide: Deploy Nuxt using PM2 - NuxtJS ). I can get a pm2 status, which tells me the app is running, and not falling over. After another dig around, I see that the pm2 node process is listening on port 3000. That’s nuxt’s default port, and that’s all good. I’ve also bound a subdomain to the environment, and added the LetsEncrypt addon, which in turn added a public IP. I came across this Reclaim Community thread Redirect traffic from public port to an a different container port and so I set the JELASTIC_EXPOSE variable to 3000.

But for all of that, I haven’t been able to get any response when I stick the subdomain (or the environment address) in the browser, either with or without the internal port (3000).

I tried removing the Public IP, and turning the SLB on, and at least got a clean 502 error page. So I’m guessing that the 3000 port isn’t being exposed properly.

Can you shed any light on my deployment misdemeanors?

Many thanks,


If you can send me the environment name I can take a peak (feel free to private message here as well if you prefer). Usually if an internal port is exposed it should work with the load balancer but I’ve found it a bit iffy sometimes.

Thanks Tim! I’ve popped it in an email to you. Yes - I’d prefer it to work with the load balancer - as I only need to spin it up when I’m testing…

As it turns out after a bit of troubleshooting Nuxt defaults to localhost only and you have to specify a hostname flag --hostname 0 for it to be accessed externally Configuration - NuxtJS Just wanted to update here with the fix :slight_smile: There was other more complicated things in between regarding Node versions and getting the app to stay running alongside pm but all seems well now.

Thanks so much Tim - That was the missing link!
There are a few things I’ve learnt on this journey to be sure. Here are a few that might be useful to someone else:

  1. How nice the Github repo pull (for me a dev branch) works, and how it can be scheduled to look for updates and call some “post-hook” scripts on pulling those updates.
  2. Getting used to the pm2 “ecosystem” approach - essentially a JS config file that automatically gets run on Application Server refresh (its path referenced as one of the container variables), which keeps the app running, and logs when it doesn’t
  3. using CURL to see if my webapp is responding well locally, and not erroring
  4. using “lsof -i -P -n” to see what ports are being listened to locally
1 Like