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.



  • I have looked at the syslog file and NodeBB's error.log file, but there's nothing in those about the issue.

    Is there an unknown file that Forever writes to to show what it's doing?

    Anybody...


  • Admin

    As far as I know, forever doesn't handle port opening, but the http module in Node does. Are you running a firewall? Perhaps your server has iptables set up to block all connections on every port, even localhost requests.



  • @julian

    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.


  • Admin

    Using forever start app.js, the NodeBB output is captured into forever's logging system. Use forever start loader.js to send the output to /logs/output.log.

    You can find the forever log files in ~/.forever/



  • @julian

    Ok, I'll take a look at it and see if it will tell me anything useful.



  • @julian

    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?


  • Admin

    Looks like your github plugin is out of date. If you're on latest NodeBB, please update it to use the latest version. The accidental global meta was fixed a month ago at least šŸ˜ø



  • @julian

    I have a bunch of plugins installed. Is there a single command that will update all installed plugins at the same time?


  • Admin

    Sure thing: ./nodebb upgrade



  • @julian

    Well, before starting NodeBB with Forever, I git-pulled and upgraded, so that should have taken care of that. Obviously, it did not.


  • Admin

    ... son of a b-... I swore I fixed it along with fb/tw/g+. Give me one second. Turns out psychobunny wrote the original GH SSO, and it is up to date...

    What version of the plugin are you running? npm ls nodebb-plugin-sso-github



  • @julian

    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
    


  • An outdated plugin shouldn't really stop the entire application from starting.



  • npm ls nodebb-plugin-sso-github

    @julian

    nodebb@0.3.2 /forum
    ā””ā”€ā”€ nodebb-plugin-sso-github@0.1.0-1  extraneous
    

  • Admin

    npm install nodebb-plugin-sso-github@0.1.0-2



  • @julian

    Done. What next? Another ./nodebb upgrade or just run forever start app.js again?


  • Admin

    Give it another run through (./nodebb start && ./nodebb log), and let's see what happens. If you want to stop NodeBB after, ./nodebb stop



  • 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 hiredis@0.1.16
    npm WARN package.json connect-redis@1.4.5 No repository field.
    npm WARN package.json express-namespace@0.1.1 No repository field.
    npm WARN package.json nodebb-plugin-linkcheck@0.0.3 No repository field.
    npm WARN package.json reds@0.2.4 No repository field.
    

    Significant, right?

    After installing g++ using apt-get install g++ and re-running ./nodebb upgrade, that error was not repeated.



  • @julian

    That triggers non-stop logging to the console. How can I send it to a file?


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.