Getting Started with Apache Sling Repo Init
At times, setting up the initial state of AEM repository may appear cumbersome, especially when we have to setup multiple things beforehand such as:
- Creating service users
- Creating user groups
- Setting up ACLs/permissions for these users
- Base content structure inside /conf or /content
That said, it’s just not about the content, it could be configurations as well. Creating and setting up these configurations manually may lead to mistakes. Also, this doesn’t just apply to remote environments; it is much needed for a developer’s local instance as well. To overcome all these issues, Apache Sling Repository Initialization (otherwise known as Repo Init) comes very handy.
How Repo Init works?
Repo Init is a set of instructions/scripts which help us in creating JCR structures, service users and groups. There are no explicit permissions needed in order to run these scripts. These scripts are executed early in the deployment process so that all required configuration/content exist in the system before the code is executed.
This article is based and tested on AEM 6.5.5.0 with below bundle versions:
org.apache.sling.jcr.repoinit – 1.1.8
org.apache.sling.repoinit.parser – 1.2.2
Benefits of Repo Init:
- Keep all environments in-sync in terms of initial/basic configuration.
- Speeds up local environment setup for developers.
- No lag between the code deployment and basic setup of AEM repository. By the time code is deployed, Repo Init instructions are already executed.
Configuring Repo Init:
These scripts are stored as a factory OSGi configuration of type “org.apache.sling.jcr.repoinit.RepositoryInitializer”. Being an OSGi configuration, it is easy to have different set of scripts for author and publish run-modes along with different environments such as Stage and Production. For e.g. config.author, config.publish, config.author.prod, config.publish.stage etc.
Below is a sample Repo Init OSGi configuration with jcr:primaryType “sling:OsgiConfig”:
/apps/myproject/config/org.apache.sling.jcr.repoinit.RepositoryInitializer-demo.xml
scripts = “”
Tip: In order to save this OSGi configuration as repository configuration, we had to use ASCII encoded value “
” for new-line character.
During deployment, we see log statements like below in error.log file where we see each and every command is executed line-by-line.
Post deployment, you can also see the Repo Init configurations in OSGi console:
There are other ways as well for initializing a repository but Repo Init consolidates them all in one tool making the configurations easy to implement and manage. Also, Apache Sling Repo Init is compatible with AEM as a Cloud Service.
How to Implement Search Components in AEM?
Search is one of the key features for any website. Implementing an efficient search component on a website can considerably improve the experience of visitors.
For AEM-powered sites, using Out-of-the-box (OOTB) search component without creating any new indexes has been a challenge. Our main goal here is to leverage OOTB search component and customize it to perform full-text search to enable users to search any word, number, or a sentence including the special characters in AEM website pages as well as DAM Assets. Search functionality shall be customized to different document types including Microsoft office documents and PDFs.
How to Implement Search Component in AEM?
Following are the 4 steps we consider implementing search component in AEM:
- We need to overlay the search component from core/wcm/components/search/v1/search
- Create custom search servlet which uses QueryBuilder API to do full-text search for pages and assets.
- Create search.html file under search component and make sure we call the custom search servlet.
- Refactor Oak Index definition for cqPageLucence (/oak:index/cqPageLucene) to search content tree depth level 4 and
level 5.
Sample code
1.
Servlet map
Map<String, String> predicatesMap = new HashMap<>();
predicatesMap.put(”fulltext”, fulltext); predicatesMap.put(“path”,
searchRootPagePath); predicatesMap.put(“group.p.or”, “true”);
predicatesMap.put(“group.1_group.path”, “/content”);
predicatesMap.put(“group.1_group.type”, “cq:Page”);
predicatesMap.put(“group.2_group.path”, “/content/dam”);
predicatesMap.put(“group.2_group.type”, “dam:Asset”); PredicateGroup
predicates = PredicateConverter.createPredicates(predicatesMap);
ResourceResolver resourceResolver =
request.getResource().getResourceResolver(); Query query =
queryBuilder.createQuery(predicates, resourceResolver.adaptTo(Session.class));
2.
Search html
<form class=”cmp-search__form” data-cmp-hook-search=”form” method=”get” action=”${currentPage.path @ addSelectors=, extension=’json’, suffix = search.relativePath}” autocomplete=”off”>
3.
Refactor Page Lucene index
Output:
Through full-text search, we can improve the user experience on your AEM website. Additionally, the search component will help us in personalizing the site as we can incorporate analytics into this search to understand user requests on a more granular level.
A Comprehensive Guide on how to Create Vanity URL in AEM
Vanity URLs in AEM
It’s important to have a short and meaningful URL structure for easy readability and SEO optimization. As an author or a developer, it would be confusing to generate vanity URLs in AEM. In this article, we would be seeing steps to generate vanity URLs.
Before we proceed on how to generate vanity URLs, lets first try to understand what Vanity URL is.
What is Vanity URL?
In simple terms, Vanity URL is a meaningful short form of the long URL.
Example:
Long URL: https://www.nextrow.com/adobe-experience-manager/aem-implementation-consulting
Vanity URL: https://www.nextrow.com/aem-implementation-consulting
What are the Advantages of using Vanity URLs?
Following are the 4 benefits of using Vanity URLs:
- Easy to remember and pronounce.
- Improves SEO: When vanity URLs are used appropriately, it can be a good marketing gold. Choose vanity URLs that compliments your existing marketing and SEO strategy.
- Increase/create the brand awareness.
- Build trust with the audience.
Now, let’s see how we create vanity URLs in AEM.
Steps to create Vanity URLs:
- Open any page in author instance that you want to create Vanity URL. In this article, I am taking an example of we-retail.
http://localhost:4502/editor.html/content/we-retail/us/en/products/men/pants/analog-dark-wash-jean.html
- Open Page properties and navigate down to Vanity URL section.
- Click on Add and add the vanity URL. Then, click on Save and Close. Behind the scenes, vanity URLs are stored in the property of sling: vanityPath. You can add multiple vanity URLs to the same page.
- If you are adding multiple vanity URLs to the same page, then the values will be stored in the form of an array.
- Now, publish the page to test the vanity url.
- After publishing the changes, you can access the original page using the vanity URL.
I.e.http://localhost:4503/analog-dark-wash-jean.html
NOTE:
- Don’t use the same vanity URL for different pages.
- Vanity URLs are case sensitive.
- You don’t need to add a/at the start of the vanity URL.
- If you are adding multiple vanity URLs to the same page, then the rank of that page gets decreased as link popularity is divided between URLs and the same page competes against itself.
- To overcome this problem, one of the good ways is to configure Redirect 301 and redirect the user to original page.
- To add Redirect 301, you just need to select the checkbox in the vanity URL section in the page properties of that page.
- Publish the page after selecting ‘Redirect Vanity URL’. After publishing the page, when you try to access http://localhost:4503/analog-dark-wash-jean.html, it would redirect you to the actual link I.e., http://localhost:4503/content/we-retail/us/en/products/men/pants/analog-dark-wash-jean.html#meotsuann-28.
However, there are a few limitations with vanity URLs. Vanity URLs don’t directly work with dispatcher. That being said, if an author creates a vanity URL and publish the page, still it won’t be available without updates from the webserver and a server restart. Unfortunately, this can be a challenging task because it entails a continuous update of the configuration files and a restart of the web server every time. In our next blog, we will see how dispatcher work continuously with AEM to get the list of vanity URLs from AEM
Creating AEM Delta Content Packages Using Groovy Script
In today’s world, most of the developers try to find the delta content manually in AEM by checking the timestamp of pages and assets and add these paths in the filers of AEM package. Though its not an incorrect way, but there are high chances of missing some pages or assets doing so. So, we have curated this article to help AEM developers find the pages and assets that has been created/modified during specific given time frame and automates the package creation process.
The AEM Groovy Console provides an interface for running Groovy scripts in Adobe Experience Manager. Scripts can be created and executed to manipulate content in the JCR, call OSGi services, or execute adhoc code using the AEM, Sling, or JCR APIs without any interruptions to AEM instance.
If you have ever come across a situation where in you need to create delta content packages in AEM instances, then this blog is for you. We are going to create and execute a groovy script which creates a series of content packages in package manager, which are modified or created over a specific date range.
Pre-requisites:
Download and install the groovy console package, which is compatible with your AEM version. Below table shows the compatibility versions of AEM and Groovy Console.
Groovy Console Version(s) | AEM Version(s) |
15.x.x, 14.x.x, 13.x.x | 6.3, 6.4, 6.5 |
12.x.x | 6.4 |
11.x.x | 6.3 |
10.x.x, 9.x.x | 6.2 |
8.x.x | 6.1 |
7.x.x | 6 |
6.x.x, 5.x.x | 5.6 (CQ) |
3.x.x | 5.5, 5.4 (CQ) |
Implementation:
In order to find the delta content for a specific date range, we are going to use SQL2 query and find out if any new pages or assets have been created or any existing pages and assets have been modified in AEM instance. We are going to utilize the JCR properties like jcr:created and cq:lastModified in our SQL2 query.
Sample SQL2 Query:
SELECT * FROM AS s WHERE ISDESCENDANTNODE() AND ((s. >= CAST(‘2020-07-28T16:00:00.000Z’ AS DATE) AND s. <= CAST(‘2020-07-30T21:00:00.000Z’ AS DATE)) OR (s. >= CAST(‘2020-07-28T16:00:00.000Z’ AS DATE) AND s. <= CAST(‘2020-07-30T21:00:00.000Z’ AS DATE))) order by
Groovy script:
Output:
After we run the above groovy script, a series of content packages will get created in package manager. Go to package manager (http://localhost:4502/crx/packmgr/index.jsp) and build the content packages.
So as you may have noticed that Groovy scripts could be quite useful, easy to use, and very handy for any AEM developer to manipulate content in one go.
How to Restore AEM Instances using Journal Log in Adobe Experience Manager?
As an AEM developer, we try multiple things in our local instance and there is a high chance of instances getting corrupted once in a while. Ever wondered how easy it is to restore AEM instances using the journal log? If not, then this blog is for you.
This blog describes how to restore our AEM instance to a specific time using the Journal log. The default configuration of the journal theoretically allows for an unlimited number of rotated log-files. Due to some older issues in Oak or some inconsistencies in the repository, a segment can go missing and repository might be inconsistent.
Steps to Implement the Journal Log in AEM
Usually the journal log file is located under /crx-quickstart/repository/segmentstore and the entries in the journal log have epoch timestamp (Unix timestamp ex: 1592560809149, 1592560959133).
- Stop the AEM instance.
- Open the journal log file and copy the last epoch time stamp entry and convert to human readable time stamp using https://www.epochconverter.com/.
- Identify the time frame when your AEM was running fine. There are couple of ways to do it. Two of them are:
* Run the consistency check
java -jar oak-run-*.jar check -d1 – bin=-1 -p crx-quickstart/repository/segmentstore/
After you run this command in terminal, look for the log entry which says “Found latest good revision: a0bf25e0-7c8b-44c7-acca-7a8066e83107:206” and then try to find this entry in journal log and delete all the entries beneath.*Randomly try to find the nearest epoch time stamp from the journal log which matches our time frame when AEM was in good condition (like 1 day ago or 2 ago days ago) and then delete the bottom entries from the log.
- Save the journal log and start the AEM.
Output:
AEM Application Maintenance Tips and Tricks
In today’s world, Adobe Experience Manager (AEM) is a comprehensive content management solution for building websites, mobile apps and forms. And it makes it easy to manage your marketing content and assets. Adobe Experience Manager can be a real challenge to architect, deploy, and integrate.
A prime factor here is, you need to understand how your AEM application is performing under certain conditions. This is best done by monitoring the application over a long period of time.
When it comes to managing and maintaining an AEM application, it’s not just system maintenance that we should be concerned about, we should also think of it from the application code perspective.
AEM application maintenance is two faceted. One is ongoing, regular maintenance which falls under AEM DevOps/AEM Administrator tasks. Second is following the best practices in application development.
Here we are going to list out the various aspects of application maintenance from both system and development point of view:
DevOps/Admin Tasks
Online Revision Cleanup:
Every update to the repository such as creating, modifying, or publishing a page/asset, running workflows etc., creates a new content version which gradually increases repository size. In order to improve the AEM application performance and avoid repository growth, the old versions need to be cleaned up to free disk resources. This operation is called Online Revision Cleanup which have been there since AEM 6.3.
Unlike Offline Revision Cleanup (aka Offline Compaction), Online Revision Cleanup doesn’t require AEM instance to be shut down. Online Revision Cleanup is enabled by default to run every day. However, the execution time can be adjusted so that it runs in off-peak hours when there’s minimal activity on the system.
You can find Online Revision Cleanup under Tools > Operations > Maintenance > Daily Maintenance Window.
Note: There’s always a chance that running Online Revision Cleanup for the first time may not reclaim any space. The reason is, Online Revision Cleanup reclaims old revisions by generations. A fresh generation is generated every time Online Revision Cleanup runs. Only the content which is at least two generations old, will be reclaimed. That simply means, on the first run, there’s nothing to reclaim.
Offline Revision Cleanup:
Offline Revision Cleanup (aka Offline Compaction) also helps in reclaiming disk resources by cleaning up old revisions. However, in this case, AEM instance needs to be shut down to free up the space. It needs to be run manually using a set of commands and oak-run JAR.
So, what is the benefit of Offline Revision Cleanup? With Offline Cleanup, you can reclaim more space because the online mode keeps one generation while offline mode keeps two generations.
Note: Offline Revision Cleanup should be used only on an exceptional basis.
Workflow Purge:
Whenever we upload an asset or modify its metadata, it triggers a workflow. And this is not the only instance which triggers a workflow in AEM, there are many more cases. Along with OOTB workflows, we create various custom workflows during the development cycle for different purposes. Once these workflows are complete, they get archived and never get deleted from system. Hence, workflow purging is one of the mandatory tasks in AEM maintenance to increase the performance of the workflow engine.
Note: Workflow purging can be done for completed as well as running workflows.
You can find Workflow Purge under Tools > Operations > Maintenance > Weekly Maintenance Window.
Clicking on the Settings icon will take you to Workflow Purge configuration window in OSGi console. Workflow Purge is a factory configuration which allows you to configure multiple purge configurations for different models and workflow status.
Version Purge:
AEM creates a version of a page or an asset when you can activate the content after modifying it. You can also do this manually using the Timeline tab in sidebar.
These versions never get purged and can be restored at any point of time. The repository size grows slowly over the time because of these versions and therefore they need to be cleaned up to free up the disk resources.
These versions can be purged through Version Purge maintenance task. This task can be scheduled to remove the old versions automatically.
Audit Log Purge:
AEM events that qualify for audit logging generate more archived data. This data can quickly grow over time due to replications, asset uploads, asset deletion, page creation/modification, and other system activities.
This event data can be purged through OOTB Audit Log Purge maintenance task.
You can find Online Revision Cleanup under Tools > Operations > Maintenance > Weekly Maintenance Window.
Clicking on the Settings icon will take you to Audit Log Purge configuration window in OSGi console. There are three types of log purge options:
DAM Audit log Purge Rule:
Pages Audit log Purge Rule:
Replication Audit log Purge Rule:
Generating Heap dump:
There are cases when your AEM application may go down all of a sudden after performing slow over a period of time and then runs out of memory. Such problems occur due to various reasons; one possible reason is, JAVA process was started with default heap memory settings. That means the JVM parameter -Xmx was not specified.
If that is not the case, then your AEM application might be retaining so many objects and not releasing them for Garbage Collection. This will cause a memory leak. This issue can be identified through Heap Dumps.
You just need to make sure that your system is configured to generate heap dumps. Heap dump can help you analyze application issues such as:
- Out of Memory Error
- Frequent garbage collections
You can either configure AEM to automatically generate heap dump when “Out of Memory” error occurs, or you can take it manually through OSGi console.
In order to automate it, you would need to add below JMX parameters to your startup script:
- -XX:+HeapDumpOnOutOfMemoryError
- -XX:HeapDumpPath=/path/for/generating/heapdump
On the other side, to generate heap dump manually, go to “/system/console/memoryusage”. Here you can either generate and download heap dump instantly by clicking “Dump Heap” or you can generate it at a regular interval.
Generating Thread dump:
Thread Dump is a list of JAVA threads that are active in a JVM at a certain period of time. When you want to analyze your application, it is recommended to take 10 thread dumps at regular intervals for e.g. 1 thread dump every 10 seconds.
You can generate a thread dump by using below command:
jstack -l <java_pid> >> threaddump.log
Once you have the thread dumps, you can use any third-party tool to analyze it. There are several third-party tools available.
Few other items to help you improve the AEM application performance:
- Enabling Minification and GZip
- In order to improve the page load time, you should minify JS and CSS files and Gzip them before delivering. Minification actually minifies JS and CSS files using YUI compressor.
- Check the dispatcher configuration
- Check the “/cache” section to see what all things are being cached and what all things get invalidated when you publish a page or an asset.
- Check statfile configuration on dispatcher.
- You need to make sure that your dispatcher is configured in such a way that it caches most of the documents and it passes very few requests to the Publish instance.
Development Tasks
Review all OOTB DAM workflows:
Workflows enable us to automate most of the activities in AEM. It’s an important processing part in AEM and needs to be configured according to the best practices, if not, there can be a major impact on the system performance. Hence, it is highly recommended to plan your workflows implementations carefully.
Minimize the number of launchers in AEM. There are listeners that are responsible for all of the registered workflow launchers: It will listen to all the changes on all of the paths specified in the globbing properties of the other launchers. When an event is dispatched, the workflow engine evaluates every launcher to determine if it should run.
Creating too many launchers will cause the evaluation process to run slowly. For this reason, it is recommended to create launchers only when needed and make the globbing path as specific as possible.
Note: Please disable any out-of-the-box launchers that are not in use.
Do not start Workflows from other Workflows. Workflows can carry a significant amount of overhead, both in terms of objects created in memory and nodes tracked in the repository. For this reason, it is better to have a workflow do its processing within itself rather than starting additional workflows.
Transient workflows:
When a workflow is transient, the runtime data related to the intermediate work steps is not persisted in the JCR whenever it is in processing. To optimize high ingestion loads, we can define a workflow as transient.
Wherever possible, set the DAM Update Asset workflow to transient. The setting significantly reduces the overheads required to process workflows because, in this case, workflows need not pass through the normal tracking and archival processes.
The advantages of transient workflows can include:
- A reduction in the workflow processing time; up to 10%.
- Significantly reduce repository growth.
- Reduces the number of TAR files to compact.
How to make the DAM Update Asset workflow Transient in AEM:
- Open http://localhost:4502/miscadmin on the AEM instance you want to configure.
- From the navigation tree, expand Tools > Workflow > Models > dam.
- Double-click DAM Update Asset.
- From the floating tool panel, switch to the Page tab, and then click Page Properties. Select Transient Workflow Click OK.
Query Performance Analysis:
Queries lacking a nodetype restriction force AEM to assume the nt:base nodetype, which every node in AEM is a subtype of, effectively resulting in no nodetype restriction.
Setting type=cq:Page or type=dam:Asset restricts this query to only cq:Page nodes or dam:Asset nodes, and resolves the query to AEM’s cqPageLucene, damLucene, limiting the results to a subset of nodes in AEM.
For cases where query execution is fast but the number of results are large, p.guessTotal is a critical optimization for Query Builder queries. p.guessTotal=100 tells Query Builder to collect only the first 100 results, and set a boolean flag indicating if at least one more results exist.
Oak Index Management:
Due to AEM’s flexible content architecture, it is difficult to predict and ensure that the traversals of content structures will not evolve over time to be unacceptably large. Therefore, ensure an index satisfy queries, except if the combination of path restriction and nodetype restriction guarantees that less than 20 nodes are ever traversed. One index is the Property Index, for which the index definition is stored in the repository itself. Implementations for Apache Lucene and Solr are also available by default, which both support full text indexing. The Traversal Index is used if no other indexer is available. This means that the content is not indexed, and content nodes are traversed to find matches to the query. If multiple indexers are available for a query, each available indexer estimates the cost of executing the query. Oak then chooses the indexer with the lowest estimated cost.
AEM’s internal re-indexing process collects repository data and stores it in Oak indexes to support performant querying of content. In exceptional circumstances, the process can sometimes become slow or even stuck. It is important to distinguish between re-indexing that takes an inappropriately long amount of time, and re-indexing that takes a long amount of time because of its indexing vast quantities of content. For example, the time it takes to index content scales with the amount of content, so large production repositories will take longer to re-index than small development repositories.
Why Outsource NextRow Digital for AEM Application Maintenance?
AEM has never been a one-size-fits-all system, and today more-so than ever. Here at Nextrow its fabulous that we do now have such a wealth of options on how to host AEM, and it’s important for anyone who has a stake in the game to weigh their options carefully as to where they’re going to put what will end up being their very most valuable pages and marketing assets.
If you’d like to know more about our AEM Managed Services, you can reach our sales team at +1-847-592-2920 or email us to sales@nextrow.com. The AEM experts at NextRow Digital would be happy to answer all your queries.
Make List View as Default View in AEM Assets
AEM Assets allows customers to manage their digital assets for e.g., images, videos, documents, and audio clips in a web-based repository. It includes Metadata-support, Renditions, Digital Asset Management Finder and AEM Assets Administration UI.
Most of the AEM Authors like to view their assets in List view compared to Column view and Card view. By default, AEM shows the assets in Card view. Through my experience in AEM, I had found an easy solution to make list view as a default view for assets.
Solution:
- Overlay the /libs/dam/gui/content/assets/jcr:content/views/list and under /apps/dam/gui/content/assets/jcr:content/views/list
- Add a property sling:orderBefore to the list node , something like below
name: sling:orderBefore String card
- The XML looks something like this
- Click on Save All.
Although there are multiple ways you can customize views in assets, this is one the simplest way to achieve this. If you want more tips and tricks on AEM, please check our blog page.
How to Use Crypto Support in AEM to Encrypt/Decrypt Data?
While working with AEM, sometimes we have requirements to call third-party APIs/Services. Configurations related to these APIs/Services like username, passwords, client id/secrets, API keys are usually stored in a code repository in the form of OSGi configuration. This sensitive information should be stored encrypted rather than plain-text format.
This is possible through the OOTB AEM Crypto Support bundle. This bundle provides services for encrypting and decrypting the confidential/secured data through system-wide keys (hmac and master files).
What are the Features of Crypto Support?
- Decryption happens at runtime.
- No one can decrypt the data through the UI. There’s no UI to decrypt the encrypted data. So, the information remains secure.
What are hmac/master keys?
- Encryption/decryption happens through keys (hmac and master files).
- These keys get generated during the first startup of AEM instance.
- In older versions of AEM (< 6.3), these files are stored under /etc/key but recent AEM versions have these files on the file system under crx-quickstart.
- These keys are unique for every AEM instance.
How to encrypt data using Crypto Support?
In order to encrypt a string, follow the below steps:
- Navigate to /system/console/crypto. The console looks like below:
- Enter the plain-text string in the “Plain Text” field and click on “Protect”.
- An alphanumeric value will get generated in “Protected Text” field.
- Copy above alphanumeric value including curly brackets. For e.g. {435c89a1e94895d5a8447b856ec479aa24d8cdfc7a6dc51991202b62b065a1e6}
- Go to code base and put the above value in your OSGi config like below
Note:
- Clicking on “Protect” again, will generate a new alphanumeric value. So, just click once and copy the alphanumeric value and put it in the code base.
- The encrypted value generated for the same plain-text string will differ from one AEM instance to another instance because keys are unique to each instance. We will talk about how to sync keys between the environments in our next blog.
How to decrypt data using Crypto Support:
@Reference
private CryptoSupport cryptoSupport;
public String getDecryptedValue(final String encryptedText) {
return cryptoSupport.isProtected(encryptedText)
? cryptoSupport.unprotect(encryptedText)
: encryptedText;
}
Note: For encrypted data, which is stored in OSGi configuration, we don’t need to call “unprotect” method explicitly as you see above. AEM has a Configuration Plugin to decrypt OSGi configuration properties. This plugin automatically decrypts and returns the plain-text string.
Crypto Support in AEM (Syncing keys among AEM instances)
In our previous blog, we saw how we can encrypt the secured and confidential data through OOTB AEM Crypto Support and store it in a code repository in the form of OSGi configuration.
Crypto Support is based on keys (hmac and master files) which are unique for each AEM instance. Encrypted text generated for the same plain-text string on one AEM instance will be different from another instance. This can raise alarms in cases where we have the same OSGi configuration values shared among Author and Publish instances under the same topology.
For e.g. /apps/my-project/config.prod/com.day.cq.mailer.DefaultMailService.xml.
Here SMTP password for Default Mail Service will be same across all Prod AEM instances. So, in order to make sure that the same encrypted value works on all Prod instances, we will have to sync hmac and master files among Prod Author and Publish instances.
Locating keys (hmac and master files):
Follow below steps to locate your keys:
- Navigate to /system/console/bundles and look for the “Adobe Granite Crypto Support” bundle. .
- Note the bundle ID.
- Navigate to file system: /crx-quickstart/launchpad/felix/bundle<id>/data .
- Open the “storage” file. This file contains just one single line:
- JCR i.e. files are stored in JCR under /etc/key.
- Bundle i.e. files are stored on a file system.
Note: If you have always upgraded your AEM instance using in-place upgrade, then these keys are going to be under /etc/key and there’s no harm in keeping these keys under /etc/key even though latest versions of AEM have moved the keys from JCR to file system (crx-quickstart). We had upgraded AEM for one of our clients from 5.6.1 to 6.1 and a few years later again from 6.1 to 6.3. The client is using Crypto Support and their keys are stored in /etc/key. If at all needed, you can move the keys from JCR to the file system and vice versa.
Syncing keys:
If keys are stored under /etc/key:
- Create a package of /etc/key from the source instance and install this package on the target instance.
- OR go to CRXDE, select node /etc/key; click on the Replication tab and press the Replication button.
- Restart target AEM instance.
If keys are stored on the file system:
- On the source instance, navigate to /system/console/bundles and look for the “Adobe Granite Crypto Bundle Key Provider” bundle. .
- Note the bundle ID.
- Navigate to file system: /crx-quickstart/launchpad/felix/bundle<id>/data .
- Copy hmac and master files from above directory.
- Follow steps 1-3 on target instance.
- Replace hmac and master files on target instance from the source instance hmac and master (copied in step 4).
- Restart target AEM instance.
Note: You can avoid restarting instance, rather you can restart the Crypto bundle “com.adobe.granite.crypto”. The catch here is – if you restart the Crypto bundle through OSGi console, the regular AEM login fails. So, it’s better to restart this bundle through CURL command.
Stopping the bundle:
curl -u admin:<admin_password>
http://<host>:<port>/system/console/bundles/com/adobe.granite.crypto -F action=stop
Starting the bundle:
curl -u admin:<admin_password>
http://<host>:<port>/system/console/bundles/com.adobe.granite.crypto -F action=start
Issues post hmac/master files sync:
If your target AEM repository had SSO/SAML integration, it will stop working after hmac/master files are synced from the source instance.
SSO/SAML integration works based on the trust store and key store. Passwords for trust store and key store are stored in an encrypted format in the repository under “keystorePassword” at below locations:
- /etc/truststore
- /home/users/system/authentication-service/keystore
You just need to the re-encrypt trust store and key store passwords and update “keystorePassword” properties at both the locations. This will resolve the issue.
Vanity URLs in AEM – Part 2
Configuring dispatcher to get the list of Vanity URLs:
In the given example below, for the demonstration purpose, we had set up an AEM instance and dispatcher in a local machine (PC). Same procedure can be applied in real-time applications as well.
Before making changes to the dispatcher configuration file, follow the below steps:
- Download Vanity URLs Component and install it on publish instance.
- In order to verify that the installation is done correctly, go to /libs/granite and look for dispatcher folder. If you have the dispatcher folder created, then you have successfully installed the package.
Now, give ‘Read’ permissions to Everyone group to /libs/granite/dispatcher/content/vanityUrls.
Now, let’s make changes to the dispatcher configuration file to get the list of Vanity URLs.
- Open dispatcher.any file and add /000X { /type “allow” /url “/libs/granite/dispatcher/content/vanityUrls.html” } to the /filter section (X can be replaced with any number).
- Now, add a caching rule to prevent caching of this URL. In order to do this, add /000X { /type “deny” /glob “/libs/granite/dispatcher/content/vanityUrls.html” } to the /rules section (X can be replaced with any number).
Now, it’s time to add the vanity_urls configuration. In order to do this, add the following to /farms section.
/vanity_urls
{/url “/libs/granite/dispatcher/content/vanityUrls.html”
/file “C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/vanity_urls”
/delay 300}
url: it is the path of the Vanity URL service that runs on the publish instance.
file : It’s path of the file that stores the list of Vanity URLs.
delay: it’s the time interval in seconds to call the Vanity URL service to get the list of updated Vanity URLs. In the above example, it calls the service for every 5 minutes.
- Save the file and restart the server.
- Navigate to the file path mentioned above C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/vanity_urls and you would see the vanity_urls file is created with the list of vanity URLs.
Now, you would be able to access the page using vanity URL using dispatcher which in fact would take you to the original URL.
Example: localhost:8080/analog-dark-wash-jean
Note: If you are not able to access the page using Vanity, make sure you have not added .html while creating a vanity URL. If you have added .html to the end of vanity URL, then remove it.
Above dispatcher configuration is a one-time set up and restart of the server is not required every time we add a new vanity URL on AEM pages. It automatically updates the vanity URLs list with the given time interval.
Adaptive Forms- A Powerful Way to Know Your Customers (How)
The center of any business is customer data. Customer data is used to acquire true knowledge about customer behavior and preferences while delivering the best services and products. Every business has set MarTech stacks to collect customer data. The sunset of third-party data affects the way businesses are collecting customer data. One of the most popular ways to collect data from customers, with their consent, is to encourage them to fill out digital forms. Adobe Experience Manager (AEM) offers an easy-to-use solution that can help you create, manage, update, and publish digital forms.
AEM forms help you to personalize communication with every customer on any channel and device. There are different types of AEM forms available – PDF forms, HTML forms, and Adaptive forms. Today we will walk you through Adaptive forms and explain its features, how you can create an adaptive form, and more.
What Is AEM Adaptive Form?
AEM Adaptive form amplifies engagement, simplifies enrollment, and brings down turnaround time. The AEM experience gives you mobile, analytics-friendly, and automated forms. It’s simple and easy to build forms that use an automated process. It reduces administrative and redundant tasks, is interactive and responsive in nature, and makes use of data analytics to personalize and improve the experience for customers. They can also be integrated with Adobe Campaign to manage campaigns and Adobe Analytics to get usage statistics.
Adaptive forms allow you to create, manage, and publish digital forms with out-of-the-box features and capabilities – dynamic, responsive, engaging, and adaptive.
New Features in Adaptive Forms
- Digital Signatures
With the highest level of compliance and assurance for authentication, a cloud-based digital signature or remote signature is the new norm. Adaptive forms are now available with Adobe Sign’s cloud-based digital signatures that will work across every platform – mobile, web, and desktop. - Adaptive forms for Single Page Application
You can embed a fully functional Adaptive form in an AEM Site SPA (Single Page Application). This feature allows users to fill in and submit the form without leaving the page. - Sort Columns
Columns can be sorted based on ascending or descending order based on- static text, data model object properties, or a combination of both. - Restriction for any specific path
You can have full control over where and how you want to create and display the form. You can restrict Adaptive Forms for any paths or pages. - Captcha in Adaptive forms
AEM Forms support advanced CAPTCHA capabilities in Adaptive forms to protect the online transaction from spam and malicious entry by bots. It can be implemented using Google’s reCAPTCHA service. - Rules on Adaptive forms
The rule editor feature enables users and developers to create rules to define actions that should be triggered on the forms in response to user inputs and actions. It can also streamline the future experience of form filing with higher accuracy and faster speed.
How to Create Multi-Tabbed Adaptive Forms
The user experience should always be the priority while designing and creating an adaptive form. Here are prerequisites and a few simple steps to create an adaptive form:
Prerequisite to create an adaptive form
- Setup an AEM author instance
- Install AEM Forms add-on on the author instance
- Obtain the JDBC database driver (JAR file) from the database provider
- Setup a database containing customer data through a database is non-essential to creating an adaptive form.
STEP 1: CREATE AN ADAPTIVE FORM
AEM Forms provide a drag-and-drop WYSIWYG editor to create adaptive forms.
STEP 2: CREATE A FORM DATA MODEL
It will connect an Adaptive form to a data source (such as a MySQL database) to retrieve, add, update, and delete data to connected sources.
STEP 3: CREATE RULES
Create rules for every object in the adaptive forms to trigger actions based on the preset conditions such as user inputs and actions.
STEP 4 : STYLE YOUR ADAPTIVE FORM
Define colors, background colors, alignment, and size to adaptive forms.
STEP 5 : PUBLISH IT
You have three ways to publish an Adaptive Form-
- Publish the adaptive form as an AEM Page
- Embed the adaptive form in an AEM Sites Page
- Embed the adaptive form in any external webpage or non-AEM webpage
Let’s Wrap Up
AEM’s Adaptive forms offer a lot of modern features and capabilities, which include faster and easier implementation, faster response and improved rendition time, faster server-side validations, and more. Moreover, in the future, we can expect a lot from AEM for digital forms that will elevate your business efficiency.
We understand that using and creating AEM Adaptive forms is a very powerful, but daunting task. Get assistance from an AEM expert to understand and harness the full potential of AEM forms. Connect with us at sales@nextrow.com.
AEM as a Cloud Service
We all know that Adobe always has something big to announce for its partners and customers, and we were expecting the same from Adobe at the NRF 2020 Retail’s Big Show held in New York City. On January 13, 2020, Adobe unveiled the availability of their newest offering Adobe Experience Manager (AEM) as a cloud application, where AEM runs natively in Adobe’s Experience Cloud.
Prior to this, Adobe Experience Manager was available either as a managed service or on-premises, but now, it is available as a pure cloud-native service.
Combining out-of-the-box components with advanced content customization options, the AEM as a Cloud Service allows marketers and developers to support the business models in a more simplified way and go live with new site experiences faster than ever before. It comes with a great opportunity for all those enterprises that are continuously striving to embrace the new technologies for the betterment of their business but need more simplicity and flexibility to fulfil their needs.
Managing tons of data across the various departments and personalizing it to honor user’s interests has always become a difficult challenge for B2B and B2C companies nowadays. Implementing AEM as a Cloud Service allows organizations to integrate the digital assets and customer conversations on a globally accessible platform and tailor the content as per the insights.
What’s more? You can interact with customers at any time of the day, no matter where they are! Having a real-time exposure to client experiences means you can follow a strategic approach that performs beyond their expectations and make sense to your existing clients
Why One Should Migrate AEM as a Cloud-Native SaaS Application?
While the early results show that the companies have seen vast growth in administrative efficiency, author productivity and content velocity, there is a reduction in downtime and maintenance efforts as well. Some salient benefits of migrating to AEM as a Cloud-Native SaaS application are:
- Quick Time to Market: With Adobe Experience Manager as a Cloud-Native application, you need not to worry about developing customized content management systems (CMS) and DAM environments for achieving a boost in sales and lead generation. AEM as a Cloud Service assists you in quickly delivering the products, services and experiences in just a few minutes, thus helping you save both time and money.
- Cross-Channel Experience Management: It’s time to deliver the right experiences to the right audience at the right time across various channels, devices and applications. Organizations can focus on creating useful, informative and precise content that addresses the pain-points of the potential prospects and leverage the power of built-in Adobe Sensei to automate the relevant content. This way, both the marketing and sales team can streamline the activities and drive real-time decisions.
- Version Less AEM: You can focus more on innovation rather than worrying about up-gradation to the latest and greatest AEM experience. The production environment is constantly maintained with its up-to-date software and other products that you need to build new websites and apps. All this is done through Cloud Manager CI/CD Pipeline. These upgrade operations are fully automated, so users don’t face service interruption.
- Auto-scalable: Being auto-scalable, customers don’t need to worry about the infrastructure aspect, AEM as a Cloud Service can scale automatically based on traffic and operations. It requires less support and maintenance efforts.
- Separation of code and content: The cloud architecture separates application content from code and configuration. Custom code and configurations are clubbed into the AEM base image which is then used to create multiple Author and Publish nodes. The changes to the code and configurations are made only through CI/CD pipelines in Cloud Manager.
What’s available with Cloud Service at the moment:
- AEM Sites
- AEM Assets
- Forms, Screens, and Communities are not supported currently.
Notable changes:
- Classic UI is no longer available in AEM as a Cloud Service.
- Replication agents have been removed. Content gets published using Sling Content Distribution.
- No changes to Publish repository are allowed. For example, User Generated Content (UGC) such as profile or form submissions – customers would need to use Unified Profile Service from the Experience Cloud Platform.
- Dynamic Media integration: Previous integrations with Dynamic Media Classic (Scene7) and Dynamic Media Hybrid mode are not available in AEM as a Cloud Service. Customers would need to use Dynamic Media provided with AEM as a Cloud Service.
- AEM Assets sharing with Marketing Cloud and Creative Cloud is not available. Customers would need to use Adobe Asset Link for integration with Creative Cloud.
- Asset uploads, processing, and downloads have been optimized in AEM as a Cloud Service to be more efficient; thus, enabling faster uploads and downloads.
- Enabled asynchronous operations for AEM Site features such as Page Move and Page Rollout.
- Customized code can only deploy through Cloud Manager (Adobe CI/CD pipeline) using the Adobe Git repository.
- Only Adobe IMS (Adobe SSO) Identity Management is supported for authentication.
- No access to OSGi console/Apache Felix to check or add your OSGi custom configs.
How to Deploy a Project to AEM as a Cloud Services
Let’s see how you can deploy a project by integrating the Adobe git repository with an external git repository.
Prerequisite
- A provisioned AEM Cloud Program
- Cloud Manager Git Repository
- GitHub Desktop
Step1- Clone your Demo GitHub
- Open GitHub Desktop.
Here open File, go to Clone Repository, and select the URL tab to Add this GitHub
URL:
https://github.com/adobe/aem-guides-wknd.git
Then, Clone and click on Fetch Origin.
Select Show in Explorer in Repository drop-down list
Note: Keep this Explorer or finder Window Open and follow Step 2.
Step 2: Clone Cloud Manager GIT Repository
Open Cloud Manager Program and Click on Manage GIT Button. From here, copy and save the GIT URL and Password in a separate Text file for later use.
Step 3: Navigate back to GitHub Desktop
Go to File > Clone Repository, Select the URL tab and Add the saved Git URL. Then click on Clone. Now, you have to authenticate using the User Id and Password copied from Cloud Manager UI.
Again, Click on Fetch Origin and follow these steps:
- Go to Repository > Show in Explorer
- Delete all the content except the .git folder
- Copy all the content, excluding the .git folder from the aem-guides-wknd Git Folder
- Paste the content into the Cloud Manager Git Repository Folder
- Provide a commit message and Commit to Master
- Click on Push to Master
Step 4. Create a Non-Production Deployment Pipeline
- Navigate to AEM Cloud Service Programs where you will find Non-Production Pipeline Card and Click on Add
- Now you need to add Pipeline Name and Pipeline Type as Deployment Pipeline
- Select master Git Branch and then Pipeline Options Manual
Step 5. Deploy the project
Hover over the created pipeline where you will find Build, and click on it. Now you can Download and Inspect Logs.
Let’s Wrap Up
All-in-all, it won’t be wrong to say that Adobe Experience Manager launched as a Cloud Service offers all the benefits that you expect from a cloud-based application and can add value to your overall business performance, making it stand out in this ever-changing global market.
As a Gold solution partner of Adobe, this is just a glimpse of AEM as a Cloud Service from the team of NextRow Digital, and in the subsequent blogs, you can expect to see a lot more posts as we get to know more about it in the upcoming Adobe Summit! To know more about our offerings or consult an expert, you can email us or call us at +1-847-592-2920. We will get in touch with you within 24 hours!