Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Clearing etc.clientlibs on publish

Avatar

Level 3

What are the option to clear the etc.clientlibs folder in dispatcher under "/var/www/html" directory. Some times we need to make a change in clientlibs in CRX or publish React SPA site page but etc.clientlibs folder doesn't get clear in dispatcher flush. Given we don't have access to Prod dispatcher server to clear it manually or use curl command. I already try "/libs/granite/ui/content/dumplibs.rebuild.html?invalidate=tru" but that doesn't clear it either. 

 

We see the update clientlib in author but don't see it in publisher. How can etc.clientlibs we updated every time JS is updated in author?

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @snowwhite92 


1.If you're unable to manually clear the /etc/clientlibs folder on the production Dispatcher server, and the standard methods like using the /libs/granite/ui/content/dumplibs.rebuild.html?invalidate=true URL aren't working, you might need to consider alternative approaches. Here are a few options:

2.Dispatcher Flush Rules:
Ensure that your Dispatcher is properly configured to handle flush requests. Check the dispatcher.any configuration file for rules related to flushing. Confirm that the rules are correctly set up to invalidate and remove the /etc/clientlibs cache.

3.Custom Flush Agents:
You can set up custom flush agents or scripts on your authoring environment. When a change is made in CRX or when you publish a React SPA page, trigger these custom flush agents to notify the Dispatcher to clear the /etc/clientlibs cache.

4.Automated Deployment Tools:
If you are using automated deployment tools such as Jenkins or Ansible, you can integrate a step to trigger a cache flush on the Dispatcher after a successful deployment.

5.Dispatcher Flush Scripts:
Consider creating a custom script that can be executed on the Dispatcher server to clear the /etc/clientlibs cache. This script could be triggered remotely, but make sure it's secure and only allows authorized users to execute it.



View solution in original post

6 Replies

Avatar

Level 8

Hello @snowwhite92 

 

You can achieve this by using versioned clientlibs so that you get a new version of clientlib everytime you make an update.

 

Based on your AEM version (6.5 or AEM as a Cloud Service) you can use different method to enable versioned clientlibs.

 

AEM 6.5 https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html

AEM as a Cloud Service https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/conten...

 

Thanks

Narendra

Avatar

Community Advisor

You can use acs commons dispatcher flush to make a flush request(invalidate/delete) for the path on dispatcher 

https://adobe-consulting-services.github.io/acs-aem-commons/features/dispatcher-flush-ui/index.html

Avatar

Correct answer by
Community Advisor

Hi @snowwhite92 


1.If you're unable to manually clear the /etc/clientlibs folder on the production Dispatcher server, and the standard methods like using the /libs/granite/ui/content/dumplibs.rebuild.html?invalidate=true URL aren't working, you might need to consider alternative approaches. Here are a few options:

2.Dispatcher Flush Rules:
Ensure that your Dispatcher is properly configured to handle flush requests. Check the dispatcher.any configuration file for rules related to flushing. Confirm that the rules are correctly set up to invalidate and remove the /etc/clientlibs cache.

3.Custom Flush Agents:
You can set up custom flush agents or scripts on your authoring environment. When a change is made in CRX or when you publish a React SPA page, trigger these custom flush agents to notify the Dispatcher to clear the /etc/clientlibs cache.

4.Automated Deployment Tools:
If you are using automated deployment tools such as Jenkins or Ansible, you can integrate a step to trigger a cache flush on the Dispatcher after a successful deployment.

5.Dispatcher Flush Scripts:
Consider creating a custom script that can be executed on the Dispatcher server to clear the /etc/clientlibs cache. This script could be triggered remotely, but make sure it's secure and only allows authorized users to execute it.



Avatar

Level 3

@Raja_Reddy  I been doing some digging into the options you suggested. "Dispatcher Flush Rules and Custom Flush Agent" seems to be the easiest and quick option but we don't want to clear the whole etc/clientlibs folder every time someone publish any page on site. Since we are running multiple sites it would be preferable to only remove the cache specific to the site or to the page file. Do you have any examples of the dispatcher rules to only clear publish page specific files for better performance? 

Avatar

Level 6

I would like to add another option with @Raja_Reddy ,

You can create a servlet and put it under a basic auth. The servlet can call dispatcher api and clear the cache.
We have similar thing configured on our server.

For every dispatcher you have a private ip. It will be a replica of dispatcher flush agent from your code.

Whenever e content is published the dispatcher flush agent is just calling a api to the dispatcher with the path you published.
Same thing you will do on servlet.  Adobe also have a documentation on this https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/page-invalid...

Avatar

Administrator

@did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni