Highlighted

Exploring the Sling Feature Model: Part 3 – Custom Aggregates | AEM Community Blog Seeding

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K
kautuk_sahni
Community Manager

28-10-2020

BlogImage.jpg

Exploring the Sling Feature Model: Part 3 – Custom Aggregates by Perficient

Abstract

To illustrate, let’s convert my personal site, danklco.com, which is currently managed via Sling CMS, to the Feature Model.

It’s worth noting that I could keep running my site the way it is, by using a pre-built Sling CMS Runnable Jar, but that my goal is to run my site in Kubernetes for simplicity of upgrades, deployment, and management.

Step 1: Refactor Project Structure
Currently, my personal website code is a single OSGi Bundle which I deploy with Github Actions. To support the Sling Feature Model, I’m going to convert the project into a multi-module project and add a new sub-project for my feature.

The new project structure will look like:
/mysite
/bundle
/feature
/images

Step 2: Generate Features


The custom feature is pretty simple, defining my custom code bundles and configurations. A number of parameters are supplied so they can be changed and I’m not putting secrets in code:

{
"bundles": [
{
"id": "com.danklco:com.danklco.slingcms.plugins.disqus:1.1-SNAPSHOT",
"start-order": "20"
},
{
"id": "com.danklco:com.danklco.slingcms.plugins.twitter:1.0",
"start-order": "20"
},
{
"id": "com.danklco:com.danklco.site.cna.bundle:1.0.0-SNAPSHOT",
"start-order": "20"
}
],
"configurations": {
"org.apache.sling.cms.core.analytics.impl.GeoLocatorImpl": {
"scheduler.expression": "0 0 0 ? * WED",
"licenseKey": "${MAXMIND_LICENSE_KEY}"
},
"org.apache.sling.cms.reference.impl.SearchServiceImpl": {
"searchServiceUsername": "dklco-com-search-user"
},
"org.apache.sling.commons.crypto.internal.FilePasswordProvider~default": {
"names": [
"default"
],
"path": "/opt/slingcms/passwd"
},
"org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar~default": {
"algorithm": "SHA1PRNG"
},
"org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar~default": {
"algorithm": "SHA1PRNG"
},
"org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService~default": {
"algorithm": "PBEWITHHMACSHA512ANDAES_256",
"saltGenerator.target": "",
"securityProviderName": "",
"ivGenerator.target": "",
"securityProvider.target": "",
"keyObtentionIterations": 1000,
"names": [
"default"
],
"stringOutputType": "base64"
},
"org.apache.sling.commons.messaging.mail.internal.SimpleMailService~default": {
"connectionListeners.target": "",
"transportListeners.target": "",
"username": "${SMTP_USERNAME}",
"mail.smtps.from": "${SMTP_USERNAME}",
"messageIdProvider.target": "",
"mail.smtps.host": "${SMTP_HOST}",
"names": [
"default"
],
"password": "${SMTP_ENC_PASSWORD}",
"mail.smtps.port": 465,
"cryptoService.target": "",
"threadpool.name": "default"
},
"org.apache.sling.commons.messaging.mail.internal.SimpleMessageIdProvider~default": {
"host": "danklco.com",
"names": [
"default"
]
}
}
}

Read Full Blog

Exploring the Sling Feature Model: Part 3 – Custom Aggregates

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager