What is the correct syntax to run the node created by the meteor packet using forever?

In documents, the procedure for launching a meteorite on your own server is to run

meteor bundle bundle.tgz 

Then extract this archive.

 tar -xzvf bundle.tgz 

Then start the node server

 MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ node bundle/main.js 

I try to use forever to support the node server, but when I run the following command (features are hidden), the eternal process does not return, and I need CTRL + C to return to the command line - very unusual.

 MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ forever bundle/main.js 

If I add an ampersand to start the process in the background, I will return to the command line and everything will look fine, but it will not generate any logs or pid files forever, and ultimately the process will die forever.

+6
source share
2 answers

This works for me:

 export MONGO_URL=mongodb://localhost:27017/<dbname> export PORT=<server_port> export ROOT_URL=http://sub.example.com/ forever start bundle/main.js 
+12
source

This is my script run, called from rc.local:

 #/bin/sh cd /home/nodeapp/ export MONGO_URL=mongodb://localhost:27017/nodeapp export PORT=80 export ROOT_URL=http://$(hostname)/ export METEOR_SETTINGS=$(<settings.json) forever start bundle/main.js 

Hope this helps someone.

[] S

Auro

+7
source

All Articles