Systemctl fails to restart nodebb, except as root
-
I think I'm running out of oxygen in this rabbit-hole, and starting to think I passed the carrot a LONG time ago...
Basically, since trying to get nodebb to auto-restart on Centos, using systemctl, I've been having issues. Strangely, it restarts just fine when I do it as root, but I don't want to run NodeBB as root for obvious security reasons (multiple websites on my VPS). When I try to start it as a normal user, however, I get this:
I got PLENTY of RAM available:
But the issue seems to be WebAssembly's memory container, which seems to be running out because of the benchpressjs framework. Why, at this front-end, it's successful when I run as a different OS user, is completely foreign to me as I'd think it'd be pretty freekin' transparent at this point. But... I'm not a front-end developer, so... Help?
When I start it as root:
Systemctl .service file (page1):
(page2):
-
What version of Node are you on?
-
@Selroth this is why I use PM2 (node process manager) for process mgmt
start at boot.
restart if fails
can run as specific user
can run anythingcan start/stop/restart via command
works the same on every platform
setup provides a system specific command to install for boot time support.can run multiple processes concurrently
-
@sdetweil Hmm... This sounds like a great plan B! I prefer native tools, but... if I can't get it to work then I'm glad there's alternatives
(Also, looking at it, wow - that's quite neat! Maybe I'll install it anyway, though I think it's currently overkill for my current situation =P)
Thanks for the suggestion!
-
@Selroth said in Systemctl fails to restart nodebb, except as root:
I prefer native tools
+1 for native tooling. No need to reinvent everything under the sun.
Now, as fer' this issue... w/o even digging into it... whenever I run into such symptoms they just scream "Permissions Issue!!"
Which I presume you have already ruled out, but I also note no note of it one way or the other up thread. You DID install/setup NodeBB as your nodebb-user, correct? If not, then please try chown/chmod the dirs and files to your nodebb user as appropriate and see if this helps.
Good luck!
-
You can try checking if just increasing the node memory limit (this is technically not the full limit of what Node can use, but most cases it can be considered that; Also it governs gc, so even if it's not reaching it, who knows, perhaps the issue is caused by aggressive gc) would work: add
--max-old-space-size=<value in MB>
in cli parameters tonode
or via aNODE_OPTIONS=--max-old-space-size=<value in MB>
env var.
I think the default for 64-bit systems is 2GB, but I'm not sure...This obviously isn't a real fix even if it works, but would at least clarify if it needs more memory when running as a non-root user for some reason or if it's purely a permission problem and it'll run out as a user no matter what when it doesn't have proper access to something...
-
Can you try upgrading to Node 18?