Solution: There are multiple ways to do this,
1) Package Manager (Recommended):
Go to package manager through <HOST>:<PORT>/crx/packmgr/index.jsp
Click on Create package. Give Package name and filter
Once package is created, click on Edit, Click on filter and select filter for your code. Usually it is /apps/<Your code>, /etc/design/<your code>, Some custom code.
Then click ok and click on build package.
Once package is build you can click on more and then replicate.
If you don't have replicate option (If you are using CQ version less than 5.5), Then download that package and install it in all publish instance.
You can also use curl command to install package on publish instance
Curl command will look like this
curl -f -u <USERNAME>:<PASSWORD> -F name=<Package Name> -F file=@<Location of downloaded file in file system> -F install=true http://<HOST>:<PORT>/crx/packmgr/service.jsp"/>
Advantage:
You can manage each package
Can uninstall package to go to previous revision
Can migrate package from any environment to any environment
Disadvantage:
Manually build package every time
2) Using Tree activation
Go to welcome page -> tools -> replication -> Activate Tree -> double click
Select root path as your code path. First select /apps/<Your code> then /etc/design/<Your Design>
Then click on Activate
Advantage:
Simple. You just have to select tree you want to activate
Disadvantage:
Version not supported, Hence you can not revert back to previous code.
3) Using file System
You can also put your code package (Created using package manager in author) to install directory under /crx-quickstart (If directory does not exist then create one)
This method will require restart of your CQ instance and usually not recommended.
Advantage:
Useful if you have very large package
Delay installation till restart. Usually helpful in production deployment.
Disadvantage:
Restart required
package needs to be kept on each publish instance manually.
4) Using CRXDE light (For Only one file change, Only available after CQ5.5)
If you want to do some quick developement in your local then you can use CRXDE to replicate code as well.
Advantage:
Useful if you are doing local development and quickly change result of "Single" file in publish.
Simple
Disadvantage:
You can activate only single file
No versioning and no revert back
5) Using build script (Recommended in Project)
You can use either Maven or Ant or any build system to build and install code to any environment you want.
If you are using Maven then you can do something like this
http://dev.day.com/docs/en/cq/current/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html
If you are using Ant then you can do something like this
<target name="package-apps-etc">
<mkdir dir="${target.dir}"/>
<zip destfile="${target.dir}/${build.package.name}">
<zipfileset dir="${home.dir}/jcr_root" excludes="**/.vlt,**/*.svn" prefix="jcr_root"/>
<zipfileset dir="${home.dir}/META-INF" prefix="META-INF"/>
</zip>
</target>
<target name="local-install-apps-etc-publish" depends="package-apps-etc">
<exec executable="curl" failonerror="true">
<arg line="-f -u admin:admin -F name=citrix-package -F file=@target/citrix-package.zip -F install=true http://localhost:4503/crx/packmgr/service.jsp"/>
</exec>
</target>
You can automate these script using any Continuous build system (Bamboo or Jenkins or any)
You can also put your code package (Created using package manager in author) to install directory under /crx-quickstart (If directory does not exist then create one)
This method will require restart of your CQ instance and usually not recommended.
Advantage:
Useful if you have very large package
Delay installation till restart. Usually helpful in production deployment.
Disadvantage:
Restart required
package needs to be kept on each publish instance manually.
4) Using CRXDE light (For Only one file change, Only available after CQ5.5)
If you want to do some quick developement in your local then you can use CRXDE to replicate code as well.
Advantage:
Useful if you are doing local development and quickly change result of "Single" file in publish.
Simple
Disadvantage:
You can activate only single file
No versioning and no revert back
5) Using build script (Recommended in Project)
You can use either Maven or Ant or any build system to build and install code to any environment you want.
If you are using Maven then you can do something like this
http://dev.day.com/docs/en/cq/current/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html
If you are using Ant then you can do something like this
<target name="package-apps-etc">
<mkdir dir="${target.dir}"/>
<zip destfile="${target.dir}/${build.package.name}">
<zipfileset dir="${home.dir}/jcr_root" excludes="**/.vlt,**/*.svn" prefix="jcr_root"/>
<zipfileset dir="${home.dir}/META-INF" prefix="META-INF"/>
</zip>
</target>
<target name="local-install-apps-etc-publish" depends="package-apps-etc">
<exec executable="curl" failonerror="true">
<arg line="-f -u admin:admin -F name=citrix-package -F file=@target/citrix-package.zip -F install=true http://localhost:4503/crx/packmgr/service.jsp"/>
</exec>
</target>
You can automate these script using any Continuous build system (Bamboo or Jenkins or any)
Advantage:
Structured
Can modify based on need
Structured
Can modify based on need
Disadvantage:
Complex
May need additional resource
Each project has different requirement, Hence way package deployed is also different. Any suggestion or new way to do this is welcome.
Complex
May need additional resource
Each project has different requirement, Hence way package deployed is also different. Any suggestion or new way to do this is welcome.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.