Elegant solution for running a nodejs websocket server on VestaCP system
-
- Posts: 25
- Joined: Wed Sep 09, 2015 7:19 pm
Elegant solution for running a nodejs websocket server on VestaCP system
I have a nodejs websocket server script that I want to deploy on my VestaCP managed server (Ubuntu 16.04)
I could easily start/stop it manually via ssh, but I'd like to integrate it into the VestaCP backend to make it a bit easier to manage, so it will run automatically on startup, also allowing me to start/stop it via the VestaCP web interface if I edit the script or it stops running.
Any suggestions?
Edit:
Maybe an nginx template .sh script? I'm not familiar with these, I assume they're called on web rebuild? And in the script I assume I would need to stop any existing process before starting it to prevent multiple instances.
I could easily start/stop it manually via ssh, but I'd like to integrate it into the VestaCP backend to make it a bit easier to manage, so it will run automatically on startup, also allowing me to start/stop it via the VestaCP web interface if I edit the script or it stops running.
Any suggestions?
Edit:
Maybe an nginx template .sh script? I'm not familiar with these, I assume they're called on web rebuild? And in the script I assume I would need to stop any existing process before starting it to prevent multiple instances.
Re: Elegant solution for running a nodejs websocket server on VestaCP system
Sounds like you're looking at writing a service file which can be controlled by sysvinit (I think for Ubuntu 16) or systemd (I think for Ubuntu 18), so that you could run it with
service mynodeserver start|stop|status
or
systemctl start|stop|status mynodeserver
There will be examples around the internet.
service mynodeserver start|stop|status
or
systemctl start|stop|status mynodeserver
There will be examples around the internet.