Node.js support

Hi,

How can i add Node js support to Hestia,

After a ggogle i found this but not sure how to apply it, can anyone advise on how to install, i have the below running on server

node (-> v13.12.0)

1 Like

@root from the link provided install requirements then use the path below in upload,

Usage.

  • PM2 must be installed.
  • The app must be installed in /home/user/web/domain/nodeapp/
  • The app entry point must be /home/user/web/domain/nodeapp/app.js
  • The app must listen on a UNIX socket in /home/user/web/domain/nodeapp/app.sock
  • Upload NodeJS.tpl , NodeJS.stpl , NodeJS.sh to /usr/local/hestia/data/templates/web/nginx/
  • In the control panel, select NodeJS from Proxy Template
3 Likes

I was following the the instructions but at the end i get an error after i install the nodejs app but site is unreachable error 500 and on error log i get

2020/06/11 18:56:37 [crit] 950#950: *324 connect() to unix:/home/prn/web/site.com.net/nodeapp/app.sock failed (2: No such file or directory) while connecting to upstream, client: 171.50.159.91, server: site.net, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/prn/web/site.net/nodeapp/app.sock:/ico", host: "site.net", referrer: "http://site.net/"

My script doesn’t have a file app.sock

Anybody able to assist with this

Any other .sock file? I am not known with NodeJS but looks quite clear…

Not sure as for me nodejs not my coupe of tea, just a request, willing to provide a fresh DO vps at disposal to find a working solution, my app has no .sock file

I hate to use C-y-b-erpanel(no advertise) purely for this, i want to be able to use my beloved hestia :slight_smile:

1 Like

Is it standaard script? Check the dist, Documentation and the install folder maybe there is some information found to how / what?

@root did you managed to get node.js working?

Hello All,

I think the issue is related to pm2 user / folder permissions
Using below code as test:
app.js

#!/usr/bin/env nodejs
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen('/home/**user**/web/**domain.domain.domain**/nodeapp/app.sock');
console.log('Server running at ');

when I ran node app.js in user folder this has created the app.sock

and if I follow the permission found inside the NodeJS.sh I could get the script within my domain.
chmod a+w "$home/$user/web/$domain/nodeapp/app.sock"

Then I followed below article so I could ran pm2 under user and when running pm2 start app.js as well successful create the app.sock

Now i do not know how to sort out permissions either for nodeapp folder or for the user. So this can run with NodeJS.sh under webcontrol

1 Like

@Gras Thanks for the trial, i had changed to another cp for this app, but will definitely like to get back on this and give another run, did you managed to sort out the above.

@ScIT any chance we can add this to the to do list, node.js is a great app that would do great on the future list.

Best,
G

@root to be fair my knowledge of Linux is limited. I think it might be related with permissions but could be wrong. The script NodeJS.sh does not do anything I even tried to change the command PM2 to “start” instead of “restart” nothing happened.
I did manage . Unless u run PM2 start under user domain and than adapt the command inside the NodeJS sh to change the permission this will work.

I think worth as well trying supervisor instead of pm2

@root
May i know what cp?
Thanks

agree with this :grin:

@jtdoank i use CyberPanel (no advert in any way) but is limited and buggy

@ScIT can we add this on to do list, i know is longshot but this app is quite good and becoming more and more popular.

Thanks,
G

Is there any update for Node.js support?

Hello All,
see below link might be of interest:

if you have any other guides please let me know. I have not tried above yet.

Thank you

2 Likes

Now please go again back to nginx.conf and read the first few lines of that file. Then comsider to use a template as suggested above.

@ScIT is there a way to add this to default installation, just thinking on trying again on HestiaCP with this.

You mean to create a custom.tpl file and include it in hestiacp? That makes sense to me.

You need for each port a different template it doesn’t make sense currently unless we add support for custom variables in Hestia

Other option would be an implementation like we do with php

What is the easiest way to do it? Is it worth it?