valtech / aem-easy-content-upgrade

AEM Easy Content Upgrade simplifies content migrations in AEM projects
Other
61 stars 26 forks source link

Support AEMaaCS #146

Closed kwin closed 3 years ago

kwin commented 3 years ago

To support executing scripts also with AEM as a Cloud Service the Groovy scripts need to be moved outside of /var/.... For details refer to https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package. A similar issue was once reported in https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2334.

I propose to also support scripts below /content/groovyconsole/scripts/aecu. Placing it below the immutable parts of the repo (i.e. /apps) will not work as then embedding package becomes package type apps and then the install hook is executed too early (during the docker build, while the mutable content is not yet bound).

kwin commented 3 years ago

I am wondering if the statement from the readme is still true

All migration scripts need to be located in /var/groovyconsole/scripts/aecu.

(https://github.com/valtech/aem-easy-content-upgrade/blame/develop/Readme.md#L121) It seems it already supports other locations. Would be good to clarify that in the readme.

gruberrolandvaltech commented 3 years ago

The statement is still valid. There is just one base folder for the install hook.

Of course, we can add more folders. But I think we should address this to GroovyConsole first. This only supports /var (at least for the GUI). So we need some additional official location that we can use. E.g. /content/groovyconsole is not installed by any package.

gruberrolandvaltech commented 3 years ago

In addition, the install hook history must then be moved out of /var, too. Otherwise, scripts would be reexecuted on each deploy?

kwin commented 3 years ago

Creating /var nodes while executing the scripts works fine even in AEMaaCS, but you cannot install nodes into /var via packages (the reason for that is that the service user used for deployment of packages to publish instances does not have write access to that part of the repo) Also AFAIK the groovy console already supports script executions from arbitrary locations: https://github.com/icfnext/aem-groovy-console/blob/9beea9c99287156e283c94c831f6939a98fac3e1/src/main/groovy/com/icfolson/aem/groovy/console/impl/DefaultGroovyConsoleService.groovy#L73. Only saving them is supported only to /vars (https://github.com/icfnext/aem-groovy-console/blob/9beea9c99287156e283c94c831f6939a98fac3e1/src/main/groovy/com/icfolson/aem/groovy/console/impl/DefaultGroovyConsoleService.groovy#L120). I don't care too much about the Groovy Console Web UI as the AECU is good enough for me :-)

kwin commented 3 years ago

I opened https://github.com/CID15/aem-groovy-console/issues/1 for the necessary upstream adaptations in GroovyConsole.

kwin commented 3 years ago

Also the way how upgrades are applied needs to be changed, as install hooks are not supported in mutable content packages (https://github.com/Netcentric/aem-cloud-validator#prevent-using-install-hooks-in-mutable-content-packages) in AEMaaCS.

gruberrolandvaltech commented 3 years ago

@kwin I merged your PR to a branch here to make some changes: https://github.com/valtech/aem-easy-content-upgrade/pull/152

Main issue now is that the repoinit ACLs are not applied at all (neither latest AEM cloud nor AEM 6.5). The service users are created fine. Logs tell something about ACL creation but it is not stored.

Did you test this locally? Was ACL setup working for you?

gruberrolandvaltech commented 3 years ago

Changed to classic ACLs, this is working.

gruberrolandvaltech commented 3 years ago

Publish issue: https://issues.apache.org/jira/browse/JCRVLT-427

kwin commented 3 years ago

Adobe is investigating the installhook issue in ticket # SKYOPS-13098. Feel free to raise another ticket via Adobe Support to increase prio.

royteeuwen commented 3 years ago

@kwin so is that the last hurdle in getting it fully supported in AEM as a cloud service? The workaround being at the moment by calling through http in a specific step?

gruberrolandvaltech commented 3 years ago

Yes, this is basically the last issue to get it working.

kwin commented 3 years ago

As it seems that the Groovy Console is no longer maintained (https://github.com/CID15/aem-groovy-console/issues/1), you also need to come up with a custom packaging of the Groovy Console bundle as installing the Groovy Console Package on AEMaaCS may fail (due to inclusion of /var nodes) or alternatively rely on a different Groovy script bundle like https://github.com/apache/sling-org-apache-sling-scripting-groovy.

kwin commented 3 years ago

@gruberrolandvaltech When is a release planned supporting AEMaaCS? Even if installhooks are not yet supported the tool might still be useful.

gruberrolandvaltech commented 3 years ago

I think next week should be fine. The cloud package needs a bit of change to include some content of Groovy Console to get it working for developers.

royteeuwen commented 3 years ago

So how did the groovyconsole issue get fixed for AEMaaCS? I don't see any commits on their repo

gruberrolandvaltech commented 3 years ago

For the time being we copy over the needed bundles and HTL and embed it in AECU.

royteeuwen commented 2 years ago

@gruberrolandvaltech @kwin I still see that mutable content install hook is not supported? So the preferred way stated here on how to start installation in AEM cloud is not supported if I'm correct? Any best practice alternatives you have so far?

Is it not feasible to use something like in the accesscontroltool: https://github.com/Netcentric/accesscontroltool/blob/develop/docs/ApplyConfig.md#startup-hook