Redhat OpenShift is another interesting PaaS

My friend Alex Ott left a comment on my blog yesterday asking me if I had looked at OpenShift.

I had created an account a while ago but never did anything with it. This morning I briefly tried getting Clojure (not yet supported) running but promptly gave up and switched to Ruby, which along with Java, Python, Node.js, and Perl is supported. It only seemed fair to test Redhat's PaaS with a supported stack.

By default Ruby 1.8.7 is supported with a lot of gems pre-installed. I preferred to use RVM and Ruby 1.9.3 so I:

  • I created a new empty "Do-it-yourself" Cartridge using the web console. I was prompted to add a public key, etc. Easy setup.
  • A new empty cartridge runs a trivial Ruby web app.
  • I followed Mark's instructions to install RVM and Ruby 1.9.3.
  • After that, a git commit and a git push redeploys your app.
  • You should take a careful look at .openshift/action_hooks/* that are places where you can customize builds and deployments.
Using Mark's instructions, I temporarily modified .openshift/action_hooks/pre_build to look like this:
cd $OPENSHIFT_DATA_DIR
curl -L https://raw.github.com/xiy/rvm-openshift/master/binscripts/install-rvm-openshift.sh | bash -s
After that, I re-edited it to look like:
#cd $OPENSHIFT_DATA_DIR
#curl -L https://raw.github.com/xiy/rvm-openshift/master/binscripts/install-rvm-openshift.sh | bash -s

source $OPENSHIFT_DATA_DIR/.rvm/scripts/rvm
rvm use 1.9.3-p125@global

gem install sinatra rails mongo mongo_ext
After installing some gems I commented out everything in this file for future reference. I then edited .openshift/action_hooks/start to look like this:
source $OPENSHIFT_DATA_DIR/.rvm/scripts/rvm
rvm use 1.9.3-p125@global

gem list
ruby --version
nohup $OPENSHIFT_REPO_DIR/diy/testrubyserver.rb $OPENSHIFT_INTERNAL_IP $OPENSHIFT_REPO_DIR/diy > $OPENSHIFT_LOG_DIR/server.log 2>&1 &
The last line was originally in the generated file. Once this is all working, you can replace the placeholder mini-app with a Sinatra or Rails app.

There have been no announced costs for using OpenShift. For now it is in a free beta period. It is reasonable for Redhat to want a lot of test users so they can measure what it costs for them to provide the various services and then announce costs.

Comments

  1. How about Clojure? Is the setup for Clojure as easy for RoR on OpeShift?

    ReplyDelete
  2. Hello Dmitry, yesterday I just tried a quick experiment with Clojure and it did not work for me. That said, I just spent 30 minutes on it and that included learning how to use the OpenShift command line tools, etc. Later yesterday I did two Ruby tests that worked fine and tried one of their canned JBoss Java EE 6 projects which also was easy to install, modify and redeploy.

    I have a server dedicated to running my Clojure + Noir projects so I am not motivated to spend time on Clojure and OpenShift right now. I bet that if you wait a week or two someone will publish a nice working example. It should be fairly easy.

    ReplyDelete
  3. Here's a how-to that might help you get Clojure up and running: http://philipp.meier.name/blog/2012/06/11/run-clojure-web-apps-on-redhats-openshift/

    [Sorry if I commented twice - logged in with too many different google accounts in a single browser :) ]

    ReplyDelete

Post a Comment

Popular posts from this blog

My Dad's work with Robert Oppenheimer and Edward Teller

Time and Attention Fragmentation in Our Digital Lives

I am moving back to the Google platform, less excited by what Apple is offering