Installing NodeBB on Google Cloud Platform



  • Hey everyone,

    I've installed nodeBB on a virtual machine on Google Cloud Platform. My config file is:
    {
    "url": "http://google_external_ip:4567",
    "secret": "xxx",
    "database": "mongo",
    "mongo": {
    "host": "google_internal_ip",
    "port": "27017",
    "username": "",
    "password": "",
    "database": "nodebb"
    }
    }

    ./nodebb dev has no errors
    ./nodebb start works, and ./nodebb log says the server is listening

    The only warnings i get are:
    10/9 14:44 [14936] - warn: You have no mongo password setup!
    warn: [socket.io] Clustering detected, you are advised to configure Redis as a websocket store.

    I'm not using redis, so I don't think the warnings above are an issue. The installation completed successfully, and nodebb created its collections in the mongodb database.

    I've tried multiple restarts of nodeBB, trying with google's external IP, internal IP, localhost and 127.0.0.1 (mongodb only works with the internal IP), also with bind_address set to each of the above.

    Still, I can't access http://external_ip:4567, it just gives a timeout.

    Firewall rules are set to allow port 4567 both tcp and udp. I'm also running a nodejs server and nginx restarts it whenever it's down/reboot. I'm forwarding all requests from port 80 to port 8000(node.js's port). I can access my angular application @ http://google_external_ip/
    I've also tried disabling and stopping node.js and nginx, but I still can't access nodebb.

    Any ideas on how to debug this?

    Thanks,
    Raydekk



  • When you did

    ./nodebb setup
    

    when it asked about your server did you put
    http://externalIP

    or did you leave it at localhost?



  • Yes I used the external_ip:4567.
    I ran the setup multiple times with external_ip:port and internal_ip:port. I don't think I ran the setup with localhost and 127.0.0.1 but I did change the config.json file with all these values for the url parameter and restarted nodebb.

    Doesn't modifying the json and then restarting nodebb have the same output as running setup?


  • Translator

    Running setup downloads some additional files and does some more work in the back. You're fine editing the config if setup is atleast done once before



  • ok, I think I solved it.

    Apparently, after executing commands like

    sudo firewall-cmd --zone=public --add-masquerade --permanent
    sudo firewall-cmd --zone=public --add-forward-port=port=80:proto=tcp:toport=8000 --permanent
    sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8000

    somewhat screwed up the firewall rules in the google console. The catch was that I could only acces the website from port 80, by trying to acces it from 8000(node's actual) didn't work. I deleted the rules, and added them again in the platform console (Networking->Firewall rules) and then restarted nodebb and it worked!




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