Running Node app on Laravel Forge?
I'm new to JS/Node and my question is mainly around deployment: keeping the Node process running. How can I make Node code deploys as painless as PHP apps on Forge? Being new to JS, my primary issue is handling node process:
-
My deploy script on Forge has
npm run startat the root of my app, however I understand this is the wrong approach as I need to terminate the current node process aftergit pull. Bonus: Is it possible to do "hot code pushes" without restarting the node process? My current deploy script (suggestions are welcome):cd /home/forge/node-app git pull origin master npm install npm run start echo "" | sudo -S service php7.1-fpm reload -
Supervise the node process to ensure it stays alive after server reboots or app crashes.
If any devs here already have a proper node deployment set up please help a beginner out, it would be much appreciated :)
Posted Jun 30, 2017, 6:24 AM UTC
There's a utility, available on npm, called forever. Give that a go.