Runmodes Environments aem | Community
Skip to main content
Level 2
February 5, 2025
Solved

Runmodes Environments aem

  • February 5, 2025
  • 3 replies
  • 804 views

Hi all,

 

How  different environments will be mapped to different runmodes how config.dev will be mapped to dev environment what's the underlying mechanism for this.How the mapping happens.

Thanks in advance.

Best answer by Shiv_Prakash_Patel

Hi @ns334 ,

Below are the explanations for your queries.

1. How are different environments mapped to different run modes -

AEM uses run modes to apply environment-specific configurations. These run modes are specified during startup and determine which configuration settings and bundles are activated. For example, you might have run modes like author, publish, dev, prod, or custom ones like intranet. By combining these run modes, you can fine-tune your AEM instance for various scenarios.

2. How does config.dev get mapped to the dev environment?

AEM maps configuration folders to run modes using specific naming conventions. Folders within the repository are suffixed with the run mode they correspond to. For instance:

  • config: Applied to all run modes.
  • config.author: Applied when the author run mode is active.
  • config.dev: Applied when the dev run mode is active.
  • config.author.dev: Applied when both author and dev run modes are active.

When the AEM instance starts with the dev run mode, it automatically loads configurations from the config.dev folder. If multiple configuration folders match the active run modes, AEM applies the configuration with the highest number of matching run modes. For example, if both config.author and config.author.dev are present, and the instance is started with author and dev run modes, the settings in config.author.dev will take precedence.

3. What is the underlying mechanism for this mapping?

The underlying mechanism for mapping run modes in Adobe Experience Manager (AEM) is based on how run modes are specified during startup. This can be done using:

  • System Properties: -Dsling.run.modes=author,dev when launching the JAR.
  • sling.properties File: Adding sling.run.modes=author,dev to sling.properties.
  • Command-Line Option: Using -r author,dev while starting AEM.
  • Filename Detection: Renaming the JAR file with specific run modes.

Reference- https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/deploying/configuring/configure-runmodes

Regards,

3 replies

AmitVishwakarma
Community Advisor
Community Advisor
February 5, 2025

In AEM, run modes are used to map environments (e.g., dev, prod, stage) to specific configurations. Each environment has a corresponding run mode (e.g., dev for development, prod for production).

You specify the run mode when starting AEM, like java -jar aem-quickstart.jar -runmode dev.
AEM loads environment-specific configurations from folders like config.dev, config.prod based on the active run mode.
This allows you to use different settings for each environment (e.g., different data sources or paths in dev vs. prod).

In short, the run mode maps to configurations that allow AEM to adapt to different environments.

Shiv_Prakash_Patel
Community Advisor
Shiv_Prakash_PatelCommunity AdvisorAccepted solution
Community Advisor
February 5, 2025

Hi @ns334 ,

Below are the explanations for your queries.

1. How are different environments mapped to different run modes -

AEM uses run modes to apply environment-specific configurations. These run modes are specified during startup and determine which configuration settings and bundles are activated. For example, you might have run modes like author, publish, dev, prod, or custom ones like intranet. By combining these run modes, you can fine-tune your AEM instance for various scenarios.

2. How does config.dev get mapped to the dev environment?

AEM maps configuration folders to run modes using specific naming conventions. Folders within the repository are suffixed with the run mode they correspond to. For instance:

  • config: Applied to all run modes.
  • config.author: Applied when the author run mode is active.
  • config.dev: Applied when the dev run mode is active.
  • config.author.dev: Applied when both author and dev run modes are active.

When the AEM instance starts with the dev run mode, it automatically loads configurations from the config.dev folder. If multiple configuration folders match the active run modes, AEM applies the configuration with the highest number of matching run modes. For example, if both config.author and config.author.dev are present, and the instance is started with author and dev run modes, the settings in config.author.dev will take precedence.

3. What is the underlying mechanism for this mapping?

The underlying mechanism for mapping run modes in Adobe Experience Manager (AEM) is based on how run modes are specified during startup. This can be done using:

  • System Properties: -Dsling.run.modes=author,dev when launching the JAR.
  • sling.properties File: Adding sling.run.modes=author,dev to sling.properties.
  • Command-Line Option: Using -r author,dev while starting AEM.
  • Filename Detection: Renaming the JAR file with specific run modes.

Reference- https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/deploying/configuring/configure-runmodes

Regards,

Shiv Prakash
Ns334Author
Level 2
February 6, 2025

Thank you for the detailed explanation

chaudharynick
Level 4
February 5, 2025

Hi @ns334 ,

 

These are dependent on the runmode configuration you used to setup your instance.

whenever you setup a instance(local, on prem) you can define the runmodes by either passing the arguments while starting up or setting up in sling.properties(crx-quickstart/conf/sling.properties) file.
in the cloud, it is the default - dev, stage, prod.

these are environment specific and then comes the standard runmodes that is author and publish.

format -> config.<standard-run-mode>.<environment-specific-mode>

Example

config.author - author environment for all server

config.dev - author&publish environment for dev server

config.author.dev - author environment for dev server
config.publish.dev - publish environment for dev server

config.author.stage - author environment for Stage server
config.publish.stage - publish environment for Stage server
config.author.prod - author environment for production
config.publish.prod - publish environment for production

 

configurations gets assigned with the most matching runmodes.

 

Ns334Author
Level 2
February 6, 2025

Thanks everyone for all the answers.