TurnKey Linux Virtual Appliance Library

node app as daemon

Cem Incecinar's picture

Hello,

I dont know am i asking a naive question or not but i was trying to find out something in NodeJS appliance. "Includes custom nodejs initscript for running node app as daemon" as stated but cant figure it out where it is, how can i found the initscript and documentation about it to learn how i can use it in appliance.

Thank you

Github:Gist has a Daemonizer

https://gist.github.com/1065350 promises to daemonize. I get an error, however. I don't if it's the script or my total ignorance.


Cem Incecinar's picture

Its included already

Appliance says its included already so im just looking where it is

http://www.turnkeylinux.org/nodejs

Check Features

Jeremy's picture

Do any of the links on the 'Control Panel' page help?

Please note I have not used the NodeJS appliance so it is a case of blind leading the blind!

Perhaps there are links to relevant references on the 'Control Panel' page?

Otherwise if the daemon is already started you could check using a command like 'ps aux|grep node' and see what that returns. If it is running (and includes node in it's name) it should show up and hopefully with a path. You could also try something like 'ps aux|grep tklweb' (as the appliance page states that Node is installed to /opt/tklweb-cp so perhaps that's what it is called?)

Another thought is that AFAIK daemons require an init script (which should be found in /etc/init.d) and often (but not always) daemons have their settings defined in /etc/defaults. These could be places to look for the init script.

If you can find the script but it still means nothing to you, feel free to post it and I am willing to try to help you decode it (although no promises on whether or not I will be able to be of any help).

Whelp

I've had to start my node site (in opt) with npm start /path/to/site & in rc.local for the timebeing. Looking for a better way.


Alon Swartz's picture

Sorry for the terribly late reply...

The initscript that's included in all nodejs based appliances is located at: /etc/init.d/nodejs

It sources /etc/default/nodejs looking for NODEJS_EXEC, which is then used to start the app.

For example, in the nodejs appliance:

nodejs# cat /etc/default/nodejs
NODEJS_EXEC=/opt/tklweb-cp/run.sh

nodejs# cat /opt/tklweb-cp/run.sh
#!/bin/sh

cd `dirname $0`
node app.js

BTW, the etherpad appliance is configured with NODEJS_EXEC=/opt/etherpad/bin/safeRun.sh

Hope the above helps...

Cem Incecinar's picture

Thank you for reply

Thank you for reply even its late. That will be more usefull.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)