Tech Blogging‎ > ‎

OpenShift DIY Cartridge and JRuby + Gem Install Problem

posted Mar 21, 2015, 9:26 PM by Haris Hashim   [ updated Mar 29, 2015, 1:25 AM ]
* This is a pleminary and live document. Subject to lots of update!

** To continue with my-note-to-self kinda tech blogging. Just because I have done ruby on OpenShift before, but the knowledge is lost to me because I did not blog about it! The different maybe that this time it is a JRuby stuff through DIY cartridge.

OpenShift + JRuby + Magento

The Journey Begin

I am playing around with OpenShift to create a JRuby remote machine so that I can use RubyRep later to sync MySQL database for Point of Sale synchronization purpose. Plus adding a synced online shop later using Magento if things works out. This will be a long blog later. 
However, keep in mind that me and OpenShift have a long history of things that did not works out. Partially because OpenShift is a fast evolving cloud platform. As you guys can see later, changes happened that make things tougher to occasional explorer like me.

The Step Taken Manually

The step is simple and easy to reproduce.
  1. Prerequisite is to have an OpenShift account.
  2. Create an application using Magento (PHP + MySQL 5.5) cartridge..
  3. Use SSH to access the created application shell (this is a long step, do ask if someone need to know).
  4. Manually install JRuby in ~/app-root/runtime folder by downloading the binary tar file using wget shell command and unzip it in that folder. The download link is in JRuby download page.
  5. After doing this, JRuby is installed. As easy as that. Keep in mind that for JRuby to function JDK is the prerequisite. However Open JDK is already installed in DIY cartridge. So no worries there.
  6. However I got stuck here until a good night sleep clear some fatigue. Apparently the bash scripts located in JRuby bin folder actually depent on other application installed in that folder. The scripts do not function since path was not set. So adding "export PATH=$PATH:{path to JRUBY/bin}" finally make things work!
  7. Frustratingly, the thing that I need to work is "jgem install rubyrep" or in other way "jruby -S gem install rubyrep". The error is:
    • "ERROR:  While executing gem ... (SocketError)"     bind: name or service not known" 

The Step with Quickstart Cartridge

  1. With above not working, tried another way that should solve the problem. Previously searching about JRuby and OpenShift give me a result about JRuby "unofficial" quickstart cartridge for OpenShift. Can be found bellow in GitHub
  2. The step can be found in above page. Generally, first create an application using DIY cartridge.
  3. Optional, use rhc to add MySQL 5.5 cartridge to the application (additional from me, not in the quickstart). 
  4. Merge source code from above github with  DIY cartridge code.
  5. Commit and push it to OpenShift. As a note here, I am using Eclipse plugin for git and OpenShift operation. This in itself deserve a very long blog. Request in comment if anyone interested.
  6. So right here I got stuck with the same error.
    • "ERROR:  While executing gem ... (SocketError)"     bind: name or service not known" OpenShift JRuby Quickstart Error
  7. Troubleshooting, searching, pending solution <==== this is where I am now!

The Conclusion So Far

My instinct is that OpenShift, change or add a strict policy about using out bound ports. Base on my initial (manual) effort that fail and the quickstart cartridge that fail with same error. Logically, that quickstart cartridge must work previously. Otherwise it wont be posted on GitHub as a quickstart cartridge for JRuby on OpenShift. 

Back on my earlier comment that OpenShift is a fast evolving cloud platform. Let me throw in another thought. That this is one of the growing pain of OpenSource. Being opensource, information are shared freely. But, when change happened (and those change easily happened very fast), those information are usually not updated.

So back to the drawing board. More searching on the internet and asking question on OpenShift should help. Crossing my finger that this is solvable.

Comments & Feedback

The gadget spec URL could not be found