Change user running nodebb & other startup issues
-
This works for me on Debian 12.
/etc/systemd/system/nodebb.service
[Unit] Description=NodeBB Documentation=https://docs.nodebb.org After=system.slice multi-user.target mongod.service [Service] Type=forking User=<USER> StandardOutput=syslog StandardError=syslog SyslogIdentifier=nodebb WorkingDirectory=/home/<USER>/nodebb PIDFile=/home/<USER>/nodebb/pidfile ExecStart=/usr/bin/node loader.js Restart=always [Install] WantedBy=multi-user.target
-
Thank you for your answers. I'll be trying these changes later today and will report back.
-
try to use PM2 https://pm2.keymetrics.io
-
@PitaJ said in Change user running nodebb & other startup issues:
There shouldn't be a problem with chown/chmoding the files directly, but you could always make a copy first instead.
Yes, there is a problem. I probably need to make some other changes besides chowning the nodebb directory and files, but I don't know what. I get the following errors
nodebb@sv:/home/homeuser/nodebb$ ./nodebb start node:internal/modules/cjs/loader:1147 throw err; ^ Error: Cannot find module '/home/homeuser/nodebb/nodebb' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v20.11.0
-
@Jakub-Urbanowicz
After reverting ownership to homeuser the forum starts correctly. -
Changing the user is hard. Perhaps I will remove privileges from the existing user instead.
-
You should probably move the NodeBB files out of
homeuser
'shome
if You're not planning on homeuser running it. -
@PitaJ said in Change user running nodebb & other startup issues:
You should probably move the NodeBB files out of homeuser's home if You're not planning on homeuser running it.
Yeah, seems so. Could you give me a gist of what steps I would need to take to move nodebb to e.g. /var/www, please?
-
@B-738 said in Change user running nodebb & other startup issues:
try to use PM2 https://pm2.keymetrics.io
PM2 does much more than just start an app. Do you think I will need to change NginX proxy settings if I start nodebb with it? What if I increase the number of workers with pm2 scale app x?
-
@Jakub-Urbanowicz said in Change user running nodebb & other startup issues:
@PitaJ said in Change user running nodebb & other startup issues:
You should probably move the NodeBB files out of homeuser's home if You're not planning on homeuser running it.
Yeah, seems so. Could you give me a gist of what steps I would need to take to move nodebb to e.g. /var/www, please?
mv /home/user/nodebb /var/www/nodebb
-
@Jakub-Urbanowicz I recomend to all use Caddy web server instead of Nginx ! Much better and simple , also be default use SSL (https) and do automatic update of ssl from letencrupt
OS FreeBSD
DataBase MongoDB
NodeJS NPM
PM2
Best proxy SSL server Caddy
GoLang -