Troubleshooting Forever and port 4567
-
Continuing this discussion.
So when I start NodeBB using forever start app.js, I expect that the default NodeBB port will show up in an nmap scan. But that does not seem to be the case with one of my servers, so that when I attempt to connect to the application, I get an error message of the type below.
014/03/18 23:19:26 [error] 9921#0: *148 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: site.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "site.com"
Now I realize that the reason the connection is being refused is because the port is not open. Why?
Why would the port not be open even after starting NodeBB? And where within the NodeBB installation can I look for possible cause of this. The settings in config.json are shown below.
{ "base_url": "http://site.com", "port": "4567", "use_port": true, "secret": "secret", "bind_address": "0.0.0.0", "database": "redis", "redis": { "host": "127.0.0.1", "port": "6379", "password": "secret3", "database": "0" }, "bcrypt_rounds": 12, "upload_path": "/public/uploads", "relative_path": "" }
Any clues.
-
Interesting angle, but, no, the firewall is not in play here. Even it were the firewall, I could still see open ports in the output of nmap or netstat. It's not showing up in either.
That brings up another question on logging in NodeBB. Aside from the error.log file, there's no detailed logging taking place. At least none that I can see. The events.log file appears to contain activities captured from ACP. other that that, nothing. The logs directory is empty.
-
Ok, I found the log files and I think the contents point to something very wrong. I compared the contents of the log files in my local installation that's working to the production installation that's not:
Here's the output from a log file in the local install:
info: Initializing NodeBB v0.3.2 info: * using configuration stored in: /var/www/forum/config.json info: * using redis store at 127.0.0.1:6379 info: * using themes stored in: /var/www/forum/node_modules info: [user.startJobs] Registering User Jobs warn: [plugins/nodebb-plugin-markdown] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. warn: [plugins/nodebb-plugin-mentions] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. warn: [plugins/nodebb-widget-essentials] staticDir is deprecated, use staticDirs instead warn: [plugins/nodebb-theme-lavender] staticDir is deprecated, use staticDirs instead warn: [plugins] filter:server.create_routes is deprecated and will maintain limited functionality until 0.4x warn: [plugins] filter:admin.create_routes is deprecated and will maintain limited functionality until 0.4x info: [themes] Compiling templates info: [themes] Successfully compiled templates. info: NodeBB attempting to listen on: 0.0.0.0:4567 info: NodeBB Ready
The last 2 lines give an indication that NodeBB is listening on it's default port, though it only says that it is attempting to listen on: 0.0.0.0:4567, not that it is actually listening. That's the subject of another topic, so I'll let it be for now.
Now, here's the contents of the production Forever log file.
[plugins] filter:server.create_routes is deprecated and will maintain limited functionality until 0.4x warn: [plugins/nodebb-plugin-sso-github] "callbacked" deprecated as of 0.4x. Use asynchronous method instead for hook: filter:auth.init error: [app] Encountered Uncaught Exception: meta is not defined ReferenceError: meta is not defined at Object.GitHub.getStrategy (/forum/node_modules/nodebb-plugin-sso-github/library.js:22:7) at /forum/src/plugins.js:329:32 at /forum/node_modules/async/lib/async.js:249:13 at iterate (/forum/node_modules/async/lib/async.js:134:13) at Object.async.eachSeries (/forum/node_modules/async/lib/async.js:150:9) at Object.async.reduce (/forum/node_modules/async/lib/async.js:248:15) at Object.Plugins.fireHook (/forum/src/plugins.js:316:12) at /forum/src/routes/authentication.js:117:12 at Object.Plugins.ready (/forum/src/plugins.js:57:4) at Object.Auth.createRoutes (/forum/src/routes/authentication.js:116:11) error: [app] Could not restart server. Shutting down. info: [app] Shutdown (SIGTERM/SIGINT) Initialised. info: [app] Database connection closed. info: [app] Shutdown complete. error: Forever detected script was killed by signal: null error: Forever restarting script for 223 time info: NodeBB v0.3.2 Copyright (C) 2013 DesignCreatePlay Inc. info: This program comes with ABSOLUTELY NO WARRANTY. info: This is free software, and you are welcome to redistribute it under certain conditions. info: info: Time: Thu Mar 20 2014 13:48:02 GMT-0500 (CDT) info: Initializing NodeBB v0.3.2 info: * using configuration stored in: /forum/config.json info: * using redis store at 127.0.0.1:6379 info: * using themes stored in: /forum/node_modules
Notice that there's no entry about compiling templates or starting NodeBB at the default ports.
Does this output tell you anything? Why does the script terminate at the point just after starting Redis?
-
-
Output from
./nodebb upgrade
npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! code E404 npm http 304 https://registry.npmjs.org/nodebb-plugin-markdown npm http 304 https://registry.npmjs.org/nodebb-widget-essentials npm http 304 https://registry.npmjs.org/nodebb-plugin-color npm http 304 https://registry.npmjs.org/nodebb-plugin-dailymotion npm http 304 https://registry.npmjs.org/nodebb-theme-lavender npm http 304 https://registry.npmjs.org/nodebb-plugin-emoji-extended npm http 304 https://registry.npmjs.org/nodebb-plugin-42 npm http 304 https://registry.npmjs.org/nodebb-plugin-finder npm http 304 https://registry.npmjs.org/nodebb-plugin-emailer-local npm http 304 https://registry.npmjs.org/nodebb-plugin-openid-steam npm http 304 https://registry.npmjs.org/nodebb-plugin-sketchfab npm http 304 https://registry.npmjs.org/nodebb-plugin-linkcheck npm http 304 https://registry.npmjs.org/nodebb-plugin-sso-github npm http 304 https://registry.npmjs.org/nodebb-theme-vanilla npm http 304 https://registry.npmjs.org/nodebb-plugin-sso-facebook npm http 304 https://registry.npmjs.org/nodebb-plugin-sso-google npm http 304 https://registry.npmjs.org/nodebb-plugin-vimeo npm http 304 https://registry.npmjs.org/nodebb-plugin-twitter npm http 304 https://registry.npmjs.org/nodebb-plugin-youtube npm http 304 https://registry.npmjs.org/nodebb-plugin-sso-twitter npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /forum/npm-debug.log npm ERR! not ok code 0
-
npm ls nodebb-plugin-sso-github
[email protected] /forum āāā [email protected] extraneous
-
Something new and maybe related. Never saw before.
make: Entering directory `forum/node_modules/hiredis/build' CC(target) Release/obj.target/hiredis/deps/hiredis/hiredis.o CC(target) Release/obj.target/hiredis/deps/hiredis/net.o CC(target) Release/obj.target/hiredis/deps/hiredis/sds.o CC(target) Release/obj.target/hiredis/deps/hiredis/async.o AR(target) Release/obj.target/deps/hiredis.a COPY Release/hiredis.a CXX(target) Release/obj.target/hiredis/src/hiredis.o make: g++: Command not found make: *** [Release/obj.target/hiredis/src/hiredis.o] Error 127 make: Leaving directory `forum/node_modules/hiredis/build' gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) gyp ERR! System Linux 3.11.0-12-generic gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd forum/node_modules/hiredis gyp ERR! node -v v0.10.26 gyp ERR! node-gyp -v v0.12.2 gyp ERR! not ok npm WARN optional dep failed, continuing [email protected] npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field.
Significant, right?
After installing g++ using
apt-get install g++
and re-running./nodebb upgrade
, that error was not repeated.