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
158 stars 32 forks source link

Dispatcher error on Docker Desktop (Windows) #471

Closed pun-ky closed 4 years ago

pun-ky commented 4 years ago

when having multiple markets e.g /content/exmaple/en-us ,/content/example/en-gb AEM dispatcher notices an error when creating file in cache then renaming file to target name (swapping cache entry)

the cause of error is volume for cache directory; on Unix based systems it is working correctly. On windows / hyper-v the error might occur:

[Thu Oct 03 08:06:49 2019] [W] [pid 14 (tid 140276883449600)] Unable to rename generated cache file /opt/aem/dispatcher/cache/content/example/demo/en-us.html_SRMSSxuQaC to /opt/aem/dispatcher/cache/content/example/demo/en-us.html: No such file or directory
pun-ky commented 4 years ago

workaround found:

image

disabling volume for cache and creating document roots manually via init script

mierzwid commented 4 years ago

I suggest using exec before apache2 starts and creating those missing directories directly in the container. So we will keep one way of creating them no matter if bind mount works or nor and we are in sync with directories dsl from environment plugin:

directories {
            regular(
                    "httpd/logs"
            )
            cache(
                    "httpd/cache/content/example/live",
                    "httpd/cache/content/example/demo"
            )
        }
pun-ky commented 4 years ago

it would be nice if it will be fixed together with https://github.com/Cognifide/gradle-aem-plugin/issues/448

pun-ky commented 4 years ago

@mierzwid so that this section could be removed, but then cleaning should be moved to clean { }

pun-ky commented 4 years ago

target DSL

aem {
     environment {
        dockerContainers {
            "httpd" {  // or 'define("httpd")'
                up {
                    exec("mkdir -p /opt/aem/dispatcher/cache/content/example/demo")
                    exec("mkdir -p /opt/aem/dispatcher/cache/content/example/live")
                    exec("command for restarting httpd)
                }
                clean {
                   exec("rm -fr /opt/aem/dispatcher/cache/content/example/demo/*")
                   exec("rm -fr /opt/aem/dispatcher/cache/content/example/live/*")
                }
            }
            "knotx" { // or 'define("knotx")'
                up {
                    // exec any init commands needed
                }
                clean {
                    exec("sudo service knotx restart") // sth like that
                }
            }
        }
pun-ky commented 4 years ago

DSL proposal #477

image

pun-ky commented 4 years ago

to be released in 8.0.0