问题
In the docs the procedure to run meteor on your own server is to run
meteor bundle bundle.tgz
Then extract this tarball..
tar -xzvf bundle.tgz
Then start a node server
MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ node bundle/main.js
I'm trying to use forever to keep the node server up, but when I run the following command (specifics obscured), the forever process doesn't return and I have to CTRL+C to get back to the command line - very unforever like.
MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ forever bundle/main.js
If I append an ampersand to run the process in the background then I get back to the command line and everything looks fine, but forever doesn't generate any logs or pid files and eventually the forever process dies.
回答1:
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
回答2:
This is my startup script, 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 it helps someone.
[]s
Auro
来源:https://stackoverflow.com/questions/14529677/what-is-the-proper-syntax-for-running-a-meteor-generated-node-bundle-using-forev