Expand my Community achievements bar.

Custom Runmodes on AEM as a Cloud Service | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Custom Runmodes on AEM as a Cloud Service by Stories by Kaushal Mall on Medium

Abstract

A lot of us in the AEM developer community depended on custom runmodes to control custom code behavior, whether it’s via an OSGi config to activate a certain piece of code or via the getRunModes method of the SlingSettings class.

For the most part, using custom runmodes was considered best practice, but, all of us including myself are also guilty of using them incorrectly.
With AEM as a Cloud Service and following the 12 factor app methodology, custom runmodes are a slowly becoming a thing of the past.
In AEM as a Cloud Service, only a certain set of runmodes and a certain naming convention for your config directories are supported. Read the docs for more details.

Now to see how you can migrate custom runmodes usage to AEM as a Cloud Service. Starting with the easier one.


Custom runmodes in configurations
There are two possible incompatibilities here
1. Incorrect naming convention — config.(dev|stage|prod).(author|publish)
2. Unsupported runmodes — config.!(dev|stage|prod)

Custom runmodes in code
This happens to be one of the ways we have all abused runmodes in AEM. As always, starting with the good news.
If you check runmode in code using the getRunModes method, but, only check for author or publish, you don’t have to do anything.

If you use it to check any other runmode, including dev, stage and prod, there are some changes needed to ensure your application continues to work. In AEM as a Cloud Service, the getRunModes will only return author or publish because dev, stage and prod are technically not run modes, but, environment types.

Read Full Blog

Custom Runmodes on AEM as a Cloud Service

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 4

Hi Team

 

I am migrating from AEM on-prem to AEMaaCS, when I run BPA on my AEM author instance, I got the below violations related to runmodes.

Configurations have been found which are based on runmode names which are not supported in AEM as a Cloud Service.

/apps/<project_name>/config.local

A configuration name based on an unsupported run mode was found at /apps/<project_name>/config.local.
/apps/<project_name>/config.prd

A configuration name based on an unsupported run mode was found at /apps/<project_name>/config.prd.
/apps/<project_name>/config.publish.prd

A configuration name based on an unsupported run mode was found at /apps/<project_name>/config.publish.prd.
/apps/<project_name>/config.publish.stg

A configuration name based on an unsupported run mode was found at /apps/<project_name>/config.publish.stg.
/apps/<project_name>/config.stg

A configuration name based on an unsupported run mode was found at /apps/<project_name>/config.stg.

 

As per my understanding from the blog, I can do the following.

1. rename /apps/<project_name>/config.prd to /apps/<project_name>/config.author.prd

2. rename /apps/<project_name>/config.stg to /apps/<project_name>/config.author.stg

3. delete /apps/<project_name>/config.local

4. anything required for this 2 configs also /apps/<project_name>/config.publish.prd and /apps/<project_name>/config.publish.stg ?

Also when I rename the config do I need to update the backend code also. Please advise.