I tried also to start from the official Dockerfile with some edit, another error (EADDRINUSE
).
Dockerfile
FROM node:lts
WORKDIR /nodebb
ENV NODE_ENV=production
RUN apt-get update && apt-get install git -y
RUN git clone https://github.com/NodeBB/NodeBB /nodebb \
&& cp install/package.json /nodebb/package.json
RUN npm install --only=prod && \
npm cache clean --force
ENV NODE_ENV=production \
daemon=false \
silent=false
EXPOSE 4567
CMD node ./nodebb build ; node ./nodebb start
Error after the web configuration
2020-05-25T09:02:27.704Z [4567/154] - info: Initializing NodeBB v1.13.3 http://sub.domain.tld
2020-05-25T09:02:29.383Z [4567/154] - info: [socket.io] Restricting access to origin: http://sub.domain.tld:*
2020-05-25T09:02:29.723Z [4567/154] - info: Routes added
2020-05-25T09:02:29.725Z [4567/154] - info: NodeBB Ready
2020-05-25T09:02:29.728Z [4567/154] - info: Enabling 'trust proxy'
2020-05-25T09:02:29.730Z [4567/154] - error: NodeBB address in use, exiting...listen EADDRINUSE: address already in use 0.0.0.0:4567 {"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"0.0.0.0","port":4567,"stack":"Error: listen EADDRINUSE: address already in use 0.0.0.0:4567\n at Server.setupListenHandle [as _listen2] (net.js:1313:16)\n at listenInCluster (net.js:1361:12)\n at doListen (net.js:1500:7)\n at processTicksAndRejections (internal/process/task_queues.js:85:21)"}
2020-05-25T09:02:29.732Z [4567/154] - error: uncaughtException: listen EADDRINUSE: address already in use 0.0.0.0:4567
Error: listen EADDRINUSE: address already in use 0.0.0.0:4567
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at doListen (net.js:1500:7)
at processTicksAndRejections (internal/process/task_queues.js:85:21) {"error":{"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"0.0.0.0","port":4567},"stack":"Error: listen EADDRINUSE: address already in use 0.0.0.0:4567\n at Server.setupListenHandle [as _listen2] (net.js:1313:16)\n at listenInCluster (net.js:1361:12)\n at doListen (net.js:1500:7)\n at processTicksAndRejections (internal/process/task_queues.js:85:21)","exception":true,"date":"Mon May 25 2020 09:02:29 GMT+0000 (Coordinated Universal Time)","process":{"pid":154,"uid":0,"gid":0,"cwd":"/nodebb","execPath":"/usr/local/bin/node","version":"v12.16.3","argv":["/usr/local/bin/node","/nodebb/app.js"],"memoryUsage":{"rss":137650176,"heapTotal":109584384,"heapUsed":80475200,"external":1559251}},"os":{"loadavg":[3.6689453125,2.95263671875,2.63623046875],"uptime":13644475},"trace":[{"column":16,"file":"net.js","function":"Server.setupListenHandle [as _listen2]","line":1313,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"net.js","function":"listenInCluster","line":1361,"method":null,"native":false},{"column":7,"file":"net.js","function":"doListen","line":1500,"method":null,"native":false},{"column":21,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":85,"method":null,"native":false}]}
2020-05-25T09:02:29.733Z [4567/154] - error: listen EADDRINUSE: address already in use 0.0.0.0:4567 {"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"0.0.0.0","port":4567}
2020-05-25T09:02:29.733Z [4567/154] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
2020-05-25T09:02:29.735Z [4567/154] - error: Error [ERR_SERVER_NOT_RUNNING]: Server is not running.
at Server.close (net.js:1604:12)
at Object.onceWrapper (events.js:416:28)
at Server.emit (events.js:322:22)
at emitCloseNT (net.js:1657:8)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
at runNextTicks (internal/process/task_queues.js:66:3)
at processImmediate (internal/timers.js:429:9)
[cluster] Child Process (154) has exited (code: 1, signal: null)
[cluster] Spinning up another process...
The config file generated after the web installer is:
{
"url": "http://sub.domain.tld",
"secret": "2fe83efb-3317-4e9e-98c4-b590353711df",
"database": "redis",
"port": 4567,
"redis": {
"host": "nodebb-redis",
"port": "6379",
"password": "",
"database": "0"
}
}
If I try to stop:
# node ./nodebb stop
NodeBB is already stopped.
If I search for running processes:
b# ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 4268 616 pts/0 Ss 09:06 0:00 /bin/sh -c node ./nodebb build ; node ./nodebb start ; bash
root 91 0.0 0.0 18172 2076 pts/1 Ss+ 09:06 0:00 bash
root 99 0.0 0.0 606504 25060 ? Ssl 09:08 0:00 node loader.js
root 117 0.6 0.2 967676 97928 ? Sl 09:08 0:04 /usr/local/bin/node /nodebb/app.js
root 183 0.0 0.0 18176 2092 pts/0 S 09:08 0:00 bash
root 258 0.0 0.0 36624 1524 pts/0 R+ 09:19 0:00 ps -aux
It seems that nodebb is already running, but why?