Issue
How does AEM run modes work? How to add additional run modes when starting an AEM instance?
Solution
Run modes allow you to configure AEM instances for specific purposes. For example, author instances use the author run mode, and publish instances use the publish run mode.
Once set, run modes are used to tune each instance by defining collections of configuration parameters for each run mode or combination of run modes. Default sets of configurations are applied to all run modes.
- author
- publish
Important: The run mode of an instance cannot be changed from author to publish, or vice versa, once an AEM instance has been installed. Some run modes, such as the author run mode and the publish run mode, are mutually exclusive. If both are specified, only the first run mode is used.
You can use customized run modes as well. They can differentiate instances by purpose, stage of development, or location. Within a development cycle, there can be separate environments for the stages of development. Common stages include development, staging, QA, and production. Run modes can be specified for different locations and facilities. Examples of more complex run modes include:
- author, development
- publish, test
- author, intranet, us
Set publish or author run mode using quickstart naming
When first installing AEM, the name of the quickstart jar can be used to determine whether the instance uses the author run mode or the publish run mode.
The naming convention to use for AEM 6.2 and later is:
aem<optional-version-or-indentifier>-<standard-run-mode>-p<port-number>
As an example, the quickstart jar for an AEM 6.4 instance running as an author instance with the port of 4502 could be named:
aem64-author-p4502.jar
Set up run modes using the Sling properties file
Run modes can be specified within the sling.properties file. This file can be found at <cq-installation-dir>/crx-quickstart/launchpad/sling.properties. Set the property, sling.run.modes, to a comma-delimited list of run modes to apply.
For example:
sling.run.modes=author,test,uk
or
sling.run.modes=publish,development
Set up run modes using JVM arguments
A JVM argument, -Dsling.run.modes, can be used to specify run modes as well. This argument can be used on the command line, as a system property or within a startup script.
For example:
java -Xmx512m -jar cq-quickstart-6.4.jar -Dsling.run.modes=publish,prod,us
Behavior when run modes are specified more than one way
The run mode specified in the naming of the jar file takes precedence. If run modes are not specified in the naming of the jar file, the values in the sling.properties file are used. If run modes are not specified in either the naming of the jar file or the sling.properties file, the system property (or JVM argument) is used.
References
AEM and Adobe CQ documentation
Apache Sling - JCR Installer Provider
Apache Sling - JCR Installer and OSGi Installer
Adobe AEM Documentation: Adding Configurations to the Repository
Applies to
Adobe CQ 5.5 or greater, Adobe AEM 5.6.1 or greater, Adobe AEM 6.0 or greater