Keep Meteor running forever


I am trying to deploy my app on production servers and want to keep it running on my CentOS. I am running it using tmux, but it stops after some time.


I use the forever npm module to keep my meteor app running on my CentOS VPS so instead of node start main.js, I have forever start main.js and it works beautifully.

Hope this helps,


Forever and PM2 are both good options. You could use mup to deploy, but that only works on Debian-flavored Linux servers.

1 Like

Try running kadira and check the performance.

I had some issues running it on digital ocean’s basic 512 MB server. Could run for a day and then suddenly run out of memory. WIthout much traffic. Running on 1g is going without a hitch so far though. These requirements may differ with CentOS. My box was Ubuntu.

Yeah. Running my app on a few 1G droplets on DigitalOcean.

Make SURE you add swap space to your instance as that can allow things to run a bit more gracefully for peak times when you might bump up close to the 1G memory limit.

– Jimmy

That’s strange, I’ve got a few fairly light-weight Meteor apps running on a single VPS, and each of them only takes up about 150MB RAM. They’ve been running for weeks. (Ubuntu 14.04 Server)

Hi, we are using Supervisord to control our meteor instances. This works pretty well and you can also define number of processes, logfiles etc. If sometimes the process will break supervisord will restart it.

Also you get a nice service shell tool like

> supervisorctl status

> supervisorctl start/stop myapp


Bundled for production or just in debugMode?
I didn’t bundle it. Just needed it running for a demo I was going to do. Crashed on me a few hours before the demo. Bad timing! :wink: So increased the memory, and it has been running since. Remember that Ubuntu takes up a good chunk of those 512 MB. So there’s only around 350MB left for ubuntu!

Was able to do it with forever. Following are the steps I followed:


On our local root folder of your app type the following command

meteor build --directory

upload the tar file on server in following directory:


create a directory for the build and copy the .gz file there

tar -xzvf file.tar.gz

cd /home/username/projects/bundle/programs/server
export PORT=3000(Port)
export MONGO_URL=mongodb://urlto/db
export ROOT_URL=
export MAIL_URL=smtp://email:password@smtp.url:port/
npm install

cd /home/shahvit/projects/bundle/programs/server
npm install bcrypt

yes | cp -rf /home/username/projects/bundle/programs/server/node_modules/bcrypt /home/username/projects/bundle/programs/server/npm/npm-bcrypt/node_modules/

cd /home/username/projects
forever start bundle/main.js

1 Like

Use tmux. It is very easy, short (this - by Minh Nguyen):

# a new tmux session will be created and you'll notice a green bar at the bottom of the terminal
# start your Meteor app: (e.g. "meteor --port 3000")
# press CLTR and B, :, and "detach" to detach the session
# Type "tmux list-sessions" to see the session you just created 
# You can join your session by typing "tmux attach-session -t <number>"