wttech / aemc

AEM Compose (Core & CLI)
https://wttech.blog/blog/2023/get-your-aem-together-with-aem-compose/
Apache License 2.0
40 stars 5 forks source link

How to install AEM service package and AEM Forms add-on #263

Closed royteeuwen closed 3 weeks ago

royteeuwen commented 3 weeks ago

I'm trying out the aemc cli to see what features it provides, but something I don't see any reference to in the docs / readme is the installation of a service package of aem forms? Both of these typically require a restart from the initial up, a restart after installation and some changes to sling.properties file to make it work. Besides this, they often take a very long time compared to other packages, so special timeouts / checks are typically also required. What is the recommended approach for installing these?

In the end, I would also expect the same things to happen in the ansible collection if I'd want to use this on higher env's

krystian-panek-vmltech commented 3 weeks ago

Hi @royteeuwen :)

To install the AEM service pack in the way you want, organize it into a set of commands:

sh aemw pkg deploy --file "aem/home/lib/aem-service-pkg-6.5.21.zip"
sh aemw instance restart

If you want to change timeouts or skip some checks, use environment variables per command as documented here:

https://github.com/wttech/aemc?tab=readme-ov-file#installing-content-packages

To update sling.properties automatically (managed by AEMC when running the sh aemw instance launch command), simply update the sling.properties section in aem.yml:

local_author:
  # ...
  sling_props:
    - org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*,com.yourkit.*,sun.*,com.sun.*,weblogic.xml.*,__redirected,__redirected,com.ibm.xml.*

local_publish:
  # ...
  sling_props:
    - org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*,com.yourkit.*,sun.*,com.sun.*,weblogic.xml.*,__redirected,__redirected,com.ibm.xml.*

I assume that you are using AEMC not only to install the service pack but also to set up AEM instances. AEMC tracks these changes of properties, updates the instances automatically, and restarts them to apply the changes for you.

Besides this, they often take a very long time compared to other packages, so special timeouts / checks are typically also required

AEMC default configuration around instance health checking is pretty defensive and it was tested with SP installations. I am using it almost every day without issues on various types of machines (Mac M1, slow Windows, etc.).

In the end, I would also expect the same things to happen in the ansible collection

it will work in the same way. we/VML already use this in some projects for higher env setups. Ansible modules are simply tiny wrappers on top of that CLI.

royteeuwen commented 3 weeks ago

@krystian-panek-wttech thanks for the explanation!

Do I understand it correctly that if I'd like to make this automated when a new developer sets up his AEM project and AEM instance, I'd either have to automate this in a Taskfile or by using Ansible locally as well?

Preferably I'd like to share the code that is used locally and on higher envs as to not have to duplicate / rewrite everything in both tasks and ansible, but it seems the readme's preference for local does seem to be tasks. Is there a reason for this? Wouldn't it be easier to share the ansible playbooks across all envs?

krystian-panek-vmltech commented 3 weeks ago

The reason is that plenty of devs use Windows but Ansible on Windows does not play well. Then you need virtualization (to run Ansible and AEM) but... AEM is too heavy for that. You could use single automation assuming that you have devs working on unixes. AEMC do the same things on Windows and Unixes so risk of having duplicated automation (Ansible and Taskfile) acting differently is much reduced.

royteeuwen commented 3 weeks ago

OK got it! luckily I have the benefit of having all devs on unixes 😅, so that does indeed simplify it