maven archetypes for aem - adaptto() berlin › content › dam › adaptto › production ›...

36
APACHE SLING & FRIENDS TECH MEETUP 10-12 SEPTEMBER 2018 Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision GmbH

Upload: others

Post on 27-Jun-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

APACHE SLING & FRIENDS TECH MEETUP10-12 SEPTEMBER 2018

Maven Archetypes for AEMTobias Richter, Stefan Seifert; pro!vision GmbH

Page 2: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

About the Speakers

2

▪ AEM Developer▪ Apache Sling PMC▪ CTO of pro!vision GmbH

https://www.pro-vision.de

Stefan SeifertTobias Richter

▪ DevOps Engineer@ pro!vision

Page 3: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Agenda

3

1. About Maven Archetypes for AEM

2. Create project(s)

3. Setup full AEM infrastructure (AWS)

4. Live Demo!

Page 4: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

4

Archetypesfor AEM Projects

Page 5: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

What is a Maven Archetype

5

▪ Maven project templating toolkit▪ Bootstrap new projects with parameters▪ AEM needs complex multi-module projects

Page 6: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Archetypes available

6

▪ Maven Archetype by Adobehttps://github.com/Adobe-Marketing-Cloud/aem-project-archetype

▪ Maven Archetype by wcm.iohttp://wcm.io/tooling/maven/archetypes/aem/

▪ Lazybones templates * by Adobe Consultinghttps://github.com/Adobe-Consulting-Services/lazybones-aem-templates

* This is not a Maven Archetype

Page 7: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Archetype comparison

7

FeatureAdobe AEM Archetype

wcm.io AEM Archetype

AEM Lazybones Templates

AEM version 6.3SP2, 6.4 6.3SP2, 6.4 6.3, 6.4

Feature flags No ✓ Yes ✓ Yes

Templates & Core Component examples ✓ Yes ✓ Yes No

AEM Mocks unit test examples No ✓ Yes No

Editable Templates ✓ Yes ✓ Yes ✓ Yes

FileVault XML Layout ✓ Yes ✓ Yes ✓ Yes

Sling-Initial-Content JSON Layout No ✓ Yes No

Context-Aware Configuration No ✓ Yes No

CONGA-enabled for Deployment No ✓ Yes No

Webpack-based Frontend Build No ✓ Yes No

Integration Test Examples ✓ Yes No No

Page 8: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

How to use wcm.io Archetype

8

▪ Interactive mode

mvn archetype:generate \

-DarchetypeGroupId=io.wcm.maven.archetypes \

-DarchetypeArtifactId=io.wcm.maven.archetypes.aem \

-DarchetypeVersion=2.0.2

Page 9: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Feature Flags

How to use wcm.io Archetype

9

▪ Batch mode(recommended)

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 \

-DaemAuthorPort=4502 \

-DaemPublishPort=4503 \

-DoptionAemVersion=6.4 \

-DoptionAemServicePack=n \

-DoptionSlingModelsLatest=n \

-DoptionSlingInitialContentBundle=n \

-DoptionEditableTemplates=y \

-DoptionMultiBundleLayout=n \

-DoptionContextAwareConfig=n \

-DoptionWcmioHandler=n \

-DoptionAcsCommons=n \

-DoptionFrontend=y

Parameter documentation:http://wcm.io/tooling/maven/archetypes/aem/usage.html

Page 10: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

10

1. Create project2. Build it3. Deploy it

locally4. Publish it

to Maven Repository

Page 11: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

11

AEM infrastructure overview

Page 12: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

What to set up

12

PROD Environment DEV Environment

Publish 1

AEM

Dispatcher

Publish 2

AEM

Dispatcher

Author

AEM

DispatcherAuthor + Publish

AEM

Dispatcher

AEM

Dispatcher

t2.2

xlar

ge

t2.2

xlar

ge

t2.2

xlar

ge

t2.2

xlar

ge

Page 13: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Big picture

13

PROD Environment

DEV Environment

Publish 1

Publish 2

Author

Author+ PublishAnsible Control Host

MavenRepository

GitHubAnsible Galaxy

SSH

Maven Deps

AEM projectAEM binaries

Ansible Roles

Page 14: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

14

Archetype forAEM Config Management & Deployment

Page 15: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

One git repositoryTwo git repositories

15

AEM project

Repository 1

▪ Templates and components▪ Java Code▪ Frontend Code▪ Sample Content▪ CONGA Definition▪ Local deployment

Config Management project

Repository 2

▪ CONGA Environments▪ Configuration per stage▪ Deployment scripts▪ Credentials & keys

(encrypted)

Page 16: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

wcm.io Config Management archetype

16

Featurewcm.io Config Mgmt

Archetype

AEM version 6.3, 6.4

CONGA Environments ✓ Yes

Ansible Playbooks for automated deployment ✓ Yes

Describe and create AWS infrastructure using Terraform ✓ Yes

Remote or local control host with Vagrant ✓ Yes

Setup AEM infrastructure and deployment in AWS ✓ Yes

Sensitive data encrypted using Ansible vault ✓ Yes

No manual deployment/configuration steps!

Page 17: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Feature Flags

How to use wcm.io Config Mgmt Archetype

17

▪ Batch modemvn archetype: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=mypassword \

-DaemAdminPassword=myadminpwd \

-DmavenRepositoryUrl=http://your-maven-repo-url/ \

-DmavenRepositoryUser=user \

-DmavenRepositoryPassword=password

Parameter documentation:http://wcm.io/tooling/maven/archetypes/aem-confmgmt/usage.html

Page 18: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

18

1. Create ConfigManagement project

2. Create AWS machinesvia Terraform

Page 19: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

AWS parameters

19

▪ Archetype provides “small”, “medium”, “large” – mapped to AWS instance types

▪ All machines tagged properly▪ SSH keys▪ Security group

Page 20: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

20

1. Run Ansible Playbook2. Setup AEM and

Dispatcher for PROD3. Deploy everything

Page 21: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

21

CONGA concepts

Page 22: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

CONGA abstracts AEM configuration

22

Config Definition in AEM project

Repository 1

▪ OSGi configs▪ Configs in Content

(e.g. replication agents)▪ Dispatcher config

Templates with placeholders

Environments in Config Mgmt

Repository 2

▪ IP Addresses▪ Number of instances▪ Machine sizing▪ Domain names▪ Credentials

Page 23: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

CONGA building blocks for templates

23

▪ AEM configuration is complex

▪ CONGA provides a set of preconfigured“AEM Definitions”

▪ Best practices ready-to-use

▪ Customizablehttp://devops.wcm.io/conga/definitions/aem/

Page 24: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

24

1. CONGAEnvironment

Page 25: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

25

Ansible roles and playbooks

Page 26: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Ansible playbooks

26

▪ The generated project contains only Playbooks, no roles

▪ All roles are re-usable building blocks published on Ansible Galaxy

▪ Archetype is only a starting point

Page 27: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Ansible roles from wcm.io DevOps

27

https://galaxy.ansible.com/wcm_io_devops

Generic AEM roles

aem_cms

aem_service

aem_security

aem_dispatcher

aem_dispatcher_flush

Generic CONGA roles

conga_facts

conga_files

conga_bundle_files

conga_maven

conga_host_facts

CONGA-AEM roles

conga_aem_cms

conga_aem_packages

conga_aem_smoke_test

conga_aem_dispatcher

conga_aem_dispatcher_flush

conga_aem_dispatcher_smoke_test

usesuses

Page 28: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Adobe AEM binaries

28

▪ AEM binaries not available in any public repo(only “Uber JAR”)

▪ We upload them ourselves in our Company Maven Repository following thewcm.io Artifact Naming Conventions for AEM Binaries

▪ Everything available via Maven: Quickstart JAR, SPs, CFPs, HFs, Dispatcher binaries

Page 29: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

29

1. Ansible Playbooks

Page 30: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

30

About security

Page 31: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Sensitive data in Config Management

31

▪ AEM admin password▪ AEM license.properties file▪ AEM crypto key *▪ Maven repository credentials

* New generated for each Config Management project

Page 32: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

AEM security

32

▪ Automation implements a good part of the AEM security checklist (more planned)

▪ IP restrictions for▪ accessing the machines▪ accessing Dispatcher Flush URLs▪ accessing AEM Admin URLs like /console

Page 33: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Demo

33

1. Deployment finished2. Author content3. Publish it

Page 34: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

34

References

Page 35: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

Related adaptTo() talks

35

▪ adaptTo() 2017: Automate AEM Deployment with Ansible and wcm.io CONGA

▪ adaptTo() 2015: CONGA - Configuration generation for Sling and AEM

▪ adaptTo() 2017: Lightning Talk: Use CONGA to provision your local AEM instance

Page 36: Maven Archetypes for AEM - adaptTo() Berlin › content › dam › adaptto › production › presentations … · Maven Archetypes for AEM Tobias Richter, Stefan Seifert; pro!vision

References

36

▪ wcm.io Maven Toolinghttp://wcm.io/tooling/maven/

▪ wcm.io DevOps CONGAhttp://devops.wcm.io/conga/

▪ wcm.io DevOps CONGA Training Materialshttp://training.wcm.io/conga/

▪ wcm.io DevOps Ansible Automation for AEMhttp://devops.wcm.io/ansible-aem/

▪ Need Help? Use the wcm.io Mailing Listshttp://wcm.io/mailing-lists.html

▪ Demo Script for this talkhttps://github.com/adaptto/2018-maven-archetypes-for-aem