Run Modes in AEM: Configuration and Best Practices
Adobe Experience Manager (AEM) uses Run Modes to define environment-specific behavior. They allow you to load configurations, enable bundles, and apply settings tailored for development, staging, or production without duplicating code.
Out-of-the-Box Run Modes
AEM provides several default run modes:
- author – For content creation and management.
- publish – For delivering content to end users.
- samplecontent – Includes demo content (enabled by default).
- nosamplecontent – Excludes demo content.
Important:
- ‘author’ and ‘publish’ cannot be used together.
- ‘samplecontent’ and ‘nosamplecontent’ cannot be used together.
- These run modes are set at installation time and cannot be changed later.
Setting Run Modes (Precedence Order)
AEM determines active run modes based on the following precedence:
1. sling.properties file
Located at: /crx-quickstart/conf/sling.properties
Example: sling.run.modes=author,stages
2. The ‘-r’ option during startup
Example: java -jar cq-6-p4502.jar -r stage
3. System property in start script
Example: -Dsling.run.modes=publish,prod
4. Filename detection
AEM can infer run modes from the quickstart JAR filename: cq-author-p4502.jar
5. Defining run modes in web.xml (Application Server Deployment)
When deploying AEM in an application server, configure: WEB-INF/web.xml
Set: sling.run.modes
Best Practices
- Use author for content creation and publish for delivery.
- Avoid mixing incompatible run modes.
- For custom environments (e.g., ‘dev’, ‘stage’, ‘prod’), define additional run modes using ‘-r’ or system properties.
- Keep run mode configuration consistent across clustered instances.
Run Modes in AEMaaCS (Adobe Experience Manager as a Cloud Service)
AEMaaCS introduces immutable infrastructure, which changes how run modes work:
- No manual configuration files like ‘sling.properties’ or JAR filename detection.
- Run modes are predefined by Adobe for environments:
- ‘author’ for authoring tier.
- ‘publish’ for publishing tier.
- Additional run modes such as ‘dev’, ‘stage’, ‘prod’ are managed via Cloud Manager pipelines and configurations in Git.
- OSGi configurations are handled using Configurable OSGi via code:
- Place environment-specific configs under: /apps/<project>/config.<runmode>
- Example:
- /apps/myproject/config.author
- /apps/myproject/config.publish
- /apps/myproject/config.prod
- Important Points for AEMaaCS
- You cannot change run modes at runtime.
- Deployment is immutable; all changes must go through the pipeline.
- Use config folders and runmode-specific directories for OSGi settings.
- Avoid relying on legacy methods like ‘-r’ or ‘sling.properties’—they do not apply in Cloud Service.
Why Run Modes Matter
Run modes allow you to:
- Load environment-specific OSGi configurations.
- Enable/disable bundles based on environment.
- Apply different logging, replication, and workflow settings.



Post Comment