Best Practice for automating AEM Bundles Deployment (On Prem) | Community
Skip to main content
BinaryAlchemy11
Level 3
November 11, 2024
Solved

Best Practice for automating AEM Bundles Deployment (On Prem)

  • November 11, 2024
  • 2 replies
  • 1225 views

I am exploring options for automating the deployment of the Bundles in the On Prem instance. I have seen various options available for the cloud however not many for On Prem.

 

The requirement is for automating the build and deploying bundles only to the On Prem instances from local. As of now, we have been separately creating bundles and installing them straight from the felix console for the On Prem instance /system/console/bundles after doing a maven build locally.

 

Any suggestion or best practice (documentation if any) would be helpful.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by narendiran_ravi
  1. Even when your AEM instance uses SSO for authentication, you can still create user accounts directly in AEM for using with curl commands.
  2. Additionally, it's possible to trigger builds and execute curl commands on commits using the .gitlab-ci.yml file. For more details, refer to GitLab CI/CD Quick Start.
  3. If you're using Jenkins, you can build only the core project by specifying the directory and Maven command in your build steps. You can also deploy a specific bundle by passing its name in the curl command. More information is available in the Jenkins Pipeline documentation

2 replies

GabrielMircea
Level 2
November 11, 2024

 

You can try:

mvn clean install sling:install

This will build the bundle and deploy it directly to your AEM instance.

 

https://sling.apache.org/components/sling-maven-plugin/install-mojo.html

 

narendiran_ravi
Level 6
November 11, 2024

You can automate the installation of a bundle in AEM using the curl command. Create a shell or batch script according to your environment and requirements.

Command to Install a Bundle:

curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@"name_of_jar.jar" http://localhost:4505/system/console/bundles
  • Replace admin:admin with your AEM credentials.
  • Replace name_of_jar.jar with the actual filename of your bundle.
  • This command installs the bundle and sets the start level to 20.

Automating with a CI/CD Pipeline
Instead of building code locally and deploying manually, consider setting up a CI/CD pipeline. Using tools like Jenkins, Azure DevOps, or other similar CI/CD platforms can streamline your build and deployment process.

BinaryAlchemy11
Level 3
November 11, 2024

Thanks for the reply and the suggestion. I have few questions on this.

1. We are using SSO so is there any other way to replace with admin:admin credentials?

2. Can we run the batch script integrating with gitlab once the commit has been done?

3. For the automation with CI/CD pipeline, how do we configure for the individual bundles deployment only? I know I have seen jenkins integration with the whole maven project structure for AEM archetype. However, not seen for individual bundles setup.

Tethich
Community Advisor
Community Advisor
November 11, 2024

@binaryalchemy11 

 

1. Me, I am using smth like this in my local

curl 'http://localhost:4592/content/dam/ttaaaacs' -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Authorization: Basic YWRtaW46YWRtaW4=" --data-binary '{}'

Maybe this helps. See also https://reqbin.com/req/c-haxm0xgr/curl-basic-auth-example

But for SSO I think things are more complicated. I found this : https://www.ssocircle.com/en/developer-tutorial-saml-testing-using-curl-and-ssocheck-api/developer-tutorial-part-i-a-saml-sso-flow-from-the-command-line-with-curl/ .