openshift deployment
-
@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 itGet the value of the ENV_VAR
echo $OPENSHIFT_NODEJS_IPand 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"], -
@TILT Absolutely right!
-
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 passwordSorry about the dumb questions, but i'm getting crazy about this error.
PS: Excuse me for my bad english and thanks in andvance.
-
@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.
-
@Tom-Riddleff Thank you very much. I will try it that way. Thanks for the explanation.
-
@José-Ángel-Rey-Liñares Ok. Poke me if any.
-
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"
} -
@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:
At this point i'm kind of lost. Any help is really appreciated.
Thanks in advance.
-
@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)
-
@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.)nodebb-english/installing/cloud/openshift.rst at master · NodeBB/nodebb-english
English documentation for NodeBB. Contribute to NodeBB/nodebb-english development by creating an account on GitHub.
GitHub (github.com)
No need for hacks!