Wednesday, April 25, 2012

How to install Multiple Package in CQ / WEM

Use Case: You have a Hotfix that has many dependencies and you want to install them in order Or you want all packages to install in particular order. Installing through package manager can be time consuming process.

Solution:

When CQ starts up it checks /crx-quickstart/repository/install till CQ5.4 

and /crx-quickstart/install CQ5.5 and above use  folder for any new package and install them in alphabetical order.

So for example you have a package which has many dependencies, You can rename them in alphabetical order and put them in /crx-quickstart/repository/install folder. Next CQ restart will make sure that they are installed in that order.


For example, If you have Zip file name p001-hotfix-<Some-number>.zip and p002-hotfix-<some-number> under install folder, then p001 will get installed first and then p002 upon restart. After initial installation CQ creates properties file (some thing like <your-package-name>.properties) associated with each package, It is used by installer as a indicator not to install that package again on next restart.

You can also mention start order of package by creating start level folder. For example to assign startlevel 21 to bundle xyz you place the file into crx-quickstart/install/21. The default start level is assigned if you place it into the folder called 0 or directly into the install folder. This is also true for any bundle you put in /install folder in repository (Which is picked up by jcr installer as soon you put them there). Note that number might have preference over alphabets, so rename your files accordingly.

You have to restart CQ after putting files in install folder.

This approach does not work for CRX Hotfix.

Few more facts about packages that is worth mentioning is,

1) If you activate a package from author instance to publish, They get "INSTALLED" on publish instance. In CQ5.5 you have replicate option on package manager it self












For CQ5.4 you have to go to tools->packages-><Your package location> and then click on activate













This is very useful if you have many publish instance and you want to install package to all of them. This is also useful when you have to move package between environments.

2) In cluster instance you only have to install package in one instance (It can be any one, But master is recommended)

I have seen many clients do not know about these features so thought to mention it. Please feel free to comment if you have any question about it.

Caution: Note that, If you use /crx-quickstart/repository/install to install your Hotfix, You might not be able to uninstall it, As no snapshot of that package is created in that case. So if you are testing multiple Hotfix you might want to use package manager in that case.



28 comments:

  1. Related To:
    2) In cluster instance you only have to install package in one instance (It can be any one, But master is recommended)

    Is this statment also true for using "/crx-quickstart/repository/install folder"?

    Is it possible or better to use quickstart/repository/install folder on every single instance?

    Thanks!

    ReplyDelete
    Replies
    1. Is this statment also true for using "/crx-quickstart/repository/install folder"?

      -- Yes.

      Is it possible or better to use quickstart/repository/install folder on every single instance?

      -- Possible. But no need.

      Yogesh

      Delete
    2. Thanks Yogesh for your fast feedback.

      Related To:
      Is it possible or better to use quickstart/repository/install folder on every single instance?
      -- Possible. But no need.

      >> We use the journal mechanism for synchronising two independant fallback cluster. So I think of something like a shared install folder copying a file into it, and all instance will be restarted.
      Result ?!:
      - All content can be installed over the night with "two single" actions
      - All systems are back at "same" time. No big delay because of the synchronising on basis the journal. (Takes some time and ressources in the background)

      Delete
  2. Hello, Yogesh

    Have you tested all this in CQ 5.5.

    It seems that the repository/install directory was removed in this version.

    Thanks for this great post.

    ReplyDelete
    Replies
    1. Sorry for inconvenience, I think for CQ5.5 putting those file directly under /crx-quickstart/install folder should work. Can you please try it and let me know.

      Delete
    2. This comment has been removed by the author.

      Delete
  3. Hi Yogesh, is this the same procedure for AEM 5.6? Thanks for this great article...

    ReplyDelete
    Replies
    1. Yes it should be same process. Let me know if it does not work.

      Delete
    2. It is the same folder as in 5.5: crx-quickstart/install folder. I have tried the steps to install the packages with quickstart jar based on this article: http://helpx.adobe.com/crx/kb/HowToInstallPackagesUsingRepositoryInstall.html. And I see that my custom packages are getting installed way before all other AEM product packages. Is that fine or is there a way for me to configure so that my custom packages get installed after AEM product packages?

      Delete
    3. Can you try renaming your package and give name that start with "Z" or something and see if that changes any thing ?

      Yogesh

      Delete
    4. I think that's not an issue because my package names are : cq-5.6.0-hotfix-2893-2.zip a d hcs-1.0.0.zip and they got installed in between the 5.6 packages - com.adobe.granite.platform.users-1.0.0.zip and com.adobe.granite.monitoring.content-1.0.10.zip.

      If it was based on the naming, hcs-1.0.0.zip should have installed after these two AEM packages.

      Delete
    5. Murli,

      Thats possible that Auto installer give file system preference over repository. I see that file system installer has start level 1 and content package installer has start lever greater than 1.

      Yogesh

      Delete
    6. ok. Is there any way I can change those settings to get to the right behavior? Really appreciate your help!

      Delete
    7. Also, if I delete the package in install folder, it's not uninstalling and deleting the package. Is that expected behavior?

      Delete
    8. I think in order to ensure that your hotfix/feature pack installs only after all the default packages of 5.6.1 are finished installing then you will have to have a dependency of cq-content-5.6.1.xxxxx in your hotfix pom. So that the installation of hotfix starts only after all the packages of 5.6.1 are installed.

      Delete
  4. Hi Yogesh,

    I am using AEM5.6.1 and we are not able to see any locaton as /crx-quickstart/install.? Please advice

    ReplyDelete
    Replies
    1. Hello,
      Folder does not exist by default. Please create one.
      Yogesh

      Delete
    2. great Yogesh.Thanks for your support.

      Delete
    3. If i need to install package of 14 Gb size. Is it possible to install through /install location? If yes, how much time approximately to finish installation ?

      Delete
    4. Hi Yogesh,

      I created install folder under crx-quickstart location. Placed a package 10 MB named as z.zip.

      Start the instance ,.Tailed the error log file . No impact . I couldnot see any things related to that package getting installed. Please update . I am using AEM5.6.1

      But i see something as below

      home/cqauth/aem5.6.1/crx-quickstrt/launchpad/startup/1/ ---> i can see soome Jar files are located here.

      Please let me know is this location i can add and try running some zip packages.?

      NOTE:usually we not made any plain AEM5.6.1, We upgraded the instance from cq5.5 to AEM5.6.1 with custom code

      Delete
    5. Hello,

      Make sure that package that you keep under install folder is valid package. Please do not do any thing with /crx-quickstrt/launchpad/startup/1/ these are launchpad specific bundles.

      Are you able to install your bundle using package manager ?

      Yogesh

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hi Yogesh,
    As mentioned above multiple install work for Bundles as well. Consider a case where I have 2 version of bundles and both are active. How my jsp will recognize which bundle to refer ?
    Thanks

    ReplyDelete
    Replies
    1. Hello Love,

      If you have 2 bundle with same artifactID/groupId then bundle with highest version number will take precedence over lower one and only that one get installed.

      Yogesh

      Delete
  7. Hi,
    I have a package that has already been uploaded on package manager. Also I have uploaded into install folder as well. Now I need to install this package during every instance restart. Please let me know the steps.

    Thanks,
    Vishnu

    ReplyDelete