Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to deploy aem cloud dispatcher code into local apache?

Avatar

Level 9

Team - I have completed setting aem author, aem publisher and dispatcher module in apache in mac. I have added below below config in httpd.conf and have setup disatcher.any file. It works fine perfectly. 

 

 

LoadModule dispatcher_module /private/libexec/apache2/mod_dispatcher.so "Ezhilarasu R’s CA"

<IfModule disp_apache2.c>

    # location of the configuration file. eg: 'conf/dispatcher.any'
    DispatcherConfig /private/etc/apache2/conf/dispatcher.any

    # With version 4.3.3 and later, dispatcher log messages can be directed
    # to Apache's standard error log, alongside messages from other modules

    DispatcherLog /private/var/log/apache2/dispatcher.log
    DispatcherLogLevel debug

    # Directives DispatcherLog and DispatcherLogLevel are still available
    # but using standard Apache directives (e.g. LogLevel) follows the
    # paradigm of common Apache modules:
    LogLevel dispatcher:debug

    # For better monitoring/analysis, create a custom log format for dispatcher
    # requests, similar to AEM's request.log
    LogFormat "%t \"%m %{dispatcher:uri}e%q %H\" %{dispatcher:status}e %{dispatcher:cache}e [%{dispatcher:backend}e] %{ms}Tms" dispatcher
    CustomLog "/private/var/log/apache2/dispatcher.log" dispatcher "expr=%{HANDLER} == 'dispatcher-handler'"

    # if turned on, request to / are not handled by the dispatcher
    # use the mod_alias then for the correct mapping
    DispatcherDeclineRoot Off

    # if turned on, the dispatcher uses the URL already processed
    # by handlers preceeding the dispatcher (i.e. mod_rewrite)
    # instead of the original one passed to the web server.
    DispatcherUseProcessedURL On

    # if turned to 1, the dispatcher does not spool an error
    # response to the client (where the status code is greater
    # or equal than 400), but passes the status code to
    # Apache, which e.g. allows an ErrorDocument directive
    # to process such a status code.
    #
    # Additionally, one can specify the status code ranges that should
    # be left to web server to handle, e.g.
    #
    # DispatcherPassError 400-404,501
    DispatcherPassError 0

    #
    # DispatcherKeepAliveTimeout specifies the number of seconds a
    # connection to a backend should be kept alive. If not set or
    # set to zero, connections are not kept alive.
    #
    #DispatcherKeepAliveTimeout 60

    #
    # DispatcherSSINoCache specifies whether not to cache SSI included file. 
    # If set to Off, the included files are cached, otherwise, they are not cached.
    #
    # In a highly concurrent environment, a cached SSI included file might get
    # deleted at the same time it is about to get delivered, which results in
    # malformed responses. If you encounter such issues, it is best to turn
    # this option to On.
    #DispatcherSSINoCache Off

    #
    # DispatcherRestrictUncacheableContent specifies whether to remove cache control headers 
    # which helps in client caching or not. If set to on, the cache control headers 
    # are removed for uncacheable content, otherwise, not.
    DispatcherRestrictUncacheableContent Off

</IfModule>
    
<Directory />
    <IfModule disp_apache2.c>
        ModMimeUsePathInfo on
        SetHandler dispatcher-handler
    </IfModule>
    Options FollowSymLinks
    AllowOverride None
</Directory>

 

 

But in cloud project I want to deploy config.d and conf.dispatcher.d folder in apache. Is there any option available ?

 

Mario248_0-1727784998452.png

 

I am referring to https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/local-development-.... which explains how to run the dispatcher locally using Docker. Should I revert my existing HTTPD setup and follow the instructions provided in the guide?

Additionally, I followed the steps in the document and ran the following command:

 

 

sh docker_run_hot_reload.sh /Users/xx/disp/dispatcher-sdk-2.0.226/src http://localhost:4503 8080

 

 It ran certain command and ended up with "Waiting until http is available" and it never goes after this command

 

 

opt-in USE_SOURCES_DIRECTLY marker file detected
Running script /docker_entrypoint.d/05-display-image-version.sh
Image version: 2.0.226
Running script /docker_entrypoint.d/10-check-environment.sh
Running script /docker_entrypoint.d/15-check-pod-name.sh
Running script /docker_entrypoint.d/20-create-docroots.sh
Running script /docker_entrypoint.d/25-create-multipurpose-temp-files.sh
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_0=/tmp/apache-multipurpose-temp-file-0
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_1=/tmp/apache-multipurpose-temp-file-1
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_2=/tmp/apache-multipurpose-temp-file-2
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_3=/tmp/apache-multipurpose-temp-file-3
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_4=/tmp/apache-multipurpose-temp-file-4
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_5=/tmp/apache-multipurpose-temp-file-5
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_6=/tmp/apache-multipurpose-temp-file-6
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_7=/tmp/apache-multipurpose-temp-file-7
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_8=/tmp/apache-multipurpose-temp-file-8
Creating Apache multipurpose temp file APACHE_MULTIPURPOSE_TEMP_FILE_9=/tmp/apache-multipurpose-temp-file-9
Running script /docker_entrypoint.d/30-wait-for-backend.sh
Waiting until http is available

 

 

If I start apache manually by "sudo apachectl start" I can access my aem pages using http://localhost:8080/content/xxx/test.html. But it is not working with docker command ? any idea how to fix this issue?

1 Accepted Solution

Avatar

Correct answer by
Level 5

You can try reverting the changes made to your local httpd and stopping Apache manually before running the docker command to start the dispatcher. 

Additionally when running the docker_run.sh file, try using the command /bin/docker_run.sh ./src host.docker.internal:4503 8080 instead of localhost. Refer to this blog for more details -https://medium.com/@bhargava.shalki/how-to-setup-dispatcher-for-aem-cloud-on-local-mac-os-9d8246704d52

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

You can try reverting the changes made to your local httpd and stopping Apache manually before running the docker command to start the dispatcher. 

Additionally when running the docker_run.sh file, try using the command /bin/docker_run.sh ./src host.docker.internal:4503 8080 instead of localhost. Refer to this blog for more details -https://medium.com/@bhargava.shalki/how-to-setup-dispatcher-for-aem-cloud-on-local-mac-os-9d8246704d52