openshift deployment


  • Translator

    hi guys!
    I'm getting stuck with the launching nodebb on openshift. on the final stage when I do start the app - I get the error listening EACCES, despite I strictly follow the steps.
    has anyone experience same issue?
    could you please advice how can I solve it?


  • Community Rep

    @Tom-Riddleff I'm not sure will it help or not, but you could try to

    $ cd /path/to/your/NodeBB/
    $ chown -R mega:mega * 
    

    Instead of mega:mega, of course, put appropriate linux username:usergroup

    If it won't help you, then copy-paste your console log here.


  • Translator

    @Mega Thank you for your feedback!
    Unfourtunately it doesn't help.

    Here is the log with the caught error:
    24/1 05:43 [372716] - info: NodeBB v0.6.0 Copyright (C) 2013-2014 NodeBB Inc.
    24/1 05:43 [372716] - info: This program comes with ABSOLUTELY NO WARRANTY.
    24/1 05:43 [372716] - info: This is free software, and you are welcome to redistribute it under certain conditions.
    24/1 05:43 [372716] - info:
    24/1 05:43 [372716] - info: Time: Sat Jan 24 2015 05:43:51 GMT-0500 (EST)
    24/1 05:43 [372716] - info: Initializing NodeBB v0.6.0
    24/1 05:44 [372716] - error: Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at module.exports.listen (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/src/webserver.js:136:18)
    at /var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:656:23
    at fn (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:641:34)
    at Object._onImmediate (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:557:34)
    at processImmediate [as _immediateCallback] (timers.js:330:15)
    Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at module.exports.listen (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/src/webserver.js:136:18)
    at /var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:656:23
    at fn (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:641:34)
    at Object._onImmediate (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:557:34)
    at processImmediate [as _immediateCallback] (timers.js:330:15)
    24/1 05:44 [372716] - error: Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at module.exports.listen (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/src/webserver.js:136:18)
    at /var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:656:23
    at fn (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:641:34)
    at Object._onImmediate (/var/lib/openshift/54c26f0f5973ca552000011f/app-root/runtime/repo/node_modules/async/lib/async.js:557:34)
    at processImmediate [as _immediateCallback] (timers.js:330:15)


  • Translator

    I assume I did some mistake during the setup.

    This step of tutorial is not quite clear. Cuz Setup doesn't require you to provide 'IP or Hostname to bind to'. Probably it applies for the old versions. I use 0.6.x

    '''
    IP or Hostname to bind to: Enter what your $OPENSHIFT_NODEJS_IP value holds here found in >step 4.
    '''

    Here is setup data I used:

    BTW should I add a port to the URL?

    • Please enter a NodeBB secret (9d810ea3-f957-4d1f-aeeb-XXXXXXXXXX)

    • Host IP or address of your Redis instance (127.10.126.130)

    • Host port of your Redis instance (16379)

    • Password of your Redis database

    • Which database to use (0..n) (0)

    24/1 06:22 [22832] - info: Configuration Saved OK
    npm WARN package.json nodebb-plugin-dbsearch@0.1.0 No repository field.
    npm WARN package.json reds@0.2.4 No repository field.
    npm WARN package.json socket.io-client@1.2.1 No description
    npm WARN package.json socket.io-redis@0.1.4 No description
    connect-redis@2.0.0 node_modules/connect-redis
    └── debug@2.1.1 (ms@0.6.2)

    redis@0.10.3 node_modules/redis
    24/1 06:23 [22832] - info: Populating database with default configs, if not already set...
    24/1 06:23 [22832] - info: Previous theme detected, skipping enabling default theme
    24/1 06:23 [22832] - info: Administrator found, skipping Admin setup
    24/1 06:23 [22832] - info: Categories OK. Found 4 categories.
    24/1 06:23 [22832] - info: Enabling default plugins
    24/1 06:23 [22832] - info: Beginning database schema update
    24/1 06:23 [22832] - info: [2014/10/31] Applying newbiePostDelay values skipped
    24/1 06:23 [22832] - info: [2014/11/6] Updating topic authorship sorted set skipped
    24/1 06:23 [22832] - info: [2014/11/7] Renaming sorted sets skipped
    24/1 06:23 [22832] - info: [2014/11/11] Upgrading permissions skipped
    24/1 06:23 [22832] - info: [2014/11/17] Updating user email digest settings skipped
    24/1 06:23 [22832] - info: [2014/11/29] Updating config.json to new format skipped
    24/1 06:23 [22832] - info: [2014/12/2] Removing register user fields skipped
    24/1 06:23 [22832] - info: [2014/12/12] Updating teasers skipped
    24/1 06:23 [22832] - info: [2014/12/20] Updating digest settings skipped
    24/1 06:23 [22832] - info: [upgrade] Schema already up to date!

    A couple warnings, nothing serious. Overall Setup status OK. Right?
    It should work 🙂 but it doesn't.



  • @Tom-Riddleff
    Did you manage to fix it? I'm having the same issue on OpenShift


  • Translator

    @TILT hi
    The only solution I found is to hack webservers.js file by overwriting the port and IP variables with the respective $Openshifts variables



  • EDIT:
    The guide has been updated since the writing of this post, no need to hack files
    https://github.com/NodeBB/nodebb-english/blob/master/installing/cloud/openshift.rst


    It worked for me aswell, didn't have the chance to debug and fix it otherwise.
    I think it might be useful for other people to know how to fix it

    Get the value of the ENV_VAR
    echo $OPENSHIFT_NODEJS_IP

    and put it at line 104 of src/webserver.js as follow
    //args = isSocket ? [port] : [port, nconf.get('bind_address')],
    args = [8080, "127.0.0.1"],


  • Translator

    @TILT Absolutely right! 😃


  • Translator

    Hi,

    I'm having trouble on getting this to work too.

    My problem is that when i execute the node app setup, in the redis password step, even thought I write by hand the redis password (shown by the execution of echo $REDIS_CLI) i get the error that the password is incorrect.

    So, two questions if you don't mind:

    1- The "nodeBB secret" is only a desired password, isn't it?
    2- The redis password is shown in the output of echo $REDIS_CLI like follows: -h ip_redis -p port_redis -a password

    Sorry about the dumb questions, but i'm getting crazy about this error.

    PS: Excuse me for my bad english and thanks in andvance.


  • Translator

    @José-Ángel-Rey-Liñares Hi!
    First try to ssh your app on openshift and type:

    redis-cli $REDIS_CLI

    If redis cartridge installed properly - you have to get in to redis console.
    Then. Compose you json.config file this way(replace appropriate data):

    {
    "url": "http://nodebb-myapp.rhcloud.com",
    "port": "8080",
    "secret": "xxxxxxxxxxxxxxxXXXXXXXXXX",
    "database": "redis",
    "redis": {
    "host": "127.xx.xxx.xxx",
    "port": "1xxxx",
    "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "database": "0"
    }
    }
    And upload it to openshift.

    You can get the redis object data for your config with the following command:

    echo $OPENSHIFT_REDIS_HOST && echo $OPENSHIFT_REDIS_PORT && echo $REDIS_PASSWORD

    Then try to 'nodebb app.js --setup' your application on the server. It'll fetch all the needed data from the config.


  • Translator

    @Tom-Riddleff Thank you very much. I will try it that way. Thanks for the explanation. 😃


  • Translator

    @José-Ángel-Rey-Liñares Ok. Poke me if any.


  • Translator

    And one more.
    I can predict that websockets won't work in scope of defined socket io transports on openshift. The only long polling is running there (Chrome > F12(browser inspector )> Network : will demonstrate it for you.).

    It's because openshift allows websocket connection with the port 8000 only.
    In order to get it work just add the following line in your config.json:

    "socket.io": {
    "address": "http://nodebb-XXXXX.rhcloud.com:8000"
    }


  • Translator

    @Tom-Riddleff Hi again.

    I just modified the config.json file, as you suggested, but i'm istill getting an error when running node app --setup. The error is as follows:

    nodebbInstallationErrorOpenshift.png

    At this point i'm kind of lost. Any help is really appreciated.

    Thanks in advance.


  • Translator

    @José-Ángel-Rey-Liñares That's because of connection to Redis could not be established
    have you tried command: redis-cli $REDIS_CLI

    [Update] Try to execute: node app.js (not node app.js --setup)


  • Translator

    @Tom-Riddleff yes, but i would try it again. Thanks for your help.

    EDITED: I just have been able to make it work. The problem was that when i runned "node app.js --setup" the file config.json got the redis password overriden and set it to blank, so as you pointed out, the database connection could not be stablished.

    Then the problem was with the nodebb port and IP, when establishing the "trust proxy" step. So as you and @TILT explained in this thread i had to edit the file "src/webserver.js" setting the args port value to 8000 as you explained, and the IP of node.js (echo $OPENSIHFT_NODEJS_IP).

    Thank you both @Tom-Riddleff and @TILT for your help.😃 😃



  • The guide has been updated since last we read it.
    Apparently the caveat was to set the bind_address (I'm pretty sure I tried it but only with 0.0.0.)

    https://github.com/NodeBB/nodebb-english/blob/master/installing/cloud/openshift.rst

    No need for hacks!


 

| |