Tuesday, August 16, 2016

Migrating Hybris with Ease

Running Hybris On Oracle - and deriving advantages of its data backup/recovery mechanism.

During a common course of Hybris implementation, at times changes made (intentionally or otherwise) in the schema/data can adversely affect the development environment and make it unstable. In some cases, initialization of system is the only resort which means losing all the manually created configurations that are made in the system and re running the impex scripts (which are not hooked up for their automatic execution). However, this is time consuming as well as requires manual intervention if the impex scripts and external settings are not properly set. Similar in design of rails active record where the database state is kept in form of migrations, the data structure is kept under impex and items configuration and updated as necessary.

To alleviate this problem in our latest project, we are using the same oracle database that is present on the staging server and just after re-initialization, resetting the database back to its saved state.
Periodically, the database team resets the master db backup to keep up with the occurring schema changes (which ensures that the additional work that a developer has to perform after 'initializing' the system is kept to minimum). So instead of running all the impex and doing synchronization, only a typical system update suffices.

Here's a short description of how the database is reset from its backed up state.


1. Disconnect from all running applications/programs that oracle user is logged into.

2. Log on to SQLPLUS as admin user: sqlplus / as sysdba

3. Drop and Create the user via the sql file with the following text (the path where the dbf files are present inside the oradata folder).

CREATE TABLESPACE YHTSPACE DATAFILE 'G:\app\oracle\oradata\HYBRIS\YHSPACE.DBF' SIZE 20M AUTOEXTEND ON LOGGING;
CREATE TEMPORARY TABLESPACE YHTEMP TEMPFILE 'G:\app\oracle\oradata\HYBRIS\YHTEMP01.DBF' SIZE 5M AUTOEXTEND ON;
define us=aphy
define pw=aphy
define ts=YHTSPACE
define tts=YHTEMP
DROP USER &us cascade;
CREATE USER &us IDENTIFIED BY &pw DEFAULT TABLESPACE &ts TEMPORARY TABLESPACE &tts PROFILE DEFAULT ACCOUNT UNLOCK;
GRANT "CONNECT","RESOURCE","CTXAPP" TO &us;
GRANT UNLIMITED TABLESACE TO &us;
ALTER USER &us DEFAULT ROLE ALL;
GRANT CREATE CLUSTER TO &us;
GRANT CREATE DATABASE LINK TO &us;
GRANT CREATE SESSION TO &us;
GRANT create ANY INDEX TO &us;
GRANT CREATE SEQUENCE TO &us;
GRANT CREATE SYNONYM TO &us;
GRANT CREATE TABLE TO &us;
GRANT CREATE VIEW TO &us;P
GRANT CREATE PROCEDURE TO &us;
GRANT CREATE TRIGGER TO &us;
GRANT CREATE TYPE TO &us;
GRANT CREATE SNAPSHOT TO &us;
GRANT EXECUTE ON CTX_DDL TO &us;
GRANT ANALYZE ANY TO &us;
grant IMP_FULL_DATABASE to &us;


4. Run the import command:
imp aphy/aphy FROMUSER=APQA TOUSER=aphy file=G:\app\oracle\oradata\HQD_22072016.dmp


While this method of managing database is time saving, it inherits the problem found in most of the tailor made approaches which involve manual intervention. Whether this is a worthwhile approach or a poor one is totally up to you and can be used in a manner depending upon your needs.

Thursday, May 19, 2016

Revving up Raspberry PI


During the past weekend, I've embarked towards setting up a raspberry pi for my computing needs. While setting up an angular based e-commerce store that utilizes SAP Hybris YAAS (which is finally getting matured), I encountered couple of interesting things that I thought I'd share.

My setup was Raspberry Pi 3 (which has an onboard wifi and bluetooth device) and a LAN cable that would connect with a laptop. As this was close to a bare-bones setup, I encountered a couple of problems initially, related with connectivity and interface.

I started by flashing Raspbian OS and then attempted to connect via SSH. However, by default the DHCP ensured that I was not able to ping due to lack of proper IP address, let alone connect with the device. On my WiFi router, the assigned IP was reflected in the interface.
Upon connecting via SSH, I updated /etc/wpa_supplicant/wpa_supplicant.conf to set the WiFi username and password. After connecting, first setup the static IP over LAN and then setup node.js and required libraries for the demonstration.

Another thing I'd like to add would be the 'raspi-config' command that is a handy utility while using the PI and lets you do various things  - which I had not known initially, and was doing that manually.
raspi-config utility


Instead of simply using the storefront as a server mode, I plan to utilize this as an input device (probably with camera module) and setup it up as an input platform to be used as an IOT device for all that's worth.

Monday, March 14, 2016

Containerization by Docker

Docker is a tool that I am getting my hands dirty with these days and instead of going after an entire process of creating a VirtualBox VM and running some lightweight Linux installation, I can simply use Docker to have a command line that behaves just like its virtualized counterpart and for large variety of tasks, this is helpful in setting up the required environment for the code/application to be demonstrated over a single machine. Instead of going the Hypervisor route of owning/supporting the entire OS or having it in a separate VM, the approach here it to use the best of breed tools without getting adversely constricted by the existing host OS.

Now that we have a windows installer, this is even more within the reach of an average lazy developer. And for what's it is worth, the docker hub has become more user friendly than before, which is kind of an app store containing the different images (the OS along with the environment).

Off to races, then!

Wednesday, December 30, 2015

Marching towards Microservices

To say that microservices have arrived would be the understatement of the year 2015 when most of the enterprise application creators seem to have realized the importance of keeping individual parts of application separately.
There is nothing new when it comes to microservices and there are tons of literature - ranging it from precise definitions stated by Martin Fowler, to the loosely coupled architectural term.

It is also easy to confuse microservice with SOA as the design seems similar; however, SOA is an integration of different applications, but microservices remain independent to each other - you can simply plug in and out different services while using them across different applications.

The  rise of javascript based frontend for web applications and in general, polyglot programming of applications has further argued the premise of having standalone pieces of applications that can

A) Scale very well

The individual service can scale up easily - as its underlying micro-architecture contains the least surprises and given today's virtualized/cloud environments, such services can be increased in volume as well as tested and rectified if something goes wrong.

B) Standalone

The services are standalone in the sense that each application that uses a microservices can use it with a specific set of data and as applications interact over http, there are no hassles of contract based services over SOAP/REST based services, which were based on service contract and were the norm earlier. So, we do not need an elaborate contract or some specific tool ; just a miniature web application framework would do.


An example of microservices making waves is into the SAP Hybris ecosystem via the YAAS that serves both as a place to host as well as market individual microservices for different e-Commerce implementations. Hosting is important because of the sensitive nature of data of different clients (which can be stored as different tenants) and also to remove the complexity of managing the server load when there are a lot more things to be completed.

Creating standalone applications and utilizing their mashup is no longer a field dominated by selected few, but are quickly becoming the norm in the coming  time and is poised to become the disruptive force of the decade.

Monday, November 2, 2015

On JavaScript generating engines

Javascript has become so pervasive today that there are camps which are trying to fight the syntactical challenges that it posts in order to leverage the benefits of the approach and the platforms using it i.e. making the browser (be it computer or mobile) do the hard work of rendering and html generation.

However, the catch is that there are different 'languages' that effectively generate JavaScript code. in this regard, again the Rails community scores a point as they where the first ones to leverage CoffeeScript for this job. Other technology have came late into play, but there is still room for these different langugages to manuever.
I've already covered coffeescript, which is in vogue with Rails/Django crowd and there are others like Dart for the GO/Java community - although Dart can be used as-is (native compilation for the crome browser) but since not all browsers support Dart, practical implementations have to live with the Dart2Js tool, which ends up being javascript anyways.


Dart VS TypeScript

After learning Dart for a month, I'd sum it up as an ambitious attempt towards improving web applications but it has a learning curve, which in my personal option is unwarranted. I am inclined towards TypeScript as it allows me to code in javascript (or a close to JS syntax) rather than forcing me to learn another language just to get things done.

Given the fact that Angular.js 2.0 is choosing later over former even if that means using a Microsoft based framework instead of in-house one, investing in TypeSafe seems more prudent today.

my 2 cents