Total Pageviews

Saturday, October 11, 2014

Liferay: Instance Specific 'portal.properties' File

To start with this topic, we need to refresh the following:

Portal-ext.properties
Everybody who works with Liferay, know about portal-ext.properties file. Just to refresh, this file contains key-value pairs of settings and is present in the classpath to override the properties of portal.properties file (can be seen in Liferay source code or portal-impl.jar).

Liferay Portal Instance
Liferay Portal allows you to run more than one portal instance on a single server (e.g. tomcat instance). The Portal Instances page of the control panel lets you manage these instances. All portal data, however, is kept in the same database. (You can read in details here)

As a standard practice, the settings we do in portal-ext.properties file are shared among all portal instances. But with the settings we are now going to discuss will allow us to create different property files for each portal instance, and this is out of box only. To do so, we have to do the following two settings:

1. There are two ways of doing this, first you can set the following property in your system.properties file

or you can set this in your setenv.bat or setenv.sh as per your environment. You can enter the above entry just after '-Duser.timezone=IST' in the file.

2. Now we have to create properties file with the naming format 'portal-<<WebId>>.properties'. For instance, if the web id of the instance is 'finance', then the name of the property file for this instance will be portal-finance.properties.

Similarly we can create different property files for other portal instances. The default web id of liferay instance is 'liferay', so the name of property file for this instance will be 'portal-liferay.properties'.

Important things to note here is - not all properties can be overridden by this setting. Properties such as database configurations should be in the property file of default instance only.

For testing this, you can try to modify the authentication method. Change the value to screen name in the second instance's properties file while keeping the email (as default come bundled), you will get the second instance authenticating with screen name while the first with email address. It also works well while fetching the values using PropsUtil API. 

5 comments:

  1. Looks like you have missed this point

    Edit or create portal-ext.properties and add following line:
    include-and-override=portal-${easyconf:webId}.properties

    ReplyDelete
  2. Hi

    Do u have any idea how to separate the document library storage location for individual instances . I mean i have Instance1,Instance2 and Instance 3 . I am planning to separate the document library storage location as separate for individual instances . I mean document storage location for Instance one , instance two and Instance three should be separate . For that i created three property files portal-instanceone.property ...etc . And i made the entry dl.store.file.system.root.dir = , inside the each property file . But still all the instances are pointing to default instances document library . Any suggestions on this how to configure . Will this property works for individual instances ?

    ReplyDelete
  3. Your work here on this blog.You've been continously providing amazing articles for us all to read and I just hope that you keep it going on in the future as well. Cheers!
    SEO Online Training
    SEO Training

    ReplyDelete
  4. With the growing number of web-enabled devices used in today's business environment (e.g. smartphones, tablets), access to your data is even easier. There are many benefits to moving your business to the cloud data rooms

    ReplyDelete
  5. Tech Support Number
    Sage Tech Support Phone Number @ http://sagetech.supportphone-number.com/
    QuickBooks Support Phone Number @ http://www.quickbookssupportphone-number.com/
    Quicken tech Support Phone Number @ http://quickentech.supportphone-number.com/
    QuickBooks Tech Support Phone Number @ http://quickbookstech.supportphone-number.com/

    ReplyDelete