First application - SqueeZ on OpenShift

01 Apr 2012
Posted by stylesen

OpenShift is a very cool platform and I got attracted. I wanted to extend my experiment and wanted to onboard an application which I have written. I thought about some ideas which I could code in python and at the same time I can test various features of OpenShift, also I wanted to learn some new web framework in python during this experiment.

I chose to base my application in web.py which is a python based web framework. When I was working for SpikeSource we used to host BangPypers monthy meeting, during that time in one of the meetings Anand Chitipothu the maintainer of web.py introduced the group to this awesome simple framework. Though, I was interested in trying it out after the meet, I never got a chance! Now I made up my mind and wanted to explore web.py and also OpenShift, hence came up with this application called SqueeZ. I went through the tutorials of web.py to get started and found out the way in which web.py handles URLs ie., using regular expression, I wanted to exploit this powerful feature of web.py and thus came up with the idea of SqueeZ which is a URL shortner.

 

SqueeZ: It is an application written on web.py framework which helps in squeezing/shortening long URLs. It also has features such as copying to clipboard and sending the squeezd urls via email. The shorterned URLs will expire automatically after 3 days of creation, which could be configured.

Some of the features which SqueeZ uses in OpenShift are as follows:

  1. A Python-2.6 catridge in order to deploy WSGI web applications.
  2. A MySQL-5.1 database catridge to store information on shorterned/squeezd URLs.
  3. Sending emails from an application installed in OpenShift via an external smtp server.
  4. Cron jobs to cleanup stale URLs every minute (once it expires after 3 days).
  5. OpenShift active hook scripts to deploy and configure the application.

I have created a quickstart file for deploying the SqueeZ application, which makes life easier in order to install SqueeZ in OpenShift Express cloud environment. The git repository located in https://github.com/stylesen/squeez-quickstart acts as the upstream code for SqueeZ application. In order to deploy SqueeZ in OpenShift express platform, follow the directions given below:

Step 1: Create a user account in http://openshift.redhat.com/

Step 2: Login to the OpenShift account created above and then create a namespace.

Step 3: Upload public keys from the machine in which you are currently working.

Step 4: Goto - https://github.com/stylesen/squeez-quickstart and follow the steps indicated in the README.md which appears on the project page.

Step 5: As indicated in the README do the email configuration and test sending email from the application.

Squeez Web Page 

Thus by following squeez-quickstart we have the application installed in OpenShift platform. Even the minutely cron job (a job/script which runs every minute) is setup automatically. A more detailed and visual version of how to install SqueeZ in OpenShift is available via a screencast done by me here - http://vimeo.com/39648273