Question

I've just setup a Linux CentOS server to run a Meteor application.

The first problem I come across now is starting the meteor process as a Daemon, so it's running in background and I can exit my SSH session.. When starting with meteor --production I can't.

When using Ruby on Rails I could just start with rails s -d -p 80 and exit.

I found out that an app called screen and echo "meteor --production" | at are options, but I do not have the at command installed, and installing an app just for running it in background seems like a weird choice.

Do I really need to install screen or at? Are there any other options?

Was it helpful?

Solution

Meteor Up creates a daemon with these features:

  • Auto-Restart if the app crashed (using forever)

  • Auto-Start after the server reboot (using upstart)

OTHER TIPS

Turns out theres no simple way to run an unbundled Meteor-app. There is always going to be other software involved like screen, tmux or at.

The duplicate of this question explains a lot about the process of running your app after it's bundled.

One piece of software that isn't mentioned there is pm2. I didn't use it yet, just installed it, but it seems like a really great tool to start the app in background and keep it running continuously.

The Demeteorizer project may be a good option for you. It converts a Meteor project into a standard Node.js project.

You can get it at https://github.com/onmodulus/demeteorizer.

You can use the following shell command

$ ROOT_URL="http://yourserver.com" nohup meteor --production -p 8085 >meteor.log 2>meteor.error.log &

Replace 8085 with the port that you want to run it on. If you are running your own mongo instance and do not want to use meteor's bundled mongo, you can also add the MONGO_URL="mongodb://yourserver:port/"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top