Installation on OpenShift Online v3



  • Hi there !

    There are big differences between OpenShift version 2 and 3, now the service work mostly with Docker and Kubernetes features, instead of simple gears.

    So here's my attempt to install NodeBB and Redis database using Openshift.

    First I created a new project :

    oc new-project community-dev --display-name="Community Development Project" --description="Development project for community using NodeBB and Redis"
    

    Then I built and deployed a Redis instance :

    oc new-app --docker-image=nodebb/docker:centos-redis --name="redis" --labels="dedicated=nodebb"
    

    NodeBB build :

    oc new-app --image-stream=nodejs:4 --code=https://github.com/NodeBB/NodeBB.git#v1.1.2 --name="nodebb" -e database=redis,redis__host=redis,redis__database=0,port=8080
    

    I also gived to Redis a persistent storage volume

    oc volume dc/redis --add --name="redis" -t pvc --claim-name="redis" --claim-size=1G
    

    I finally exposed the nodebb service using port 8080

    oc expose service nodebb -l app=nodebb
    

    This gives me an URL to see nodebb instance

    result

    But the page still like this

    alt text

    I was wondering if the problem occurs because NodeBB tries to kill the process node loader.js, since it's the process used in npm start which is the default command to start with OpenShift. If we kill this process, the pod is automatically restarted.

    This is the log from the pod :

    Environment: 
    	DEV_MODE=false
    	NODE_ENV=production
    	DEBUG_PORT=5858
    Launching via npm...
    npm info it worked if it ends with ok
    npm info using npm@2.15.1
    npm info using node@v4.4.2
    npm info prestart nodebb@1.1.2
    npm info start nodebb@1.1.2
    
    > nodebb@1.1.2 start /opt/app-root/src
    > node loader.js
    
    1/9 18:56 [32] - info: Launching web installer on port 8080
    1/9 18:56 [32] - info: Web installer listening on http://0.0.0.0:8080
    

    Is there a possiblity to start nodebb in an other way without forking the github repo ?

    Thank you.



  • Since ./nodebb start command run in background, OpenShift seems to fail in loop, because for him the command the process is terminated. So I just changed npm start command in package.json

    "scripts": { "start": "./nodebb setup && ./nodebb dev" }
    

    I need to fork the entire repo only for this line, which is a bit sad. Could be nice to have something like an environment variable to start nodebb in a blocking way.



  • Has anyone managed to get it working ? Build keeps failing with latest version.


  • Admin

    Does openshift rely purely on npm start? Is it not possible to specify some other command?



  • It does only rely on npm start for node applications



  • @julian the image that v3 uses for node is here:
    https://github.com/sclorg/s2i-nodejs-container/

    And I'm gonna bet the rhel files like this blob:
    https://github.com/sclorg/s2i-nodejs-container/blob/71085a522eda89031ba15b907c3dec07be4a9b0b/6/Dockerfile.rhel7

    Is responsible for your npm start...

    Actually eyeballing this it looks like what this is suggesting is that command they're running is actually
    npm run start

    If changing the scripts "start" is all that's needed, and start is actually hardcoded in the nodejs image that's being used, we could fork the nodejs image, change the "start" script to <something>

    and then
    "scripts": {"<something>": "./nodebb setup && ./nodebb dev" }

    or whatever works.

    I can confirm that the current master branch https://github.com/NodeBB/NodeBB/commit/a2508161c6eeb715a2ea6e626d1697df76641547 fails to build as well*

    That's a bit seperate from getting it to launch at start though.

    Then for future releases of NodeBB and instructions all that'd need to be replaced is this line:
    oc new-app --image-stream=nodejs:4 --code=https://github.com/NodeBB/NodeBB.git#v1.1.2 --name="nodebb" -e database=redis,redis__host=redis,redis__database=0,port=8080

    w/ the forked nodejs github as opposed to the docker image

    Scratch the last bit* looking at the usage of the image file NPM_RUN is an environmental value that can be set, so
    oc new-app --image-stream=nodejs:4 --code=https://github.com/NodeBB/NodeBB.git#v1.1.2 --name="nodebb" -e database=redis,redis__host=redis,redis__database=0,port=8080,NPM_RUN=<something>

    Might be all that's needed?



  • how to edit to "scripts": { "start": "./nodebb setup && ./nodebb dev" } . where is it. a newbe here . please help.


Log in to reply
 


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