Host Your Application For Free (By RedHat's OPENSHIFT)

Dream. Dare. Do – that is Suyati’s work principle in a nutshell.

Nov
22
2013
  • Author:
  • Sharath K Mohan

1.Introduction:

Openshift is RedHat’s cloud computing platform. Developed in 2011 by Redhat, Openshift is one of the most soght after PaaS(Platform As A Service) that is available today.Its written in Ruby and is under the Apache License 2.0.Using Openshift’s free plan users can get upto 1GB of storage per **Catridge and upto 3 *Gears.

2.Setting up your cloud server:

  • First the user has to SignUp at http://www.openshift.com/
  • Once signed up , goto MY APPS and click on “Create your first application now”
  • Then choose the type of programming Catridge ( Zend Server, Php, WordPress, Ruby, Python, and many more).
  • Then the user can get a public URL where the domain name and namespace. The users homepage will be “http://Application name-namespace.rhcloud.com”.
  • Next the user can specify the source code of his application from github(If present), else it will be automatically managed by Openshift itself(a Git code repository will be automatically created in the cloud with default configuration, files and folders).
  • Openshift automatically selects a grear for the application(small, medium or large).
  • The catridge will be automatically selected as the one selected in the first field.
  • The user can also opt for scaling his application(which will be automatically done), the user has also provision for enabling Jenkins (continuous integration tool).
  • Now the user has to provide his public key (As Openshift uses Git version control system, the user can access his repositiory only using SSH protocol.)

To generate the public key:
In Linux-
Open the terminal and type:
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
$ ssh-add id_rsa
Enter passphrase (empty for no passphrase): [Type a passphrase]

Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
$ sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)
$ xclip -sel clip < ~/.ssh/id_rsa.pub # Copies the contents of the id_rsa.pub file to your clipboard

  • After the public key is entered the user will be directed to the homepage, where the user can add supporting database or continuous integration tools for his main Catridge. Note down the username and password that is provided by Openshift for setting up the database or other tools.
  • In the applications homepage “ADD CATRIDGE” can be used to add additional catridges.

Now the cloud server has been setup.
Fig1.2: Openshift user home

3.Working with files:

  • Next clone the Git repository locally.

To clone the repository locally:
Open the terminal and move to the folder where the cloned repostitory is present and type
$ git clone ssh://52778783e0b8cd9390000503@php-newopen.rhcloud.com/~/git/php.git/
# Clones the users repository locally in the present working directory.

  • Now edit the required files and upload into the Git repository using the following commands

To upload the files:
In Linux and in Windows – Open the terminal(Linux) / Github shell(Windows) and move to the folder where the cloned repository is present and type
$ git add .
#adds the files to the queue
$ git commit -m 'your_message'
#saves the changes to the modified files in the queue
$ git push
#uploads the modified files to the Git repository

Multiple applications can be setup in a single namespace.Each gear gets 1GB of allocated space and the maximum number of gears the can be allocated are 3.The gears will scale automatically according to the application(done by Openshift itself). The users index page is the one that is loaded by default.
Fig1.2: Openshift user applications home

4.Read More:

Supported catridges in Openshift:
Java, Php, Zend Server, Python, Ruby, Node.js, Perl.

Supported databases in Openshift:
MongoDB, MySQL, PostgreSQL.

Continous Integration tools in Openshift:
Jenkins Server and Jenkins Client, Cron, SwitchYard.

For more details on Openshift goto https://www.openshift.com/.

*A gear is a package of support tools for the users applciation
**Catridge is framework or components that comprises or makes the application.One or more Catridges can run on a single gear or many gears can handle a single catridge(depends on the scaling).
#This doc has been targeted for the Linux platform.
##There is no guarantee regaring the persistence of this service.

Leave a Comment

Your email address will not be published. Required fields are marked *