Important Notice

This blog has been moved! Visit the new location at https://medium.com/@arunpatidar26/list/aem-dbc5a3e4df7c.

AEMaaCS - Setup JDK11, Author, Publish and Dispatcher

This tutorial walks through setting up a local development environment for Adobe Experience Manager (AEM) using the AEM as a Cloud Service SDK. Adobe official document Adobe Experience Manager as a Cloud Service Tutorials explain steps in more details.

https://docs.adobe.com/content/help/en/experience-manager-learn/cloud-service/local-development-environment-set-up/overview.html

But Objective of this document to share steps to setup AEM git project, AEM Author, AEM Publish and AEM Dispatcher and covers the

  1. Download latest AEM SDK from Software Distribution
  2. Create Maven Project
  3. Download JAVA 11
  4. File System Organization
  5. Install AEM Jar with JDK 11.
  6. Run AEM with JDK 11.
  7. Setup Replication Agent
  8. Dispatcher
  9. Windows Hyper-V Feature




The Downloaded ZIP contains AEM Jar and Dispatcher files -


Create a maven project using the latest archetype 


mvn -B archetype:generate -D archetypeGroupId=com.adobe.granite.archetypes -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=23 -D aemVersion=cloud -D appTitle="AEM Lab" -D appId="aem-lab" -D groupId="com.community.aemlab" -D frontendModule=none -D includeExamples=n

Examplehttps://github.com/arunpatidar02/aemaacs-aemlab

Update Parent POM to update AEM SDK api version


Download JAVA 11

Download Java 11 from Software Distribution https://experience.adobe.com/#/downloads/content/software-distribution/en/general.html

Extract JAVA 11 at C:\Program Files\Java

Note: You can copy java11 in any other folder as well.


File System Organization

Extract the downloaded aemsdk zip and create the folder structure like below:

~/aem-sdk is a organizational folder containing the various tools provided by the AEM as a Cloud Service SDK

~/aem-sdk/author contain s the AEM Author Service

~/aem-sdk/publish contains the AEM Publish Service

~/aem-sdk/dispatcher contains the Dispatcher Tools

~/git-repo/<AEM maven project> contains the custom AEM Project source code


I have created aem-sdk and git-repo folder at C:\Users\Arun.Patidar\Desktop\AEM\AEMaaCS

Inside aem-sdk create author, publish and dispatcher folder

Inside author and publish folder copy AEM jar from extracted aem-sdk and rename jar file based on author and publish run mode.




Unpack the Dispatcher Tools into ~/aem-sdk/dispatcher

Windows: Unzip aem-sdk-dispatcher-tools-x.x.x-windows.zip into C:\Users\Arun.Patidar\Desktop\AEM\AEMaaCS\aem-sdk\dispatcher


macOS / Linux: Execute the accompanying shell script aem-sdk-dispatcher-tools-x.x.x-unix.sh to unpack the Dispatcher Tools
chmod a+x aem-sdk-dispatcher-tools-x.x.x-unix.sh && ./aem-sdk-dispatcher-tools-x.x.x-unix.sh


Note: out folder will be created when you work on dispatcher. This will be covered later. 


Copy maven project inside the git-repo folder

Install AEM with JDK 11.

You need java 11 to run cloud sdk aem jar, if you already have java 11 set as JAVA_HOME then you just need to double click on the aem jar, it will get installed similar to traditional aem jar. 
But if you don’t have java 11 set as JAVA_HOME and you need have java as default jdk 8 to work with traditionally AEM jar, then you can run aem cloud jar without setting up java 11 as JAVA_HOME by following below steps :

  • Open CMD and go to author folder i.e. C:\Users\Arun.Patidar\Desktop\AEM\AEMaaCS\aem-sdk\author
  • Run C:\Program Files\Java\jdk-11.0.6\bin\java -jar aem-author-p14502.jar

AEM installation will be started and it will take some time to extract jar. Once installation is done. AEM home page will be opened and you will the welcome screen where you need to enter Customer and Licence details, similar to traditional AEM installation.


If you want to start aem using batch file then you need to update start.bat(if you have java 8 as default java and want to use java 11 for cloud sdk).
update start.bat
1. Set java11 path in batch file
2. update all java command with %java_11%
e.g.
Now you can start AEM from CMD
using below command:
C:\Users\Arun.Patidar\Desktop\AEM\AEMaaCS\aem-sdk\author\crxquickstart\
bin>start.bat

You can stop AEM using Ctrl+C



Setup Replication Agent

Setup default replication agent to publish content on local AEM Publisher. You just need to enabled the Agent and update Transport URI and transport User


Dispatcher

To Setup dispatcher in local you need to follow the detail document at https://docs.adobe.com/content/help/en/experience-manager-learn/cloudservice/local-development-environment-set-up/dispatcher-tools.html but I will try to summarize here.

  1. Download Docker Desktop from https://www.docker.com/products/dockerdesktop
  2. Install Docker Desktop (with Hyper -V feature enable in Windows). Caution: When you enabled the Hyper-V feature in windows it will disabled the Wifi and you may no longer to use wifi with Hyper-V feature enable. To use wifi again, you need to disabled Hyper- V feature from windows. 
  3. Open the docker and start if docker is not started. Once Docker is started you will see Docker is running in dashboard.


  1. Once Docker is started. Open the command line and go to dispatcher folder i.e. C:\Users\Arun.Patidar\Desktop\AEM\AEMaaCS\aemsdk\dispatcher and run below command
    1. Windows: bin\validator full -d out src
    2. macOS / Linux: ./bin/validator full -d ./out ./src
This Command will generate the dispatcher configs inside out folder based on src folder. So whenever you have new dispatcher changes you need to delete out folder and generate new configs.

Run Dispatcher locally in the Docker container.

run below command
Windows: bin\docker_run <deployment-folder> <aem-publish-host>:<aem-publish-port> <dispatcher-port>
macOS / Linux: ./bin/docker_run.sh <deployment-folder> <aem-publish-host>:<aem-publish-port> <dispatcher-port>

e.g. host.docker.internal is used for localhost IP, so need to change this, only update AEM port and dispatcher port. example :
bin\docker_run out host.docker.internal:14503 8085


Once the dispatcher is running in docker container(This can be checked from Docker desktop dashboard), you can access the site using localhost:8085/<page_path>

To check caching or server logs use Docker CLI



Windows Hyper-V Feature

Docker creates virtual Ethernet which disabled the Wifi adapter and wifi stops working.
This feature can be turn on and off from Windows Features
When you don’t need to run docker, you can disabled the feature and vEthernet adapter
When vEthernet adapter is disabled you can enable Wi-Fi adapter again.



No comments:

Post a Comment