How to switch jackrabbit persistence from filesystem to database? - liferay

I have a Liferay portal that was configured to use filesystem persitence for jackrabbit.
It seems like this persistence mode creates a lot of files on the filesystem (so far something like 113'000) and I'm slowly reaching the file count quota of the server.
I would like then to switch to database persistence. I know how to configure it but I don't know how to migrate the existing content.
Exporting and importing the various libraries (document, images, etc.) sounds like a lot of work and very error-prone, especially because it's a multi-homed deployment. Plus, I don't know if it will recreate the same exact URL for the documents, which is important to me.
Short update:
I managed to upgrade to Liferay 6. There is however no way to migrate the jackrabbit data from file system to database from within Liferay; what the Data Migration panel offers is to migrate from jcr hook to another persistence hook.
My initial issue was not to have the data in a database but to reduce the number of files on the filesystem (quota limit). I then switched to the FileSystemHook.
Here is the file count number (find . | wc -l).
JCRHook: 107566
FileSystemHook: 2810.
Don't know why Jackrabbit creates so much files...

In Liferay 6, there is a new dedicated page in the portal administration that is intended to facilitate migrations like that. You have to log in as an administrator (omniadmin if you have multiple portal instances in your server)and go to the Control Panel.
In the Server Administration pannel, click on the Data Migration menu and you will be offered to migrate from FileSystem to database.
It appears that you are not yet in Liferay 6 (Glassfish WebSpace Server is a Liferay 5.2), so there are several options :
upgrade the portal itself to from 5.x to 6.0.5, as explained in the Liferay Wiki and the use the migration page.
stay with your version, and create dedicated class inspired by the ones provided by Liferay in version 6
export the community pages (Liferay ARchive), create a new portal with DB persistance and import the pages and their content.
The migration would be my pick, either with the whole portal (but chances are that it's not something on your roadmap) or with ad hoc migration classes.
Arnaud

There are several ways to migrate, most of them are documented in the Jackrabbit Wiki:
Export to XML may not work for large repositories, because it uses too much memory (you need to try). I have never used the other migration tools, so I can't comment on them.

Related

How to host website on different server

I'm wondering if my website need to be hosted on a different server for load balancing purposes as picture below:
I'm thinking of installing 3 Kentico Project into each server. Then, export and import the site into each Kentico Project and link with the same database connection string.
But what if one of the webparts (.ascx) gets updated? Is that mean I will need to update all 3 Kentico Project. What if other files like js, css, or media?
Is there a proper way to host on different servers but yet can manage the content as one of the Kentico Project get update?
What you are describing is the exact purpose of Kentico's Web farm feature where you can have multiple servers (web farms) connected to a single database. The main purpose of web farms is to ensure that cache and files (not code files, but media files such as the ones uploaded by you as attachments, media library, meta files...) are synchronized across all servers.
Each server in your scenario has its own memory and if you change an object, you want all other servers to reflect the change because otherwise some visitors might end up seeing "old" data, while others wouldn't.
You are also correct in assumption that all code files (ascx, cs, aspx...) will need to be uploaded to all servers. Best way to approach this is to have a tool such as Team city which is able to deploy your changes to multiple servers simultaneously.
With js, css, html, images... it depends where you store them. If you store them in database (not usually the best thing to do) you don't need to update them on particular servers, but if you store them on file system, you might need to. There are many variables here, but some deployment tool will probably be the best bet.
One note here. Try not to install Kentico directly on each of those server and use Export and Import to setup the site. Simply make a copy of the website physically files from your DEV server and paste into each of those server. Then connect them all to the same database.
Why not use the Export and Import? 1. You will get different hast salt string in the web.config which you will get Macro security error, which you will have to replace with the same key. 2. You may miss objects during export and import. 3. The export and import are mostly for the objects stored in the data base, and for the web farm setup, they share the same database, so there is no point of doing that.
You can easily achieve this move to windows Azure from on-premises.
--Can deploy your website/ web project as Cloud service/App service.
--Kentico Azure supports both development and deployment solution
--Built-in scalability
For more details refer below links
Hosting options: https://docs.kentico.com/k10/running-kentico-on-microsoft-azure/microsoft-azure-web-hosting-options
https://devnet.kentico.com/articles/deploying-kentico-to-microsoft-azure-know-your-web-hosting-options

Prevent developers from modifying Liferay Database structure

I am working in an environment that contain many Liferay Newbies along with experts, now I want to make some configuration to prevent any one from modifying the structure of the Liferay Database, i.e. one developer started a liferay 6.2 server while connecting to a Liferay 6.1 configuration database causing the database to get corrupted ... I know that I can't make LR users read-only because any change is reflected to the database, but I want to put some limitations to prevent a scenario like the above.... is any related configuration available ?
Regular permissions that are required for accessing Liferay's database are SELECT, INSERT, UPDATE and DELETE. Only when you're developing new plugins you need CREATE TABLE, ALTER TABLE, CREATE INDEX and similar DDL permissions on the database you're developing on. Just don't give them the full permissions.
Update routines (that run when you have 6.2 code running on 6.1 structures) will require the DDL permissions or fail. And, of course, you can also remove / unconfigure the Upgrade routines.

Liferay create site / page programmatically

I have been using Liferay for work for 2 weeks. I noticed that it's a bit difficult to find good documentation and tutorials.
Until now I created pages from the web portal. After I create them, I drag and drop portlets. I don't really like this approach, I would prefer to use a coding approach. Is there a way to create a website or page programmatically by defining a project as I do to create portlets?
Moreover, I am using Liferay with WebLogic 10.3.6. I want to know where liferay puts pages I created via web-portal on the file system. I suppose that a file, or something similar, is created when I declare a new site on the Liferay web-portal.
Thank you all,
Marco
Yes Liferay has it's Database, all data of any Liferay object is stored in the database and / or on the file system depending on your configuration.
However, one of the functionality of Liferay is to let you create pages / sites through the UI. As documented in the Java Portal Specification and Liferay Server Documents your approach to create pages in an alternative way is possible but it is part of Liferay's Portal Services. You can use Liferay's Service (HTTP REST) API to call the related service. To access those APIs you need to configure your Liferay Server.
In case you want to do programmatically you still need to configure, enable and call those external HTTP services from your code. You should not create Liferay Objects from your own code hosted as an extension inside your Liferay Instance as that will result inconsistency in your Liferay Database / filesystem. (As in case of page creation Liferay creates a set of other related objects in it's database / filesystem.)
In your liferay bundle you will find two plugins of interest.
First is resources-importer-web for which description says
The Resources Importer app allows front-end developers to package web
content, portlet configurations, and layouts together in a theme
without saving it as a compiled .LAR file thereby allowing for greater
flexibility in its usage between Liferay Portal versions.This app will automatically create associated content when other
plugins are deployed that are configured to make use of the Resource
Importer app.This app installs as a Liferay service.
Second is welcome-theme which declares resources to be created by resources-importer-web. This on should be example how to create your own. Take a look at
welcome-theme\WEB-INF\src\resources-importer\*
welcome-theme\WEB-INF\liferay-plugin-package.properties
This feature is described at importing-resources-with-themes
As mentioned by gabor_the_kid, Liferay stores all objects in its tables. For example, User related objects would be in user table. Liferay exposed services or API's to change the default/to add new behaviors by program but not easier than achieving it through UI. Also maintenance should be considered for going program way of creating pages or layouts etc.
You can describe your changes using xml and use the Liferay Portal DB Setup core to create the changes in DB.
The library defines the list of available xml configurations.

Migrate Liferay Database TO HSQL

on the web there are many resources about exporting a development database (HSQL) into a production one (eg. MySQL), but I need to move data in the opposite way.
I usually use the Liferay embedded function to export data to a new database, but it needs for a running database server instance (and it seems to be impossible using HSQL).
Does a way to achieve this goal exist in Liferay 6.2?
Thanks
Go to Control Panel / Server Administration / Data Migration. You can give the standard HSQL URLs - you don't need a running HSQL server. The standard HSQL parameters can be found in Liferay's portal.properties under Hypersonic

Liferay or GateIn

Now our team is facing new project - creation of new company's intranet portal. Because of some reasons we are considering java open source portals and deciding between Liferay and GateIn.
One of very important requirements is following: portal representation for users must depend on country/language settings of customer computer, it means not only portlets localization but users in US subsidiaries of the company should see probably other structure than users in France.
Is it possible to implement the requirement in Liferay and GateIn?.
This can definitely be achieved through Liferay. Please have a look at the concepts of creating organisations.
Am not sure if this can be done in GateIn. However, there are many other things that you may need to keep in mind before choosing these Portals. I have tried to mention few of them here.
1. Check the stability of the Portal server that you will choose to run on a particular Container. GateIn initially was unstable.
2. You may have to override few files (for your customization) if required. GateIn uses GTMPL view technology for the same. Check how good are you in this. In this case, Liferay is easier (Liferay doesn't use any GTMPL UI framework)
3. Apart from developing a location based Portal, if you are also trying to achieve other things like fully Ajax based pages, a good UI framework (like JSF) etc then check if the Portal server you are choosing runs on a particular Container which supports Ajax, JSF (latest versions)
Above were few and list may grow. But, to conclude I would suggest to go for Liferay :)
This can be achieved with Gatein at different level :
Sites : you can declare multiple sites running on the same portal instance(sharing same User Base). In this case you can automatically redirect user to different country sites, based on the country/language of the user.
Sites Navigations : Gatein provides portal, group and user navigations. Navigation is created dynamically when a user connects to the portal. You can have only websites, navigation will created dynamically by user (based on group and user permissions).
Pages (Dynamics layout rendering): GateIn renders each page dynamically. A page is composed of multiple containers that contains portlets or gadgets.
By setting permissions on each container and by using User Group or Membership of the connected user, it's possible to have different page layout.
Of course, you can also mixed these 3 approaches to build your portal.
Liferay is very buggy, and community is very bad. Unless you pay the support.
GateIn promises much, but still lacks functionality.
You may consider JBoss Juzu and Apache Struts to develop generic portlets in order to void any portal vendor lock-in.
Struts provides features of internationalization, localization, timezones achieve my project.
I make use of struts2-portlet plugin to achieve a reporting portlet running on multiple portals. Here is my sample: code.google.com/p/jasperrocks/wiki/Features

Resources