October 1, 2020
Estimated Post Reading Time ~

AEM as a Cloud Service: Dispatcher Setup

Local Dispatcher Setup


The AEM as a Cloud Service SDK includes a validator tool and docker image for simulating it locally.
Dispatcher Tools is comprised of:
  • a baseline set of Apache HTTP Web server and Dispatcher configuration files, located in .../dispatcher-sdk-x.x.x/src
  • a configuration validator CLI tool, located at .../dispatcher-sdk-x.x.x/bin/validator
  • a configuration deployment CLI tool, located at .../dispatcher-sdk-x.x.x/bin/docker_run
  • a Docker image that runs Apache HTTP Web server with the Dispatcher module
Before we start, make sure the AEM SDK setup is completed locally. It's ideal to set up AEM publish environment for your dispatcher to map. Install and start the latest version of Docker (Docker Desktop 2.2.0.5+ / Docker Engine v19.03.9+) on the local development machine.

Download AEM SDK, navigate to your AEM folder (where dispatcher tools are available).

Unpack the Dispatcher Tools into ~/aem-sdk/dispatcher
kishore@kishores-mbp dispatcher % chmod a+x aem-sdk-dispatcher-tools-2.0.22-unix.sh 
kishore@kishores-mbp dispatcher % ./aem-sdk-dispatcher-tools-2.0.22-unix.sh Creating directory dispatcher-sdk-2.0.22 
Verifying archive integrity... 100% All good. 
Uncompressing dispatcher-sdk-2.0.22 100% 
kishore@kishores-mbp dispatcher % ls 
aem-sdk-dispatcher-tools-2.0.22-unix.sh dispatcher-sdk-2.0.22  
aem-sdk-dispatcher-tools-2.0.22-windows.zip

The above command creates a new folder and unpacks dispatcher tools to it. A complete description of the configuration files is available in the unpacked Dispatcher Tools as dispatcher-sdk-x.x.x/docs/Config.html.

Validate Dispatcher Configs:

Before we run the Dispatcher locally, it's advised to validate the configs using Dispatcher Tools's validator CLI tool. Also, it transpires the configurations into a file-set compatible with the Docker container's Apache HTTP Web Server.

./bin/validator full -d ./out ./src

This creates a new "out" folder. Run below command.
./bin/docker_run.sh <deployment-folder> <aem-publish-host>:<aem-publish-port> <dispatcher-port>

The aem-publish-host can be set to host.docker.internal, a special DNS name Docker provides in the container that resolves to the host machine's IP. If he host.docker.internal does not resolve, please see the troubleshooting section below.
./bin/docker_run.sh ./out host.docker.internal:4503 8080

The AEM as a Cloud Service SDK's Publish Service, running locally on port 4503 will be available through Dispatcher at http://localhost:8080.

Access the WNKD site with the dispatcher URL.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.