Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

meteor

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.

like image 886
petrocket Avatar asked Jan 25 '13 20:01

petrocket


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
like image 184
Mandar Limaye Avatar answered Sep 28 '22 06:09

Mandar Limaye


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

like image 32
Auro Avatar answered Sep 28 '22 06:09

Auro