Posts

Deploy Liferay DXP on google cloud

Image
  In this article we will see how to deploy a Liferay DXP cluster in google cloud platform. The reference architecture will look like below. Here I have created a global https load balancer which will distribute the traffic to 2 liferay node in the cluster. I have created an unmanaged instance group for this purpose. I have created 2 Compute engine virtual machine for deploying Liferay DXP. We have used cloud SQL service from gcloud for Liferay schema. Filestore service used for document repository and a separate virtual machine with elastic search installed used as an elastic server.                                                                                                                                                  Lets create these services in google cloud platform. Login to   https://console.cloud.google.com/ with  your Gmail account. Google will provide free trial credit worth $300 for 3 month for gcloud which you  can play around. Lets create all the gcloud services one

Liferay React with Webpack

Image
  Liferay is using its own bundler called Liferay NPM bundler for the normal build process. This article explains the challenges we faced while developing react portlet with liferay-npm-bundler and how to overcome those using a webpack build.   Why Liferay using its own bundler (liferay-npm-bundler)  Multiple Portlets can be added in a page In a Portal page we can add multiple application/portlets, The normal bundler like webpack will fail in this case since its designed to have one application in a page. Liferay NPM bundler is designed to support the following features. Reuse common module across the page   When you have multiple portlets in a page and all this portlet using some common module, liferay npm bundler will allow to load only one common module in the page and share it among the portlets. Avoid common module conflict   Use different version of same module in a page :  It allow you to use 2 version of the same module in a page OSGI modular architecture Liferay follows OSGI m

React development in Liferay - Overview

Image
Liferay is one of the leading opensource digital experience platform based on Java. On the other hand React is  the most popular and widely used java script framework currently available in the market.  With the release of Lifeay DXP platform we can create pure javascript based portlet in Liferay. This feature enable us to run single page application created using (React/Angular/ Vue) in Liferay DXP platform which allow developer to take advantages of both Liferay and SPA platform. This article explain about the things we consider and challenges faced during React portlet development in Liferay. SPA vs Portal Architecture A Portal is designed to have number of pages and child pages under a site and provide option to add multiple application in a single page. SPA have a completely opposite approach compared to Portal, SPA application have only single page which accommodate all your functionality. When we design a Liferay Portal application with SPA this is the first challenge we face.

Clearing Liferay Serivice Entity Cache.

Liferay is storing the cache of the Service entities in different level. In some circumstances/ use cases we have to clear this cache explicitly using code. The below code will clear SampleEnitity cache. CacheRegistryUtil.clear("SampleEnitityImpl" ); EntityCacheUtil.clearCache("SampleEnitityImpl"); FinderCacheUtil.clearCache("SampleEnitityImpl"); FinderCacheUtil.clearCache("SampleEnitityImpl"+ ".List");

Liferay Dynamic Queries

Liferay service builder is a powerful tool for creating Local and Remote service and interact with database.The finder method is used to fetch data of  a table using some column values. There are several reasons/use cases for wanting to move beyond those existing 'finder' queries: the level of complexity allowed by the service generation is not sufficient for your purposes and/or you need queries which implement aggregate SQL operations such as max, min, avg, etc. you want to return composite objects or tuples rather than the mapped object types you want to access the data in way not originally conceived for whatever reason query optimization complex data access, like reporting.   sample service.xml and dynamic queries are below.                                                                                                <entity name="Banners" local-service="true" remote-service="true" table="T_BANNERS">    

Liferay Clustering

Step 1: Webserver  configuration. Befor e co nfiguring Liferay server for clustering some configur ation need to be done at apache server level . These include installing and configur ing ModJk which is a  connector for connecting t om cat container with webserver. Al so conf igure the portal to use a sticky session and load bala cer related configur ation need to be done. You can refer this link   more info for detailed in formation a bout this configuration. Step 2:- Liferay  Configuration In  portal-ext.properties put the following properties         cluster.link.enabled=true         cluster.link.autodetect.address=<some-address>:<some-port>         lucene.replicate.write=true         ehcache.multi.vm.config.location=/mycache/liferay-multi-vm.xml         net.sf.ehcache.configurationResourceName=/mycache/hibernate-clustered.xml           multicast.group.address["hibernate"]=224.0.0.1         multicast.group.port["hibernate&q