As we are aware, Adobe now supports AEM as a Cloud Service, which signifies a cloud-native approach to leveraging AEM applications. This blog will undoubtedly provide us the clear and crisp understanding on AEM as a Cloud Service.
This blog will help all of us understand the following things in detail:
As part of this tutorial, I aim to debunk several major myths surrounding the changes that come with AEM as a cloud service.
There are three major changes in terms of code development, deployment, and dispatcher for AEM as a Cloud Service:
Below, we outline the major high-level advantages of using AEM as a Cloud Service:
12. Due to the inaccessible nature of immutable content at runtime, certain AEM Sites operations are not available, including:
13. Discover the WKND reference site, the latest addition to AEM, designed to exemplify best practices for building websites with AEM. Get started with WKND by following the link and accessing the GIT repository to learn and implement AEM as a Cloud Service best practices.
14. Smart translation is not supported in Experience Manager as a Cloud Service.
15. The rating widget in the metadata schema editor is not supported.
16. Multi tenancy: Managing multiple projects as part of a single repository is a pain and at the same time it require full control over the repo and deployment process. However, it becomes easier to maintain common reusable code/config in one place, preventing the accidental override of other code/config.
17. The Replication Agent has been discontinued
In AEM Cloud Service. Instead, content is now published using Sling Content Distribution. Replication will use pub-sub mechanism to publish content from author to publish.
Reverse replication is not supported as part of cloud service.
This change may have implications for certain aspects of existing AEM projects:
Furthermore, please be aware that the replication agent administration console no longer includes the pause and disable buttons.
CSRF Tokens are require to make a POST, PUT, and Delete requests to AEM for authenticated users. The same CSRF token is not required for GET requests or for anonymous requests.
/**
* Get CSRF token from AEM.
* CSRF token expire after a few minutes, so it is best to get the token before each request.
*
* @returns {Promise<string>} that resolves to the CSRF token.
*/
async function getCsrfToken() {
const response = await fetch('/libs/granite/csrf/token.json');
const json = await response.json();
return json.token;
}
// Fetch from AEM with CSRF token in a header named 'CSRF-Token'.
await fetch('/path/to/aem/endpoint', {
method: 'POST',
headers: {
'CSRF-Token': await getCsrfToken()
},
});
For make it work on dispatcher, it will also require to add/update below lines in dispatcher.any configuration file
dispatcher/src/conf.dispatcher.d/filters/filters.any/0120 { /type “allow” /method “GET” /url “/libs/granite/csrf/token.json” }
Follow below project structure/hierarchy for mutable and immutable content to place code depending on module.
All content and sub-folders within /apps and /libs are immutable and now set to read-only. Any attempts to modify this content will fail, resulting in an error indicating that the content is read-only and the write operation cannot be completed.
Everything else in the repository, /content
, /conf
, /var
, /etc
, /oak:index
, /system
, /tmp
, and so on, are all mutable areas, meaning they can be changed at runtime.
On-premise versions of AEM did not enforce read-only restrictions in /libs, but in AEM Cloud Service, changes in /libs are completely disallowed. However, /libs overlay within /apps is still permitted through the GIT CI/CD pipeline.
Deployable artifacts such as OSGI bundle jar type file directly gets embed in all project
all
content package embeds the following packages, to create a singular deployment artifactcore
OSGi bundle Jar required by the AEM applicationui.apps
deploys code required by the AEM applicationui.config
deploys OSGi configurations required by the AEM applicationui.content
deploys content and configuration required by the AEM applicationvendor-x.all
deploys the everything (code and content) required by the vendor X applicationvendor-y.all
deploys the everything (code and content) required by the vendor Y applicationui.apps package contains changes made update /apps hierarchy.
ui.core OSGi bundle Jar required by the AEM application
ui.content package contains changes made under below hierarchy:
ui.config package contains OSGI configurations and below changes made under below hierarchy:
/apps/practice/osgiconfig
/apps/practice/osgiconfig/config -> Common OSGI configuration to all AEM environments.
/apps/practice/osgiconfig/config.<author|publish>.<dev|stage|prod> -> Environment specific configurations.
Repo Init scripts themselves live in the ui.config
project as scripts, they can, and should, be used to define the following mutable structures:
Repo Init scripts which contain the Repo Init scripts are defined in the RepositoryInitializer
OSGi factory configuration via the scripts
property. Because these scripts defined within OSGi configurations, they can be easily scoped by run mode using the usual ../config.<runmode>
folder semantics.
Because scripts are typically multi-line declaration, it is easier to define them in the .config
file, than the JSON-based .cfg.json
format.
/apps/my-app/config.author/org.apache.sling.jcr.repoinit.RepositoryInitializer-author.config
scripts=["
create service user my-data-reader-service
set ACL on /var/my-data
allow jcr:read for my-data-reader-service
end
create path (sling:Folder) /conf/my-app/settings
"]
Follow link to create AEM as a Cloud Service project using maven archetype.
Additionally, the AEM as a Cloud Service Dispatcher SDK can be used to validate Dispatcher configurations locally. Follow link for more information.
Cloud Manager all us to manage all the AEM as a cloud service environments and the same time provide us the capability to deploy code. It is a pre-requisite to have an access of cloud manager to deploy code on the environments.
We can access Cloud Manager using link and credentials as our personal Adobe ID.
Follow below steps once we are good with pre-requisites.
2. Click on below Access Repo Info button to get Git command line URL to checkout code using username and password.
3. Click on Generate password button for generating password to clone code in local using Git command line URL.
4. Open command line, paste Git command line and click on enter as shown below. It will ask for required user name and password we got as part of step 3.
5. import code in to the intellij and make all required changes. Push code once done with the changes using below sub sequent basic GIT commands:
git add .
git commit -m “provide commit description”
git push
6. Go back to adobe cloud manager and select the same program what we selected in first step.
7. Select below highlighted option in green for Non- Production pipeline to deploy changes on DEV.
Click on the three dots/ellipses and select run option to trigger build on DEV will help us to deploy code.
Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.
📝 Blogs
javadoubts.com © All rights reserved