Tuesday, January 16, 2018

River5 running in OpenShift.com

A confluence of things came together last night and is worthy of sharing.
  • I'm a long time fan of RSS readers
  • Dave Winer has been talking up his river-of-news RSS aggregator (river5)
  • A desire to sharpen my dev skills on OpenShift
So last night I got River5, a nodejs app, running in OpenShift and it was pretty straightforward to do. Basically, change the port river5 listens on from the default 1337 to 8080, as required by OpenShift. Then a handful of OpenShift steps to pull source from github, have it automatically build and then run in the public cloud.   For hacking around I used a private OpenShift cluster but provide the steps below to get it running in Red Hat's OpenShift.com environment.
  1. Fork my version of Dave's river5 github repo by using the github.com website.  My changes are minor - config.json to change the port and add my OPML exported from feedly.com.  Also added a new file, feedly.opml, of my feeds.  
  2. Download / install the OpenShift CLI on your desktop.  I use RHEL/Fedora for my desktop, but Windows/Mac versions are also available from here
  3. Signup for a free starter account on openshift.com
  4. Once you have logged in to openshift.com, click in the upper right under your identity in the dropdown for "Copy Login Command"
  5. The next few steps are done in a terminal
    1. Login command looks something like this
      $ oc login https://api.starter-us-west-2.openshift.com --token=XXXXXX-XXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXXXXX
    2. Create a project (think kubernetes namespace) to hold your application
      $ oc new-project my-river5 
    3. Create the new application from source on github (modify to reference your own repo)
      $ oc new-app https://github.com/MarcNo/river5
    4. Watch the build
      $ oc statusand
      $ oc logs -f bc/river5or use the OpenShift GUI
    5. Once complete, expose the service to the external network
      $ oc expose svc/river5
    6. Find out what the URL
      oc get routes
  6. Check it out!
Keep in mind this is just the minimum to get started.  A complete solution would include keeping data on persistent storage, perhaps shared storage for multiple river5 instances to share, etc.

Full disclosure, I'm a Red Hat Associate.