I'm trying to setup upstart to run with my Node js and Socket.io server.
/etc/init/quizens.conf
env NODE_BIN=/usr/bin/node
env APP_DIR=/root/quizens
env SCRIPT_FILE="quizens.js"
env LOG_FILE=/root/quizens.log
env RUN_AS="root"
start on filesystem
stop on shutdown
respawn
respawn limit 1 10
script
touch $LOG_FILE
chown $RUN_AS:$RUN_AS $LOG_FILE
chdir $APP_DIR
exec sudo -u $RUN_AS sh -c "$NODE_BIN $SCRIPT_FILE >> $LOG_FILE 2>&1"
end script
When I run start quizens
in the log file I get Cannot find module fb....
altough if i simply start the server from command line it works. The modules are installed with -g and they reside in /usr/lib/node_modules
I can't find a problem while on my local machine it works like a charm, but not when putting it on a softlayer instance.
The difference is that the local machine Node is installed in /usr/local/bin/node not in /usr/bin/node. Is this the problem?
EDIT: Yesterday I added another IP for the instance. I don't know if this has anything to do with upstart...