Demo script for talk at adaptTo() 2018:
https://adapt.to/2018/en/schedule/maven-archetypes-for-aem.html
- Java 8 - with Java Cryptography Extension (JCE) Unlimited Strength *)
- Maven 3.3.9
- AEM 6.4
- AWS
*) Please note: You need to install the Java Cryptography Extension (JCE) Unlimited Strength policy files from Oracle, because Ansible uses 256 bit keys to handle encryption and decryption of the vault files. If you are using Java 8u162 or higher they are already active by default.
Please note:
- These demo steps expect an Ansible control host set up read-to-use in AWS. If you want to set up a control host in your environment follow the steps in the REAMDE file contained in the AEM configuration management project generated in step 3.
- Some URLs point to IP addresses or hostnames that where set up only for the adaptTo() talk. Remove them or replace them with your own URLs.
mvn archetype:generate -DinteractiveMode=false \
-DarchetypeGroupId=io.wcm.maven.archetypes \
-DarchetypeArtifactId=io.wcm.maven.archetypes.aem \
-DarchetypeVersion=2.0.2 \
-DprojectName=adaptToDemo2018 \
-DgroupId=to.adapt \
-DartifactId=to.adapt.demoapp \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=to.adapt.demoapp \
-DpackageGroupName=adaptTo \
-DoptionAemVersion=6.4 \
-DoptionAemServicePack=n \
-DoptionSlingModelsLatest=n \
-DoptionSlingInitialContentBundle=n \
-DoptionEditableTemplates=y \
-DoptionMultiBundleLayout=n \
-DoptionContextAwareConfig=n \
-DoptionWcmioHandler=n \
-DoptionAcsCommons=n \
-DoptionFrontend=y
Build and deploy to local AEM instance using build-deploy.sh
(the first "npm install" will take a while).
Open application on author instance: http://localhost:4502/editor.html/content/adaptToDemo2018/en.html
<distributionManagement>
<repository>
<id>adaptto</id>
<url>http://52.215.173.143:8080/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>adaptto-snapshots</id>
<url>http://52.215.173.143:8080/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
Deploy generated AEM application to Maven repository with npm clean deploy
.
Put the following files in the directory where you excute the archetype command:
license.properties
- AEM license fileid_rsa.pub
- public key that is allowed to connect via SSH to AWS machines
Please note: The Maven Archetype Plugin from Maven Central is missing the required feature ARCHETYPE-536 - until this feature is released use the unofficial version 3.0.2-180806-A536
as shown below. This is available in the "wcm.io Intermediate Release Repository" described in wcm.io Maven Repositories.
mvn org.apache.maven.plugins:maven-archetype-plugin:3.0.2-180806-A536:generate -DinteractiveMode=false \
-DarchetypeGroupId=io.wcm.maven.archetypes \
-DarchetypeArtifactId=io.wcm.maven.archetypes.aem-confmgmt \
-DarchetypeVersion=1.0.2 \
-DconfigurationManagementName=adaptto-demo-2018 \
-DprojectName=adaptToDemo2018 \
-DgroupId=to.adapt \
-DartifactId=to.adapt.demoapp \
-Dversion=1.0.0-SNAPSHOT \
-DawsMachineSize=large \
-DoptionAnsible=y \
-DoptionTerraform=y \
-DoptionVagrant=y \
-DansibleVaultPassword=YOUR_PASSWORD \
-DaemAdminPassword=YOUR_PASSWORD \
-DmavenRepositoryUrl=http://52.215.173.143:8080/repository/adaptto/ \
-DmavenRepositoryUser=adaptto \
-DmavenRepositoryPassword=YOUR_PASSWORD \
-DjavaDownloadBaseUrl=http://52.215.173.143/otn-pub/java
cd terraform/terraform-state
terraform init
terraform plan -out state
terraform apply state
cd ..
terraform init
terraform plan -out infrastructure
terraform apply infrastructure
cd ansible
ansible-playbook playbook-setup-prod.yml
As generated to ansible/files/tmp/hosts_prod
(file to be found on AWS Control Host).
PROD environment URLs:
- Publish 1: http://publish1.website1.com
- Publish 2: http://publish2.website1.com
- Author: https://author.website1.com