Friday, October 1, 2021

AEM Dispatcher Setup Using Docker - Windows

 


Dispatcher Setup


The AEM as a Cloud Service SDK includes the recommended Dispatcher Tools version, that facilitates configuring, validating, and simulating Dispatcher 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/validate (Dispatcher SDK 2.0.29+)
  • a configuration generation 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

Prerequisites:

  1. Windows users must use Windows 10 Professional.
  2. Install Experience Manager Publish Quickstart Jar on the local develop machine. Please refer local set-up.
  3. Install and start the latest version of Docker (Docker Desktop 2.2.0.5+ / Docker Engine v19.03.9+) on the local development machine.

Dispatcher Set-Up

 Dispatcher tools comes along with aem-sdk. Extract this zip file.

 

 



 

In the extracted folder, there is aem-sdk-dispacther-tools-x.x.xx-windows.zip. Extract this zip in some folder, you can see below structure.

 

 



src folder contains below folders:

 


Configuration Structure:

 

./

── conf.d

   ── available_vhosts

      └── default.vhost

   ── dispatcher_vhost.conf

   ── enabled_vhosts

      ── README

      └── default.vhost -> ../available_vhosts/default.vhost

   └── rewrites

      ── default_rewrite.rules

      └── rewrite.rules

   └── variables

|       ── custom.vars

       └── global.vars

└── conf.dispatcher.d

    ── available_farms

       └── default.farm

    ── cache

       ── default_invalidate.any

       ── default_rules.any

       └── rules.any

    ── clientheaders

       ── clientheaders.any

       └── default_clientheaders.any

    ── dispatcher.any

    ── enabled_farms

       ── README

       └── default.farm -> ../available_farms/default.farm

    ── filters

       ── default_filters.any

       └── filters.any

    ── renders

       └── default_renders.any

    └── virtualhosts

        ── default_virtualhosts.any

        └── virtualhosts.any

 

 

docs folder:

 


bin folder:

 



The bin subdirectory also contains a docker image and a shell script to execute that will use your deployment information and run an Apache and dispatcher in a docker container. It also contains a validator binary for macOS and Linux.

 

 

Local development and testing

Start publish instance and docker desktop first.

 

Step 1: Validate the Dispatcher configuration contained in this SDK

On Windows, go to dispatcher folder and run below command

> bin\validator full -d out src
 


This validates the configuration and generates deployment information in out.

Out folder is created in folder:

 



Step 2: Validate the deployment information by the Dispatcher in a docker image.

Run below command:

bin\docker_run out host.docker.internal:4503 8080

 

host.docker.internal is pointing to localhost.

 



 

Open any page in publish instance:

index page



Open same url on port 8080 as we started docker on this port 8080.




 


Dispatcher is working and we can access our publish instance pages on dispatcher.

Project Dispatcher’s code testing:

Step-1: Delete out folder from dispatcher’s folder.



Step-2: Now run below command to deploy project’s specific dispatcher configurations:

Let's add one rule in rewrite file.

rewrite.rules

custom.var file



bin\validator full -d out <loctaion>/dispatcher/src

 



out folder is created in the same folder:

 



 

Open any file to check your configurations. Let’s say I opened file “rewrite_rules” and you can see project specific configs are deployed successfully.

 



Step-3: Run below command

bin\docker_run out host.docker.internal:4503 8080

With your AEM publish server running on your system, listening on port 4503, you can start the dispatcher in front of that server as follows:



In rewrite file there is rule

RewriteRule ^/?$ /content/${CONTENT_FOLDER_NAME}/us/en.html [PT,L]

Now open browser and run http://localhost:8080/

dispatcher index page


 


Dispatcher is setup now.

Tuesday, August 3, 2021

AEM local Set up

 

Setting up a local development environment is the very first step when establishing an Adobe Experience Manager or AEM. Below is the prerequisite list to setup AEM on local.


Prerequisites:

Following softwares are required for installation on one’s local environment:

AEM jar file- connect with Adobe to get jar file and license properties. You can get temporary license. If you working in an organization then you can coordinate with organization teams to get jar files.

Java( 8+) for AEM-6.5

java-11 for AEM sdk

Maven- 3.5+


 Java Setup

Ø      Download jdk-11 from official site. You can set up via zip extraction or directly with exe file.




For Java JDK 11- Path variables that need to be set:

  • Create the system or user variables for the following:
  • Open Advance system settings
  • Click Environment Variables

 

Click New in System Variable and add JAVA_HOME to set jdk. Click Ok.



 

Ø      Maven setup

o   Download maven from official site.

o   Extract and set up on your machine. Please follow link to set up on windows:

o   Setting up maven in system variable. Refer above’s screenshot.

Same environment steps for maven.

 Now click path in system variables.

Add below entries for java and maven:

Click New and add below bin path for “Java”

 %JAVA_HOME%\bin

 Click New and add below bin path for “Maven”

 %MAVEN_HOME%\bin

 Click ok and close environment variables.







Ø         AEM Setup

 

o   Copy aem jar file in any folder.

o   Extract the file in a folder.

o   Rename the aem-sdk jar file inside to cq-author-p-4502

    Paste license.properties files in his folder for aem 6.5 or below versions.







o   There is one more dispatcher zip if you are installing aem-sdk. Please ignore at this moment. It would be used for dispatcher setup.




o   Open command prompt here

o   Run below command to create author instance on local machine:

 

 java -jar cq-author-p4502.jar in command prompt.

 

when prompted to enter a password use “admin” as password.



o   Server will be up in 4-5 minutes and the AEM console will open on port 4502.

o   It means author instance is running on 4502 port.

o   Following screen comes up when the server is up:


o   You need to login with the userId/password as admin/admin

and following screen opens and you are good to go! 😊

 


Similarly, setup publish environment by renaming jar file to “cq-publish-p-4503”. It means your publish instance will run on 4503 port.


To start server manually- use below command:


Go to crx-quickstart /bin folder


double click start.bat file for windows

or

run ./start in terminal for mac/linux






ElasticSearch vs Apache SolrCloud

  Elasticsearch and Apache SolrCloud are both powerful, distributed search engines built on top of Apache Lucene. Both Elasticsearch and S...