wttech / gradle-aem-plugin

Swiss army knife for Adobe Experience Manager related automation. Environment setup & incremental AEM application build which takes seconds, not minutes.
https://tech.cognifide.com/tag/gradle-aem-plugin
Apache License 2.0
157 stars 32 forks source link

Local instance with custom password not working #404

Closed oskbed closed 5 years ago

oskbed commented 5 years ago

Gradle Installer fails during health checks of instance due to not proper password management. Most probably scenario:

Gradle sets custom password for aem but healtchecks are checking default - admin - password. Gradle is checking custom password, but aem still has default password set.

Everythings works just fine if password admin is used, but sometimes fails if other is used. It seems, it depends when AEM is started.

08.07.2019 11:09:10.540 *ERROR* [qtp762685794-70] org.apache.felix.http.jetty Exception while processing request to /system/console/bundles.json (org.apache.sling.api.auth.NoAuthenticationHandlerException)

pun-ky commented 5 years ago

Algorithm used by GAP (being more strict / not gradle 😉) when instance is being initialized firstly is trying to use password defined in instance definition (properties file) then it is dynamically switching to 'admin' when unauthorized status code is detected. AEM initialization is working in that way.. Regardless admin password set - admin' password is predefined, then after some time custom admin password is being activated. That was tested scenario for AEM 6.3. I hope that it is still accurate. If not some issue may be to be addresed but more details are needed to be able to understand the problem.

Greetings, Krystian

pun-ky commented 5 years ago

You mentioned health checks... Instance Check task has this extension with switching admin password credentials so it should work. Environment check does not have but I am quite sure that it should be run when instance is already initialized so that mentioned fallback mechanism should not be necessary.

Your error looks more like configuration problem, not GAP related.

pun-ky commented 5 years ago

You could check using debugger if this fallback mechanism is still working here https://github.com/Cognifide/gradle-aem-plugin/blob/master/src/main/kotlin/com/cognifide/gradle/aem/common/instance/check/DefaultCheck.kt#L35. If not we will have regression here in GAP 7. But first please confirm

pun-ky commented 5 years ago

I can confirm that it is a regression in GAP 7.

previously InstanceSync was stateful, now it is also stateful but DefaultCheck and so on BundlesCheck are being instantiated every time after each group check iteration. So that we are loosing that information that AEM applied custom password at some moment. To handle that, such moment need to be noted in BuildScope / not in InstanceSync being used in DefaultCheck.

As a workaround, you need to use default password right now admin, custom passwords support will be recovered in the end of next week at latest.

oskbed commented 5 years ago

Thanks for solving this issue! Btw, issue regards both local and remote instance to be precise.

pun-ky commented 5 years ago

Yep. But affects only instances launched first time.

pun-ky commented 5 years ago

fixed.

now when running instanceUp first time / just after instanceCreate with -i option, then moment when AEM is starting using customized password is now noticable:

image

releasing 7.0.5

pun-ky commented 5 years ago

@oskbed confirmed that fix is working. Closing as released in 7.0.5