[jboss-user] [JBoss Tools] - Deploy to OpenShift with an iPad…

Max Rydahl Andersen do-not-reply at jboss.com
Wed Dec 28 09:10:25 EST 2011


Max Rydahl Andersen [http://community.jboss.org/people/maxandersen] modified the blog post:

"Deploy to OpenShift with an iPad…"

To view the blog post, visit: http://community.jboss.org/community/tools/blog/2011/12/28/deploy-to-openshift-with-an-ipad

--------------------------------------------------------------
h3. …or any other DropBox enabled tablet...

I was trying to locate a Git client for iOS to allow easy editing of OpenShift repositories from my iPad but did not manage to find anything but some barebone github viewers.

Instead I started playing around with Hazel, DropBox, OpenShift and my iPad and I managed to create a little “Cloud IDE” to enable editing +and+ deployment to OpenShift from my iPad.

  http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17665/openshiftonipad.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17665/310-405/openshiftonipad.png 

Note, I use Hazel and an iPad in this blog which unfortunately makes it Mac/OSX specific but you should be able to do this on any OS and tablet as long as you have something similar to Hazel that can execute commands based on changes to a directory and your tablet have an DropBox enabled editor. If you have such a setup on a another OS/tablet combo I would love to hear about it in the comments.

Finally, in this blog I assume you already have git installed to be used from your machine. How you setup your OpenShift application, wether with  http://vimeo.com/33988381 JBoss Tools or  https://openshift.redhat.com/app/express command line clients is not relevant for this usecase - only necessary to have git working for this.
Once you have that the remaining steps are as follows:
h1. Setup DropBox
Download and install  http://db.tt/FajYPdr DropBox - this link is a  http://db.tt/FajYPdr reference link and both you and I get 250 MB extra bonus space if you are creating a new DropBox account.

DropBox should be installed on a machine that is “always” online or at least while you want edits done on your iPad to take effect.
Then git clone your favorite OpenShift application into a sub-directory within your DropBox, i.e. here is what I did to get my app named super into code on my DropBox:
cd ~/DropBox/code
git clone ssh://yourprivateid@super-man.rhcloud.com/~/git/super.git/

If you do not know your git URL you can use rhc-user-info to find it.

Once you have the content on DropBox verify that it is possible to deploy to OpenShift from the machine. Edit a file and execute
git commit -a -m "1-2-3 testing"
git push origin

If that completes without errors your DropBox machine is ready to run.
h1. Setup Hazel
Download  http://www.noodlesoft.com/hazel.php Hazel on the same machine as you have DropBox setup and running on and add a rule that looks like the following for the directory where you want the script to be executed:

 http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17666/hazel_codeexec.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17666/450-344/hazel_codeexec.png  

The conditions are:
* Extension is sh
* “Date Last Modified” “is after” “Date Last Matched”

and when it finds a file matching these criteria then setup an action that does the following:

“Run Shell Script ”embedded Script":
touch $1.running
sh $1 &> $1.log
rm $1.running
touch $1.log
exit 0


The Hazel rule is straight forward. It executes any updated .sh files on the machine and in the process it creates a temporary ‘.running’ marker file to let you know it process is running and then pipe all the log output to a .log file and finally exit with status 0 since the actual script could fail but that should not be treated by Hazel as an error.
h1. Add ‘short-cut’ scripts
To avoid too much annoying typing on your tablet I suggest you create a commitpublish.sh with the steps necessary to do a commit and push for your OpenShift application.

For my super app I created a commitpublish.sh with the following content:
cd super
git commit -a -m "Committing via DropBox"
git push origin

You can also add other useful shortcuts such as an status.sh that gives you latest log for your app:

rhc-ctl-app  -c status -a super -p <yourpassword>
h1. Edit & Deploy via iPad
For the actual editing and deployment you should be able to use any DropBox enabled editor such as DropText, PlainText, etc. but I ended up using  http://itunes.apple.com/us/app/koder/id439271237?mt=8&ls=1 Koder since it was the only one I could find that had nice syntax highlighting and a good and fully functional DropBox integration.

Once you have configured a DropBox project in Koder you cans simply edit the content.

 http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17667/editindexxhtml.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17667/450-228/editindexxhtml.png  

Once you are ready to publish it to OpenShift simply edit the commitpublish.sh file and make sure to Upload the file to DropBox and Hazel will take action and get it published.
  http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17668/editcommitpublish.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17668/450-169/editcommitpublish.png 

Once the command and publish have completed you should be able to refresh in Koder and see a ‘commitpublish.sh.log’ file with the output.

 http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17669/checklog.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17669/450-124/checklog.png 

If it completed succesfully you should now be able to see the result in a browser for your OpenShift application.

 http://community.jboss.org/servlet/JiveServlet/showImage/38-4400-17670/resultinbrowser.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/38-4400-17670/450-216/resultinbrowser.png 

Have fun and do leave a comment if it works out for you or if you got an alternative for the above.

Happy New Year!
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/community/tools/blog/2011/12/28/deploy-to-openshift-with-an-ipad]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111228/b3604885/attachment-0001.html 


More information about the jboss-user mailing list