Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

nodejs Hosting

Ahmad A. shared this idea 10 years ago
Completed

Allow the installation of nodejs apps on servers.


This would require ability to run the apps in background & having some kind of environment variables to manage ports + creating subdomains with proxy so your app would be served through port 80 while it's actually running on higher port > 20.000


Heroku does something similar to this, so it can be done.


This might also requiring having niginx as the default web server to make things fast.

Replies (38)

photo
1

NGINX would be a completely separate consideration from this feature. If you feel NGINX is a requirement for node.js to be viable, then this feature would be sidelined for any consideration until/if NGINX is ever implemented via:


http://features.cpanel.net/responses/as-a-server-administrator-i-want-standalone-nginx-supported-as-an-alternative-to-apache-so-that-i-can-offer-faster-speed-and-lower-load-on-smallers-servers


If you do NOT feel NGINX is a requirement, then please proceed further with details on how you see this being implemented. From your description as well as my understanding of node.js, something resembling the implementation of Ruby on Rails in cPanel & WHM would be expected.


This includes the usage of mod_proxy/mod_rewrite for integration through Apache as well as separate config files that maintain/manage the port assignments given out to customers with the feature enabled.


Is this something within the realm of your expectation? Please elaborate on any specific implementations you see as necessary/beneficial to make this a viable feature. This does not mean there is promise of node.js implementation, but you need to flesh this out into a full feature request with full details and guidelines before it can even be remotely considered for inclusion.


The biggest items are some of what you've slightly touched on (whether it can even be adapted to work sanely in a multi-user shared hosting environment).

photo
2

Hello,


Litespeed has just announced automatic proxying for nodejs installs with rewrite rules.


I havent tested yet but it sounds like this :


http://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-shared-hosting-accounts


If I understand correctly, installing nodejs in a user directory isn't that complicated and automaticaly assinnging ports to users, cPanel already does for ruby.


An automatic nodejs installer and updater would be great, users could just click on enable nodejs and cPanel could install it for them.


Applications like Ghost are likely to become more numerous in the future and nodejs is already very popular amungst developpers.

photo
1

Just to add :


https://github.com/isaacs/nave


Simplifies the install process :


./nave.sh install lastest


install's nodejs


to ~/.nave/installed/version number/bin/node


./nave.sh use mynode latest


copies nodejs to ~/.nave/installed/mynode/bin/node


you could simply globaly install nave for cPanel then run


nave install latest && nave use cpanel-node latest


then add to the users .bashrc the new path to the nave nodejs and make sur the users nodejs is running and is on a port that cPanel supplies to the user (sounds much like the ruby on rails system cPanel already has for this part…).


cPanel would then just add the proxy rewrite rules to the .htaccess rewrite.

photo
1

Ok, so I've got it running with nave, port is defined in the nodejs script so we now would need cPanel to launch the process on boot and watch the process to make sure it's running… easy to do as root user but what we need is for users to be able to do this on their own.


We're also waiting for CloudLinux's virtual networking as this would allow users to run their own ports not takeing other user's ports…

photo
1

NodeJs applications can be run in cPanel using http://ndeploy.in/ which works by using Phusion Passenger nginX module . Can use some hacks in apache also to get Phsuion Passenger +apache in cpanel to get nodeJs apps working imho

photo
1

Administer server hosting at StilisticaMente.COM and we are your customers for more than ten years.

We would have interest to find a simpler feature to install Node.js from WHM so as to give the opportunity for our customers to use this software platform.

Thank You.

Marco Grazoa.

photo
1

wrender wrote:

Would be really great if it were supported by cPanel and CloudLinux.
!0-4 big buddy, yes it wold!

photo
1

Adding a voice to this request as many more applications are being written node js and we are currently keeping our clean cpanel machines clean and offering best effort nodejs on separate boxes. Would love to see production ready node support in cpanel.

photo
1

Currently it's done somehow on Softaculous, it can install Ghost and run it with no issues.

photo
1

For now I've just installed nodeJS outside cPanel and use pm2 to manage the servers. No GUI for the cPanel users and needs some mod_proxy configuration for it to work without opening extra ports.


So Apache does the proxying for me on a subdomain or a subfolder and proxies that traffic to localhost:3000 for example.


There is enough documentation available to make it work this way.


But of course it would be nice if this could be integrated in cPanel.


P.S. I keep saying this on several features...this feature could also be implemented using Docker without extra effort from cPanel. https://features.cpanel.net/topic/dockerio-support

photo
1

Hello,


The difficult part here is that you define the port in the nodejs application. It means that customers could potentially just change the port and block someone elses application.


We're now waiting for Cloudlinux to finish implementing virtual networking which should help resolve this issue.


It's not very safe to allow customers to choose their own ports on a shared server.

photo
1

My customers don't have shell access, so they are not able to administer the nodeJS servers or use the pm2 interface. Also they don't have the ability to create their custom mod_proxy configuration to forward the port to from their virtual domain in apache.


So indeed this means extra work for our administrators, however I'm able to offer nodeJS hosting on a set of cPanel servers with all the other benefits from cPanel. It is still manageable for now, but an interface for customer related actions would be nice.


Maybe an interesting point to discuss is the amount of nodeJS servers that should be available to customers or how that should be managed.

I now don't accept more then 1 nodeJS per (sub)domain to keep things manageable. However I've had some requests of multiple nodeJS servers.

photo
1

You don't need shell access to modify the port in a nodjs script, just FTP access.

photo
1

Reloading the node server to reflect the new variable cannot be done through FTP.


Also, node will take the first port which is set (environment variable). Other settings in files will then not be used.

photo
1

Unless you disable Perl and also disable php functions and disable cron jobs it could actually be reloaded quite easily if it's run with that acoount's user

photo
1

Oh and here are some things we've started to look at when administering the node servers becomes too much of a hassle...


For storing and overriding customer configurations you could have a look at nconf (https://www.npmjs.com/package/nconf).


Also PM2 seems to have options to pass environment variables to the node server when starting them. So in that way you might also have the option to pass listen ports and bind to a specific localhost IP (i.e. 127.0.0.13 = customerA; 127.0.0.14 = customerB). Segregation can be done in several ways.

photo
1

What about running a docker container from cpanel?


Any thoughts in this direction?

This will allow to run the user anything.

photo
1

That's what CloudLinux is working on at the moment, not hosted on the cPanel server but using CloudLinux's future virtual IP address capabilites to limit access to that application in a secure way. Last time I heard from them about this, they said they were hopeing to have a public beta at the end of June.


The issue here isn't actually running the application but more having an internal IP per user so you can say who can access that port and who can't.

photo
1

I've made a reference to Docker some posts back in this thread.


https://features.cpanel.net/topic/dockerio-support


Indeed Docker is a possible solution not only for this feature, but several others.

photo
1

Programming world is changing. You have to add this options to your costumers. Because many people now looking for services like heroku digitalocean vs...

photo
1

I agree, not supporting these things quickly, will put who/cpanel in the same club as myspace. BTW You are not supporting this quickly. Also NOSQL db's like mongodb need to supported as well. I'm aware that there are challenges making these things shareable in your model but cloud based VM's will leave you guys in the dust pretty soon. If you don't come up with something.

photo
1

@Paul, well stated. I think the hosting market is bifurcating - cPanel will always be the choice of Bluehost, Hostgator, etc. and that's probably where the money is. But developers - and the hosting companies that cater to them - will ever-more rapidly abandon it (or have already) for the new tools/models that are now proving themselves every day. I think cPanel knows this, which is why you're not seeing any action here, and why you probably won't in my opinion. It doesn't serve the vast majority of their end users.

photo
2

In an Ajax world, node is so much better than PHP.

photo
2

node.js needed here. I am just customer and mu provider uses Cpanel. I need running node.js..

photo
1

plus one for this request from me as well starting to get requests for it, and i despise installing things "manually"

photo
1

The main issue for nodejs is you need a system to have private ports. Nodejs scripts can be started on any port meaning you can't reserve ports and stop customer's from using another customer's port.


Cloudlinux's kernel has some form of virtual port system that they will be using with Kuberdock. Providing each user with a private IP and allowing them to use any port they want on that IP is the only way I can see this working securlyand without conflict.

photo
2

Cloudlinux announced that they will soon be working on a Nodejs selector as well as the ability to allocate ports per customer :)


https://www.cloudlinux.com/cloudlinux-os-blog/entry/8-fabulous-feature-improvements-in-the-works-for-cloudlinux-os

photo
1

How do we get this in ASAP what else is needed to get this pushed as a new feature?

photo
1

Hey all! While this is on our radar, it's not currently on our roadmap. We would love to be able to provide it, though. If anyone has a current tutorial for getting it set up and working on a cPanel system, I'd love to see it!

photo
1

Best example I've seen in use currently is Softaculous's implementation of it running Ghost. We played around with it in a test environment (we aren't using Softaculous currently but I was curious to see it). Not sure how much of that code for getting it to run is encrypted or if there might be some way of working with them, however I can say it required nothing to be setup in advance server-side to support so however they're doing it they're installing node directly into the user's directory (and of course it assumes ports are open). There might even be a proxy aspect to their implementation, it's been awhile since I looked at it. Personally I think something like this is right up CloudLinux's alley so I'm looking forward to them offering the functionality.

photo
1

I think you guys should be very cautious to look at current implementations as these are most likely workarounds to get things working within cPanel. NodeJS hosting or similar situations are things you should really think through from an architectural perspective. Only then will you be able to deliver a stable and future proof solution.


In my own situation, I have configured Apache to proxy port 80 requests for a certain virtual host to a different port on localhost or to a specific (extra) localhost adapter on which a NodeJS server is listening for that user. Then I use PM2 to manage all the Nodes and keep them running.

In my situation I can keep this secure, but I'm sure this is not a safe way for the bigger hosting companies.


> create a system so the user can switch between regular html serving or proxy to a NodeJS, using Apache to proxy is an option, however NGINX does a better job in this use case.

> create a system so each user has it's own localhost adapter (if NodeJS is activated for that user)

> create a system which securely bonds/proxies port 80 to the user specific port and adapter

> create a system with which the user can interface with (only) it's own Nodes (stop/start/reload, etc)

> create a system which does the regular houskeeping for the Nodes, start after a reboot, notify on crashes, prevents excessive system loads (per user), logging and logrotation, etc.


This is why I think a Docker like system for only the webserving would be a nice way to go. You would have to create a similar system, however everybody can run it's own container and then choose whatever webserver software they like. Build 1 or 2 default containers which will be supported by cPanel (default Apache/PHP/etc), and let the pro's do their own stuff in their own container.

photo
1

There is no secure way to my knowledge.

Each node script is it's own server on which the user defines the port.

To make it secure you need each user to have it's own private network so the user can create a server that listen's to the user's IP only, allowing the user to choose any port without any worry about having port conflicts.

Without using virtualisation technology (docker or lxc…) I don't see how it could be made secure.

CloudLinux is working on a secure way to run nodejs, I can't see cPanel managing this.


cPanel could give user's a port per application, but would not have a way to make sure another user doesn't steal this port.

photo
1

4 years ago I've talked for a solution to this kind of issue, it's simple, a make a roadmap to make a cPanel Cloud solution with a WHM master and multiple cPanel slaves, each slave running different services, for example, a slave with Apache and other slave for nodejs.


Maybe with this image you will understand


85270feb8ea6c56169af9a901aa0ec48

photo
1

Things are already moving in that direction, albeit much much slower than I'd like, as we've been saying about it for about 14 years now! It's one thing hsphere got right, very right.

photo
1

Django, Nodejs, etc... are not a option in the current way cPanel is developing this software.

We need a new design based in master and slaves. This will permit to create a Django slave or a Nodejs slave without security issues that is the main restriction in the current design.

To follow on this request, please, vote here: https://features.cpanel.net/topic/multiple-cpanel-slaves-under-whm-masters-cpanel-cloud

Regards!!

photo
1

The biggest issue we see here is, one bad client writing bad code, shuts down Node.js. Yes, while this is possible with Apache, php, etc, its not as easily done.

photo
9

Good news everyone! One of our teams has expressed interest in adding node.js support, and has added this feature to their backlog. If all of the stars align we might see this land as soon as version 68. If the stars don't align we won't see this feature before early 2018, but I should be able to give you an updated timeline by the middle of September. I'll be back then to tell you how things are going!

photo
3

This is fantastic news for a lot of users!

photo
2

Great, let's hope those stars align :)

photo
1

Awesome news! I hope those stars align, fingers crossed! :D

photo
3

Hey all! This unfortunately isn't going to make it into version 68, which means it won't get attention anytime before version 72. I'll be posting a Dev Update on Thursday that will explain a bit about what we're doing with version 70, so watch the cPanel blog for more information on that. If you have any other questions, don't hesitate to let me know!

photo
2

Hey all! This is still on our list of goals but isn't scheduled yet. The EasyApache team is getting restructured a bit, and hopefully, we'll have a better idea about when this might be coming out when that's complete. They just completed some work that you can see on the Release Site for version 72. Right now they're working on getting Tomcat support added to EasyApache 4 to help the last stragglers move of before EasyApache 3 goes end of life in December. Once we have more information we'll be back to share it!

photo
1

@Benny Any ETA yet on when this plans to be added? Will you guys also be adding support for other Node addons at the same time such as Socket.io? And will it be per-account on the cPanel server or a shared environment. Would love to offer this feature to my customers and take advantage of it myself for some chat modules.

photo
1

No updates yet, but as soon as I have one I'll definitely share it here! For anyone using CloudLinux, they did add Node.JS support earlier this year and Igor spoke about it at the cPanel Conference.

photo
1

Any updates on this at all? More and more I am looking forwards to it and while CloudLinux does offer it, my current webhost even though they are running CloudLinux says it can not be installed as it will cause conflicts with other modules and that I should wait until Cpanel comes out with their own module.

Would really love to hear at least some time frame so that I either know like okay it's worth to stick with alternatives for another half year or move to another webhost that actually supports it natively.

Thanks in advance for further information!

photo
6

Good news everyone! The EasyApache team was able to get this work scheduled as part of version 80 (expected to start hitting production tiers in Q2 of 2019). As soon as we have a public version for testing on the EDGE tier, we'll be back to let everyone know.

photo
1

Hope it will be released with full environment (MEAN) including mongoDB.

We are also waiting for the same.

photo
2

I sadly don't think MongoDB allows companies with closed source software to install it. It's new licence requires that the whole product is open source. Amazon went as far as building their own "compatible" version to get around this.

photo
1

I would already be happy just with the general flow of having Node as a direct application via cPanel, we can always use other database types that are supported on the server to compensate for Mongo to be honest.


And if it really is a must then you'd be better off just getting a VPN with only that stack installed or so (imo).

Replies have been locked on this page!