starting nodebb with systemd
-
@teh_g this should be helpful: http://unix.stackexchange.com/a/47715
-
@PitaJ said in starting nodebb with systemd:
@teh_g this should be helpful: http://unix.stackexchange.com/a/47715
In Upstart I was using
node loader.js --no-silent --no-daemon
, should I use that same command for theExecStart=
parameter? -
@teh_g try it
-
This is what i do when running my docker pkg in systemd with nodebb (app.js)
[Service]
ExecStart=/usr/bin/docker run --entrypoint su --name nodejs-nimbus-jenkler-com --net local --volumes-from server_nodejs -w /server/nodejs jenkler/nodejs nobody -s /usr/bin/node app.js
ExecStartPre=-/usr/bin/docker kill nodejs-nimbus-jenkler-com
ExecStartPre=-/usr/bin/docker rm nodejs-nimbus-jenkler-com
ExecStartPre=/usr/bin/sleep 10
ExecStop=/usr/bin/docker stop nodejs-nimbus-jenkler-com
Restart=on-failure
RestartSec=120s
TimeoutStartSec=0I start /usr/bin/node app.js as the nobody user! If somebody else runs nodebb in docker with another take, plz speak up. The app.js way works fine for me except for restarting via the webb ui. I guss i need loader.js for that
Note
If i use loader.js instead of app.js the application wont exit correctly when systemd runs ExecStop. I get some strange exit code and docker get an error. I guess thats because loader is a wrapper for app.js! Correct me if I am wrong!
To answer the question run:
ExecStart=/usr/bin/node app.js
I guess you need to change dir also. I do that with docker -w /server/nodejs jenkler/nodejs.
-
You pass in
--no-daemon
and--no-silent
because Upstart works best if the program itself is run interactively, with output sent tostdout
.However, I don't recall if systemd is different...
If it works best run interactively, use
--no-daemon
.If it reads output from stdout (which I believe it does), then use
--no-silent
.