openshift deployment
-
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:
- URL used to access this NodeBB (http://nodebb-XXXXXX.rhcloud.com)
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 [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No description
[email protected] node_modules/connect-redis
└── [email protected] ([email protected])[email protected] 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 -
@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!