Thursday, 23 June 2016

Deploy your code residing on github to OpenShift

# Usecase : There is an existing application code in your github/gitlab repo and you want to deploy it on your choice of application server(JBoss EAP) running on OpenShift.

Source-To-Image (S2I) is a standalone tool which is very useful when creating builder images. As the name suggests we will be taking the source code from our git repository and will create a docker image using it. Once image is created we can assign this image to a container, which would be running the version of the code which we fed to S2I.

OpenShift Allows to create applications wither using `oc` command line utility or directly through the management console. First it requires a project to be created, which contains the applications, services and routes.

Here is how you can create a project and an application using `oc` utility.


  
  $ oc login $MASTER_SERVER_URL -u $USERNAME -p $PASSWORD
  $ oc new-project demo
  $ oc new-app eap64-basic-s2i \
        --param=APPLICATION_NAME=ticket-monster \
        --param=SOURCE_REPOSITORY_URL=https://github.com/nikhilmone/ticket-monster.git \
        --param=SOURCE_REPOSITORY_REF=2.7.0.Final \
        --param=CONTEXT_DIR=demo


You can also create the project and application from thre management console, as shown below :

Login to management console with your credentials and create a project.



Now add an application to your newly created project. You see below templates which you can choose from as your base image:



I chose `jboss-eap64-openshift:1.1`, since I want to deploy a J2EE application on JBoss EAP 6.4, which I have aleady created.
[](https://github.com/nikhilmone/jboss-eap-quickstarts.git). Then I choose branch name as `6.4.x` and the sub-directory as `kitchensink`. These two things are completely optional and you can skip this if your git repository is not too complex.



Click on advanced and configure your routing, deployment and build config. I have kept all the options default as I want to expose my application on public internet and want to trigger build and deployment after a code push.



Submit the information above and a new application is created. In this page you can see a `git webhook` that you can set in your github repo. So that as soon as you push the new code to git repo, a rest call will be made to your master server and a new build will e triggered, which eventually triggers a new deployment as well.


Let's click on `Go to overview` link and it takes you to this page. Here you can see a build is triggered.



Click on `view logs`


You can also tail the logs from `oc` command line utility. Simply do :

 $ oc get pods
 $ oc logs $POD_NAME



Now the build is successful and finished. Let's run `oc get pods` again and we can see OpenShift has triggered a deployment. You can tail the logs again if you wish.


Let's go to overview page again. We can see the application is deployed and has been exposed as service via a route.


Let's click on the service url and it takes us to the application landing page.


Done. You have a application running in cloud !! :)

Wednesday, 22 June 2016

OpenShift : Platform as a Service by Red Hat

OpenShift is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment. With OpenShift you have a choice of offerings, including online, on-premise, and open source project options. Please refer below for all the documentation related to OpenShift :

https://docs.openshift.com/enterprise/3.0/welcome/index.html

## OpenShift 3 Architecture :















We will be going through multiple usecases through the series of blog posts.


Tuesday, 22 December 2015

Basic JDK tools and utilities

As an Application Admin/ developer and Architect, we need to know basic functionalities of JDK tools to run, configure, manage and monitor java applications. I tried to list few of them and would describe them in next blogs.

javac        The compiler for the Java programming language.

java          The launcher for Java applications.

javadoc    API documentation generator.

apt           Annotation processing tool. See Annotation Processing Tool for  program annotation processing.

appletviewer    Run and debug applets without a web browser.

jar    Create and manage Java Archive (JAR) files.

jdb    The Java Debugger.

javah    C header and stub generator. Used to write native methods.

javap    Class file disassembler

extcheck    Utility to detect Jar conflicts.

keytool    Manage keystores and certificates.

jarsigner    Generate and verify JAR signatures.

policytool    GUI tool for managing policy files.

native2ascii    Convert text to Unicode Latin-1.

rmic    Generate stubs and skeletons for remote objects.

rmiregistry    Remote object registry service.

rmid    RMI activation system daemon.

serialver    Return class serialVersionUID.

tnameserv    Provides access to the naming service.

idlj    Generates .java files that map an OMG IDL interface and enable an application written in the Java programming language to use CORBA functionality.

orbd    Provides support for clients to transparently locate and invoke persistent objects on servers in the CORBA environment. ORBD is used instead of the Transient Naming Service, tnameserv. ORBD includes both a Transient Naming Service and a Persistent Naming Service. The orbd tool incorporates the functionality of a Server Manager, an Interoperable Naming Service, and a Bootstrap Name Server. When used in conjunction with the servertool, the Server Manager locates, registers, and activates a server when a client wants to access the server.

servertool    Provides ease-of-use interface for the application programmers to register, unregister, startup, and shutdown a server.