Sunday 29 March 2015

KonaKart Community Edition virtualized by Delphix Landshark 2.0

KonaKart virtualized!


Delphix capability to virtualize applications is amazing!

After some brainstorming I've decided to try to use Delphix Landshark Demo 2.0 to virtualize e-commerce application.

What is KonaKart?

KonaKart is enterprise e-commerce java application. It is adopted by companies that are very well recognizable. See here: http://www.konakart.com/customers/




Sample Screenshot from KonaKart Community edition.

The idea behind

Let us imagine we want to create test/development numerous instances of KonaKart application with almost no storage and time cost. We want to create, synchronize and destroy test instances on demand in seconds.
Delphix can do this with various databases, flat files and such big fishes like Oracle's e-Business Suite. Why not just KonaKart?

How to do this?

We can virtualize KK in 2 ways.
  1. Use flat files virtualizing capability and prepare hook scripts to do some post provisioning actions after virtual application instance is created.
  2. Create our own toolkit doing everything behind the scenes. This is something similar like shown here Landshark 2.0 Employee Web App Virtualization.
Let us get bold and do our own toolkit.

Testbed preparations

We need an source application to virtualize. I've decided to install KonaKart Community Edition in new schema "konakart" in linuxsource.delphix.local host. The host is available as a part of Delphix Landshark 2.0 Demo. It consists of Delphix Engine VM, linuxsource VM and linuxtarget VM. You can get it here.
Process of KonaKart installation is easy. You can get the installation files here. I've used "64′ Linux/Unix" zipped package. I've used existing ORCL Oracle 11g database available in linuxsource.delphix.local VM. After successful installation you should be able to run KK using a link similar to this http://linuxsource.delphix.local:8780/konakart.

Now we are ready to virtualize KK.

What does it mean to virtualize KK?

What do we want to do? We want to create a virtual copy of KonaKart on different host (aka linuxtarget.delphix.local). What is virtual copy? It is a NFS mounted directory in linuxtarget filesystem containing new copy of KK binaries. We want to reconfigure the new application so that it connects to new "virtual" database. Beside this we want to give it to testers and developer so we need to mask sensitive data in new virtual database.   

Steps to do


Very easy! We have everything thanks great job done by Adam Bowen from Delphix. He has prepared sample application toolkit we can use to create our own.
But first let us plan the steps that has to be performed by new toolkit. We want the toolkit to:
  1. Create a virtual copy of application binaries. 
  2. Mount the directory with copied binaries to target host (linuxtarget.delphix.local).
  3. Reconfigure the application so that it connects to new virtual database.
  4. Mask sensitive data in virtual database i.e. application users, password etc. etc.
  5. Start the virtual application
That is all we need to do to have brand new working KK.

How to create new toolkit?

Let us take a look at existing example Adam has prepared for us. We can find it in linuxtarget VM /home/delphix/webapp.json

If we look inside we can easily understand how does it work! But firs we need to reformat it to make it better readable. I'm using http://jsonformatter.curiousconcept.com/ to make it human readable :).

Beginning of formated webapp.json
webapp.json contains following sections
  • name
  • type
  • stop
  • start
  • snapshot
  • prettyName
  • provision
  • provisionParameters
  • statusScript
To prepare our own toolikit we have to create new json file with modified sections
  • name
  • stop
  • start
  • prettyName
  • provision
  • provisionParameters 
name - just add new name of the toolkit
prettyName - new name visible in Delphix GUI
provisionParameters - here we have to decide what paremeters we need to accomplish our goals. I needed some additional parameter ORACLE_HOME. This parameter was necessary to execute sqlplus from the script embeded in start and provision section.
stop, start, provision - contain embedded shell scripts that get executed when virtual application gets provisioned, started or stopped.

I've created my own konakartapp.json file with custom embedded scripts implementing my logic described above in "Steps to do".
Part of my konakartapp.json file.
  

How to register toolkit definition in Delphix?

Very easy! Again thanks to Adam. We just need to modify script webapp_toolkit_installer.sh or create our own. We just have to upload our new json file.
Contents of webapp_toolkit_installer.sh
 After executing our new toolkit installer we have our toolkit ready to use.

Showtime

Now we can see our toolkit in Delphix.
Now we can choose KonaKart-Application-ORA as new data set.
We can create a data set of KonaKart-Application-ORA and dSource. This is Delphix representation of our source KK instalation.
KonaKart dSource is ready to use.

When dSource is ready we can provision our virtual KonaKart application. 

Now it's time to provision new virtual KK.

First step by provisioning. We are filling in parameters of provisioning KK application.
Now formality. Name of our new KK application in Delphix Engine.
Just summary of our settings and let's go! Make it real!
30 seconds of wait time and we have new KonaKart up and running. Ready to use!
New virtual instance of KonaKart application ready to use!

Conclusion

Delphix has amazing capabilities! The ability to virtualize whole application stacks is unique and very powerful. You can have a bunch of virtual applications in just few clicks, in just a minute and almost with no additional storage cost.