I learn meteorjs and I have a small remote VPS.
I want:
Here is what I do:
description "meteor app server"
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 10 5
pre-start script
set -e
rm -f /path/to/your/app/.meteor/local/db/mongod.lock
end script
exec /bin/su - ec2-user -c '/path/to/your/app/meteor_server.sh'
post-stop script
pkill -f meteor
end script
The meteor_server.sh
script contains:
cd /path/to/your/app/; meteor run -p 3000 --production
Make sure to chmod +x
the meteor_server.sh
script and change the path to your app in the 3 locations. The script also kills all meteor tasks when it is stopped so it works for running a single meteor app only on your server. I got a meteor app running quickly this way using nginx but node seems to consume a lot of memory.