Pages

Wednesday, April 2, 2014

OpenShift – Getting Started

As you are aware OpenShift is
It is a free, cloud-based application platform for Java, Perl, PHP, Python, and Ruby applications.”.

Developers when they want to deploy a application, then will deploy the war or ear file by starting their respective web or application containers. In their local environment they have to start their containers when they need to deploy their application. Often developers don’t understand why it will take time for deploying application in production Environment.OpenShift comes in here.

OpenShift is an application platform in the cloud where application developers and teams can build, test, deploy, and run their applications.OpenShift takes care of all the infrastructure, middleware, and management and allows the developer to focus on what they do best: designing and coding applications.

OpenShift Enterprise provides developers and IT organizations an auto-scaling cloud application platform for quickly deploying new applications on secure and scalable resources with minimal configuration and management headaches. This means increased developer productivity and a faster pace in which IT can support innovation.

OpenShift offers services as Platform-as-service(PAAS). Platform as a Service, often simply referred to as PaaS, is a category of cloud computing that provides a platform and environment to allow developers to build applications and services over the internet. PaaS services are hosted in the cloud and accessed by users simply via their web browser. 

In OpenShift the code is managed in a GIT repository.

Every application OpenShift gets its own private GIT repository. This allows you to maintain history and easily perform rollbacks if they accidentally push broken code. It also enables a distributed work environment and provides an easy way to publish code (GIT push).

The runtime requirements are provided by a set of cartridges with a standard set of configurations. The cartridges provide languages runtimes like ruby, jboss, php etc and other services like databases and continuous integration functions. Additional cartridges can easily be added for functionality that does not come with base OpenShift.

OpenShift also allows the developer to ssh into the application and check log files and see exactly what processes are running.

OpenShift uses SElinux policies, PAM namespaces and bind mounts to ensure that applications don’t have access to unapproved files or processes. Unlike unix permissions, the SElinux model prevents access to files and processes unless explicitly approved in a policy.

Application resources are also controlled by c-groups, quota and other modules. This ensures that one application does not hog all resources on the VM.

Installing the necessary Pacakges

Red Hat Enterprise Linux 6 or later
Root access or at least sudo to root access
Ruby version 1.8.7 or later
RubyGems

The packages are available by default with Redhat 6.Use YUM to install these packages. We need to have rubygem-json and rubygem-parseconfig packages too. As I said earlier we need to have a root access for performing these actions.

The OpenShift packages will be available by default with the Redhat 6 version. We can use YUM to check whether packages are available or not.

If we don’t have the packages available ,we  can create a repo file where we can install the packages manually

cat <<EOF> /etc/yum.repos.d/openshift-origin-deps.repo
[openshift-origin-deps]
name=openshift-origin-deps
baseurl=http://mirror.openshift.com/pub/origin-server/release/3/rhel-6/dependencies/x86_64/
gpgcheck=0
enabled=1
EOF

For RHEL systems you will need to include the EPEL (Extra Packages for Enterprise Linux ) repository to install puppet. To do so install the latest epel-release package.

RHEL6
yum install -y --nogpgcheck ${url_of_the_latest_epel-release_rpm}

We can download the EPEL package from http://mirrors.fedoraproject.org/publiclist/.

Be sure to select the correct package for your system architecture. For example, the latest package for a 64-bit x86 system architecture at the time of this writing is epel-release-6-5.noarch.rpm.

We need to update the operating system to have all of the latest packages that may be in the yum repository. This is important to ensure that you have a recent update to the SELinux packages that OpenShift Origin relies on. In order to update your system, issue the following command:

yum clean all
yum -y update

We will get all the necessary packages.

How does the OpenShift works

OpenShift Online provides disk space, CPU resources, memory, network connectivity, and an Apache or JBoss server to create, deploy, and manage applications in the cloud. For most types of applications, OpenShift Online creates a file system layout that you can use as a template for building an application.

There are 2 important components called

Gears are containers for application code where cartridges run.
Cartridges provides the functionality to run the application

The following gear sizes are available with OpenShift Online:
  • Small gears provide 512MB of RAM, 100MB of swap space, and 1GB of disk space
  • Medium gears provide 1GB of RAM, 100MB of swap space, and 1GB of disk space
  • Large gears provide 2GB of RAM, 100MB of swap space, and 1GB of disk space

For free plan, we have 3 small gears (provide 512MB of RAM, 100MB of swap space, and 1GB of disk space)

Controlling OpenShift
There are two mechanisms available for interacting with OpenShift Online: the Management Console and the command line interface (CLI), referred to as the Client Tools. We can use the rhc command line tool to create domains , create applications and manage them. The same thing can be done with the Management Console too.


More to Come , Happy working in Cloud

No comments :

Post a Comment