Getting jive-sdk to play nice with OpenShift

Version 1

    This document is to help you figure out how to make a jive-sdk nodejs application work on an OpenShift server. The reason you need to do this is because the add-on needs to be publicly accessible and OpenShift provides an easy way to get this done.

     

    Note: I use RHC because it is easy...

    1. install rhc if you have not already... Installing OpenShift RHC Client Tools | OpenShift by Red Hat (If this fails installing the docs, it's ok, ignore it)
    2. go to the directory you want to house your application directory in (such as Documents/Openshift/)
    3. $ rhc app create <application name> nodejs-0.10   (Note that application name must be only alphanumeric characters)
      • If it fails to create the git repository, follow the steps it suggests, they generally work... mine was to just run "rhc git-clone <application name>"
    4. cd <application name>
    5. git rm *
    6. git commit -m "removal of initial files"
    7. copy your code into the folder
    8. Now comes the fun part...
    9. Modify startServer function in app.js to the following:
      • var startServer = function () {
            var ipaddress = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
            var port      = process.env.OPENSHIFT_NODEJS_PORT || 8080;

            if ( !jive.service.role || jive.service.role.isHttp() ) {
                var server = http.createServer(app).listen( port || 8080,
                                    ipaddress,
                                       function () {
                    console.log("Express server listening on port " + server.address().port);
                });
            }
        }; 
    10. Modify jiveclientconfiguration.json to add/modify the following (The port MUST be 80 as that's what is open on the OpenShift Servers)
      • "clientUrl": "<server url copied from rhc>",
        "port": "80",
        "development": true, 
    11. Modify package.json to add the following line (if you changed the name to something other than app.js, then use that instead)
      • "main": "app.js", 
    12. git add *
    13. git commit -m "initial code push"
    14. git push
      • This should upload all of your files to the OpenShift server and then auto start the application
    15. scp <ip given when you created the app>:~/app-root/repo/extension.zip <location you want the zip to be>
    16. upload this zip to the addons of Jive and it should connect!