What is the proper syntax for running a meteor generated node bundle using forever?

孤者浪人 提交于 2020-01-01 05:24:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!