AEM Dispatcher setup on CentOS

arunaaems506124

02-01-2020

Hi All,

 

I am trying to configure Apache webserver(2.4) with Dispatcher(4.3.3) in AEM 6.5 using with docker image and container. When I execute container I am able to see requirest are going through server.For the first time error-log, access-log and dispatcher.log got created.Also I can see dispatcher initlizing messge as below.

Dispatcher initializing (build 4.3.3/apache-2.4-linux-x86_64)
[Thu Jan 02 20:51:57 2020] [D] [pid 1] farms[publish].cache.docroot = /var/www/html
[Thu Jan 02 20:51:57 2020] [I] [pid 1] Dispatcher initialized (build 4.3.3/apache-2.4-linux-x86_64)
[Thu Jan 02 20:51:57 2020] [D] [pid 1] HTTP keepalive is enabled, timeout is 60 seconds.
[Thu Jan 02 20:51:57 2020] [D] [pid 1] Dispatcher initializing (build 4.3.3/apache-2.4-linux-x86_64)
[Thu Jan 02 20:51:57 2020] [D] [pid 1] farms[publish].cache.docroot = /var/www/html
[Thu Jan 02 20:51:57 2020] [I] [pid 1] Dispatcher initialized (build 4.3.3/apache-2.4-linux-x86_64)
[Thu Jan 02 20:51:57 2020] [D] [pid 1] HTTP keepalive is enabled, timeout is 60 second

 

When I try to access any page hen dispatcher.log is not getting updated or any request or anything else.

does it mean my dispatcher working fine or not?

 

 

Accepted Solutions (1)

Accepted Solutions (1)

MaxBarrass

11-01-2020

Try accessing your dispatcher using In-Private browser tab, if you have any login cookies dispatcher will not cache things.

 

Thank you @arpitv27529355.

@arunaaems506124 you can pull the dispatcher image from docker hub https://hub.docker.com/r/aemdesign/dispatcher

I have also updated it to ensure you can get JSON log output so that it can be easily consumed by log parsers. This is not as straight forward for dispatcher as it is for Apache.

 

Hope you find this useful.

Answers (3)

Answers (3)

arpitv27529355

06-01-2020

Hi @arunaaems506124 

 

Are you able to see your pages in webserver? try to change the dispatcher log level to debug and check.

Here is a sample configuration for dispatcher in httpd.conf:

... 
<IfModule disp_apache2.c>
    # location of the configuration file. eg: 'conf/dispatcher.any' 
    DispatcherConfig conf/dispatcher.any

    # location of the dispatcher log file. eg: 'logs/dispatcher.log' 
    DispatcherLog '|/usr/local/apache/bin/rotatelogs /var/logs/%Y-%m-%d-dispatcher.log 86400 -240'

    # log level for the dispatcher log 
    # 0 Errors 
    # 1 Warnings 
    # 2 Infos 
    # 3 Debug 
    DispatcherLogLevel 3 

    # if turned to 1, the dispatcher looks like a normal module 
    DispatcherNoServerHeader 0 

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

    # if turned to 1, 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 0 

</IfModule>

 

If you wanted to see more what AEM and docker can do together. I would recommend you to go and explore AEM.design framework:

https://github.com/aem-design/aemdesign-aem-core

https://hub.docker.com/r/aemdesign/dispatcher

you can run the Docker bundle image to check it out in the showcase site, read this to get started https://aem.design/blog/2019/08/30/docker-aem-bundle

 

Please share your feedback as well.We are happy to help you out.

 

FYI @MaxBarrass 

 

arunaaems506124

03-01-2020

@arpitv27529355,

 

Thanks for the reply.

Please find below info on your queries.

 

  • Can you ensure your docker container is running successfully and active.
  • Yes Docker container is running. I can see the below messages.

    $ docker info
    Client:
    Debug Mode: false

    Server:
    Containers: 28
    Running: 4

  • Can you please confirm how you're accessing the dispatcher server, have you done the port mapping to access the server to your local machine from docker container?

I am trying to access dispatcher :http://localhost:8089/content/we-retail.html

since i exposed port 8089 while creating docker container. 

  • What exactly web server is displaying when you are trying to access?
  • I can see request are coming and please find the below access_log statements.172.17.0.1 - - [02/Jan/2020:20:53:14 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:20 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:20 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:24 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:24 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:29 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    172.17.0.1 - - [02/Jan/2020:20:53:29 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozil

Httpd configuration :

<VirtualHost *:8089>
ServerName localhost
DocumentRoot /var/www/html

RewriteEngine on
RewriteRule ^/(.*)\.html$ /content/we-retail/$1.html [PT]
<Directory />
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>

 

Dispatcher.any configuration 

 

 

/rend01
{
# Hostname or IP of the render
/hostname "localhost"

# Port of the render
/port "4503"

# Connect timeout in milliseconds, 0 to wait indefinitely
/timeout "0"

# always resolve hostname
#/always-resolve "${RENDERER_RESOLVE}"

# specifies the time in milliseconds that a response is allowed to take. The default is "600000", causing Dispatcher to wait for 10 Minutes. A setting of "0" eliminates the timeout completely.
# If the timeout is reached while parsing response headers, an HTTP Status of 504 (Bad Gateway) is returned. If the timeout is reached while the response body is read, the Dispatcher will return the incomplete response to the client but delete any cache file that might have been written.
/receiveTimeout "600000"

#Specifies whether Dispatcher uses the getaddrinfo function (for IPv6) or the gethostbyname function (for IPv4) for obtaining the IP address of the render.
/ipv4 "0"

}

 

Virtualhost:

# Entries will be compared against the "Host" request header
# and an optional request URL prefix.
#
# Examples:
#
# www.company.com
# intranet.*
# myhost:8888/mysite

"*"

arpitv27529355

02-01-2020

Hi @arunaaems506124 

 

Can you check and update below things:

 

  • Can you ensure your docker container is running successfully and active.
  • Can you please confirm how you're accessing the dispatcher server, have you done the port mapping to access the server to your local machine from docker container?
  • What exactly web server is displaying when you are trying to access?

 

Regards,

Arpit Varshney

Thanks for the reply. Please find below info on your queries. Can you ensure your docker container is running successfully and active. Yes Docker container is running. I can see the below messages. $ docker info Client: Debug Mode: false Server: Containers: 28 Running: 4 Can you please confirm how you're accessing the dispatcher server, have you done the port mapping to access the server to your local machine from docker container? I am trying to access dispatcher :http://localhost:8089/content/we-retail.html since i exposed port 8089 while creating docker container. What exactly web server is displaying when you are trying to access? I can see request are coming and please find the below access_log statements.172.17.0.1 - - [02/Jan/2020:20:53:14 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:20 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:20 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:24 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:24 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:29 +0000] "GET / HTTP/1.1" 302 228 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" 172.17.0.1 - - [02/Jan/2020:20:53:29 +0000] "GET /content/we-retail.html HTTP/1.1" 404 220 "-" "Mozil Httpd configuration : <VirtualHost *:8089> ServerName localhost DocumentRoot /var/www/html RewriteEngine on RewriteRule ^/(.*)\.html$ /content/we-retail/$1.html [PT] <Directory /> <IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On </IfModule> Options FollowSymLinks AllowOverride None </Directory> </VirtualHost> Dispatcher.any configuration /rend01 { # Hostname or IP of the render /hostname "localhost" # Port of the render /port "4503" # Connect timeout in milliseconds, 0 to wait indefinitely /timeout "0" # always resolve hostname #/always-resolve "${RENDERER_RESOLVE}" # specifies the time in milliseconds that a response is allowed to take. The default is "600000", causing Dispatcher to wait for 10 Minutes. A setting of "0" eliminates the timeout completely. # If the timeout is reached while parsing response headers, an HTTP Status of 504 (Bad Gateway) is returned. If the timeout is reached while the response body is read, the Dispatcher will return the incomplete response to the client but delete any cache file that might have been written. /receiveTimeout "600000" #Specifies whether Dispatcher uses the getaddrinfo function (for IPv6) or the gethostbyname function (for IPv4) for obtaining the IP address of the render. /ipv4 "0" } Virtualhost: # Entries will be compared against the "Host" request header # and an optional request URL prefix. # # Examples: # # www.company.com # intranet.* # myhost:8888/mysite "*"