SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Using Magnolia in a Microservices Architecture
Presented by Nicolas Barbé
Broadcast on 2015-09-10
Nicolas Barbé
Software engineer and
technology enthusiast
working for Magnolia
MICROSERVICES
“Loosely coupled
service oriented architecture
with bounded contexts”
Adrian Cockcroft
Your organisation can scale
WHY DOES IT MATTER?
NOT A FREE LUNCH
Distributed systems are complex
๏ Testability
๏ Eventual consistency
๏ Operational complexity
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
COMMON PATTERNS
REQUEST - RESPONSE
request
response
BLOCKED
one to one and synchronous
client server
This is a service
PUBLISH - SUBSCRIBE
publish
one to many and asynchronous
subscribetopic
producer
consumers
FACADE
C
Facade B
A
A facade provides an uniformed API
abstracting several underlying services
Request
PROXY
C
proxy B
A
A proxy delegates a request to one of the
underlying services
Request
CRUD
Create / Read / Update / Delete
Straightforward mapping to DB operators but
does not perform well with task based UI
CQRS
Different models for queries and commands
Commands Queries
ROLE OF MAGNOLIA
๏ Editorial Content - Magnolia
๏ Dynamic or User Generated Content
๏ Content & Business Logic - Microservices
๏ Frontend - Magnolia
๏ Backend - Magnolia
MAGNOLIA ASK
A proof of concept of a Q&A website like stack-overflow
WHICH SERVICES?
References must be checked
- Question / Answer
- Question / User
- Answer / User
- Rating / Answer
- Rating / Question
Users have only one vote
Answers are single threaded
USERS
QUESTIONS ANSWERS
RATINGS
ARCHITECTURE
USERS-COMMANDS
users
RATINGS-COMMANDS
ANSWERS-COMMANDS
QUESTIONS-COMMANDS
USERS-QUERIES
votes
questions
answers
QUESTIONS-QUERIES
ANSWERS-QUERIES
pub
pub
pub
pub
sub
sub
sub
sub
sub
sub
sub
sub
sub
req/res
req/res
sub
Magnolia
req/res
req/res
req/res
ANATOMY OF A MICROSERVICE
Commands Queries
QUESTIONS
‣ AskQuestion
‣ CloseQuestion
{
title: Eget lacinia odio sem nec
elit?
description: Cum sociis natoque
penatibus et magnis dis
parturient ontes, nascetur
ridiculus mus.
initiator: nbarbe
createdAt: 2015-08-14T14:45:43

closed: false
}
‣ ListQuestions
‣ ShowQuestion
{
title: Eget lacinia odio sem nec
elit?
description: Cum sociis natoque
penatibus et magnis dis
parturient ontes, nascetur
ridiculus mus.
initiator: Nicolas Barbé
createdAt: 2015-08-14T14:45:43
closed: false
votes: 12
answers: 3
answersBucketId: fh34t738
}
DEEP DIVE IN THE IMPLEMENTATION
CONTAINERS
Additional layer of abstraction and
automation of an OS
CONTAINERS OR VM?
Actually both !
Virtual machine for the hosts
Containers for the microservices
CONTAINER = MICROSERVICE
๏ Clear Boundaries
๏ Reproducible Builds
๏ Network Plumbing
๏ From Dev to Prod to
Dev
๏ Uniform Operations
- Packaging
- Distribution
- Deployment / Upgrade
- Backup / Restore
- Monitoring
- Logging
- Snaphots
DOCKERIZE MAGNOLIA
$ echo 
'FROM nicolasbarbe/magnolia-base
MAINTAINER Nicolas Barbé "https://github.com/nicolasbarbe"
RUN wget -nv http://sourceforge.net/projects/magnolia/files/
magnolia/Magnolia%20CE%205.4.2/magnolia-bundled-
webapp-5.4.2.war/download?use_mirror=autoselect -O
$CATALINA_BASE/webapps/ROOT.war' > Dockerfile
$ docker build -t magnolia .
$ docker run -p 3000:8080 magnolia
TIPS & TRICKS
๏ Follows the recommendations of
the Filesystem Hierarchy Standard
๏ Configuration through
environment variables
- INSTANCE_TYPE
- DB_TYPE
- DB_SCHEMA
- DB_USERNAME
- DB_PASSWORD
- DEVELOP_MODE
- CLUSTER_ID
๏ Tomcat & JVM settings can be
customised
COPY setenv.sh $CATALINA_BASE/bin/setenv.sh
๏ Map a volume from the host to the
container to persist the JCR
repository
-v /var/lib/magnolia/repositories:/var/lib/
magnolia/repositories
๏ Map a volume from the host to the
container for the resources
-v $MAGNOLIA_WEB_RESOURCES:/var/opt/magnolia
MORE INFORMATION
http://nicolasbarbe.com/2015/01/02/a-docker-image-for-magnolia/
FROM DEV …
Build a clone of the production environment locally with Docker Compose
db-author:
image: postgres
environment:
- POSTGRES_USER=magnolia
- POSTGRES_PASSWORD=mysecretpassword
author:
image: nicolasbarbe/ms-frontend:1.0-SNAPSHOT
command: run
ports:
- "3000:8080"
links:
- db-author:db
environment:
- INSTANCE_TYPE=author
- DB_TYPE=postgresql
- DB_ADDRESS=db
- DB_PORT=5432
- DB_SCHEMA=magnolia
- DB_USERNAME=magnolia
- DB_PASSWORD=mysecretpassword
Create a new container for
the database
Create a network link between
the database and magnolia
Create another container for Magnolia
Configure the instance as an author
and to use the postgresql driver
Thanks to the link, we don’t have to specify the
database IP address
… TO PROD
๏ Use a full Docker stack
- Reuse the same Docker Compose definition
- If the architectures are slightly different use extends keyword
- Use Docker Swarm to deploy on multiple hosts
- Use Docker Machine to provision the hosts
๏ But, wait, Docker Compose/Swarm are still in Beta
- Use Kubernetes if you want a cluster with dynamic provisioning and hosts allocation
- Use Ansible if you want static hosts provisioning and allocation (see my blog post*)
๏ In all cases use the same Docker Images !
* http://nicolasbarbe.com/2015/07/13/magnolia-devops-automate-deployment/
SERVICE DISCOVERY
Build a Service Registry to let Magnolia discovers the services automatically
The Service Registry
- Defines microservices in a YAML file
- Discovers the services through
environment variables, Java system
properties, from the JCR or by value
- Injects services in the templates
- Provides a generic connector to
build dedicated content apps in
YAML
services:
questions:
connection:
host: QUESTIONS_QUERIES_HOST
port: QUESTIONS_QUERIES_PORT
type: env
apiVersion: v1
resource:
name: question
properties:
- name: id
type: Integer
- name: title
type: String
- name: description
https://github.com/nicolasbarbe/magnolia-http-utils
DISPLAYING CONTENT
[#assign id=ctx.getParameter("id")]
[#assign question=httpfn.service("question").GET(id)]
<div class="row">
<h2>${question.title}</h2>
<h4>${question.initiator}</h4>
<p class="lead">
${question.description}
</p>
<div class="pull-right">Asked ${question.createdAt?datetime?date}</div>
</div>
MANAGING CONTENT
Presenters uses
Query side
Actions connect to the
Command side
HTTPS://GITHUB.COM/NICOLASBARBE/MAGNOLIA-ASK
QUESTIONS?

Weitere ähnliche Inhalte

Was ist angesagt?

オープンソースで始める「超」VPN 構築術
オープンソースで始める「超」VPN 構築術オープンソースで始める「超」VPN 構築術
オープンソースで始める「超」VPN 構築術
Masahiko Hashimoto
 

Was ist angesagt? (20)

Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Azure Data Engineering.pptx
Azure Data Engineering.pptxAzure Data Engineering.pptx
Azure Data Engineering.pptx
 
Cloud computing ppt
Cloud computing pptCloud computing ppt
Cloud computing ppt
 
Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用
Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用
Cluster API によるKubernetes環境のライフサイクル管理とマルチクラウド環境での適用
 
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)
 
What is Cloud Native Explained?
What is Cloud Native Explained?What is Cloud Native Explained?
What is Cloud Native Explained?
 
Vagrant
Vagrant Vagrant
Vagrant
 
オープンソースで始める「超」VPN 構築術
オープンソースで始める「超」VPN 構築術オープンソースで始める「超」VPN 構築術
オープンソースで始める「超」VPN 構築術
 
Introduction of Cloud computing
Introduction of Cloud computingIntroduction of Cloud computing
Introduction of Cloud computing
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Advanced Concepts of Cloud Computing
Advanced Concepts of Cloud ComputingAdvanced Concepts of Cloud Computing
Advanced Concepts of Cloud Computing
 
Internet of things
Internet of thingsInternet of things
Internet of things
 
ソフトウェアでのパケット処理あれこれ〜何故我々はロードバランサを自作するに至ったのか〜
ソフトウェアでのパケット処理あれこれ〜何故我々はロードバランサを自作するに至ったのか〜ソフトウェアでのパケット処理あれこれ〜何故我々はロードバランサを自作するに至ったのか〜
ソフトウェアでのパケット処理あれこれ〜何故我々はロードバランサを自作するに至ったのか〜
 
The future of IOT
The future of IOTThe future of IOT
The future of IOT
 
Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)
 
DotNet Fundamentals
DotNet FundamentalsDotNet Fundamentals
DotNet Fundamentals
 
足を地に着け落ち着いて考える
足を地に着け落ち着いて考える足を地に着け落ち着いて考える
足を地に着け落ち着いて考える
 
IoT internet of things
IoT  internet of thingsIoT  internet of things
IoT internet of things
 
Kubernetes Disaster Recovery - Los Angeles K8s meetup Dec 10 2019
Kubernetes Disaster Recovery - Los Angeles K8s meetup Dec 10 2019Kubernetes Disaster Recovery - Los Angeles K8s meetup Dec 10 2019
Kubernetes Disaster Recovery - Los Angeles K8s meetup Dec 10 2019
 
Security for iot and cloud aug 25b 2017
Security for iot and cloud aug 25b 2017Security for iot and cloud aug 25b 2017
Security for iot and cloud aug 25b 2017
 

Andere mochten auch

Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015
Tobias Mattsson
 

Andere mochten auch (10)

Magnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitectureMagnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - Architecture
 
Magnolia Conference 2015 - Pascal Mangold's keynote
Magnolia Conference 2015 - Pascal Mangold's keynoteMagnolia Conference 2015 - Pascal Mangold's keynote
Magnolia Conference 2015 - Pascal Mangold's keynote
 
Customer Engagement in the Digital Era
Customer Engagement in the Digital EraCustomer Engagement in the Digital Era
Customer Engagement in the Digital Era
 
Get the Maximum Out of Your Magnolia Workflow
Get the Maximum Out of Your Magnolia WorkflowGet the Maximum Out of Your Magnolia Workflow
Get the Maximum Out of Your Magnolia Workflow
 
Developing Magnolia based sites correctly, quickly and efficiently
Developing Magnolia based sites correctly, quickly and efficientlyDeveloping Magnolia based sites correctly, quickly and efficiently
Developing Magnolia based sites correctly, quickly and efficiently
 
Product keynote - introducing Magnolia 5.4
Product keynote - introducing Magnolia 5.4Product keynote - introducing Magnolia 5.4
Product keynote - introducing Magnolia 5.4
 
Spring and Web Content Management
Spring and Web Content ManagementSpring and Web Content Management
Spring and Web Content Management
 
Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015
 
Integrating e-Commerce into your Customer Experience
Integrating e-Commerce into your Customer ExperienceIntegrating e-Commerce into your Customer Experience
Integrating e-Commerce into your Customer Experience
 
The Age of the IOT & Digital Business
The Age of the IOT & Digital BusinessThe Age of the IOT & Digital Business
The Age of the IOT & Digital Business
 

Ähnlich wie Using Magnolia in a Microservices Architecture

TransitioningToMicroServonDocker_MS
TransitioningToMicroServonDocker_MSTransitioningToMicroServonDocker_MS
TransitioningToMicroServonDocker_MS
Lana Kalashnyk
 

Ähnlich wie Using Magnolia in a Microservices Architecture (20)

CA Performance Manager Agility by using Docker Containers for Network Manag...
CA Performance Manager Agility by using Docker Containers for Network Manag...CA Performance Manager Agility by using Docker Containers for Network Manag...
CA Performance Manager Agility by using Docker Containers for Network Manag...
 
DCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application Packages
 
Why Kubernetes? Cloud Native and Developer Experience at Zalando - Enterprise...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - Enterprise...Why Kubernetes? Cloud Native and Developer Experience at Zalando - Enterprise...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - Enterprise...
 
Effective Kubernetes - Is Kubernetes the new Linux? Is the new Application Se...
Effective Kubernetes - Is Kubernetes the new Linux? Is the new Application Se...Effective Kubernetes - Is Kubernetes the new Linux? Is the new Application Se...
Effective Kubernetes - Is Kubernetes the new Linux? Is the new Application Se...
 
Running Magnolia on Jelastic Cloud Hosting
Running Magnolia on Jelastic Cloud HostingRunning Magnolia on Jelastic Cloud Hosting
Running Magnolia on Jelastic Cloud Hosting
 
Magnolia CMS on Jelastic
Magnolia CMS on JelasticMagnolia CMS on Jelastic
Magnolia CMS on Jelastic
 
Magnolia CMS - on Jelastic
Magnolia CMS - on JelasticMagnolia CMS - on Jelastic
Magnolia CMS - on Jelastic
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-IT
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPS
 
The path to a serverless-native era with Kubernetes
The path to a serverless-native era with KubernetesThe path to a serverless-native era with Kubernetes
The path to a serverless-native era with Kubernetes
 
Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015
 
Velocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ NetflixVelocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ Netflix
 
High available BizTalk infrastructure on Azure IaaS
High available BizTalk infrastructure on Azure IaaSHigh available BizTalk infrastructure on Azure IaaS
High available BizTalk infrastructure on Azure IaaS
 
TransitioningToMicroServonDocker_MS
TransitioningToMicroServonDocker_MSTransitioningToMicroServonDocker_MS
TransitioningToMicroServonDocker_MS
 
Automating the VMware Virtual Datacenter
Automating the VMware Virtual DatacenterAutomating the VMware Virtual Datacenter
Automating the VMware Virtual Datacenter
 
[Confoo Montreal 2020] Build Your Own Serverless with Knative - Alex Gervais
[Confoo Montreal 2020] Build Your Own Serverless with Knative - Alex Gervais[Confoo Montreal 2020] Build Your Own Serverless with Knative - Alex Gervais
[Confoo Montreal 2020] Build Your Own Serverless with Knative - Alex Gervais
 
Prod-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized Applications
 
How to Train Your Docker Cloud
How to Train Your Docker CloudHow to Train Your Docker Cloud
How to Train Your Docker Cloud
 
Deep-dive into APIs in a Microservice Architecture
Deep-dive into APIs in a Microservice ArchitectureDeep-dive into APIs in a Microservice Architecture
Deep-dive into APIs in a Microservice Architecture
 
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech TalkCloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
 

Mehr von Magnolia

Mehr von Magnolia (20)

The SEO Workflow
The SEO WorkflowThe SEO Workflow
The SEO Workflow
 
Magnolia 6 release walkthrough
Magnolia 6 release walkthroughMagnolia 6 release walkthrough
Magnolia 6 release walkthrough
 
Buzzword bingo: The real deal behind omnichannel, personalization and headless
Buzzword bingo: The real deal behind  omnichannel, personalization and headlessBuzzword bingo: The real deal behind  omnichannel, personalization and headless
Buzzword bingo: The real deal behind omnichannel, personalization and headless
 
A modern front end development workflow for Magnolia at Atlassian
A modern front end development workflow for Magnolia at AtlassianA modern front end development workflow for Magnolia at Atlassian
A modern front end development workflow for Magnolia at Atlassian
 
Launching Magnolia on demand
Launching Magnolia on demandLaunching Magnolia on demand
Launching Magnolia on demand
 
Front-end developers - build Magnolia sites faster
Front-end developers - build Magnolia sites fasterFront-end developers - build Magnolia sites faster
Front-end developers - build Magnolia sites faster
 
Magnolia and beacons: how do they work best together?
Magnolia and beacons: how do they work best together?Magnolia and beacons: how do they work best together?
Magnolia and beacons: how do they work best together?
 
Magnolia and the IOT
Magnolia and the IOTMagnolia and the IOT
Magnolia and the IOT
 
Internationalization for globalized enterprise websites
Internationalization for globalized enterprise websitesInternationalization for globalized enterprise websites
Internationalization for globalized enterprise websites
 
The new visana website how to fit a square peg into a round hole
The new visana website   how to fit a square peg into a round holeThe new visana website   how to fit a square peg into a round hole
The new visana website how to fit a square peg into a round hole
 
Solving for complex UI designs: a front-end perspective and approach
Solving for complex UI designs: a front-end perspective and approachSolving for complex UI designs: a front-end perspective and approach
Solving for complex UI designs: a front-end perspective and approach
 
Extending Magnolia with our solutions
Extending Magnolia with our solutionsExtending Magnolia with our solutions
Extending Magnolia with our solutions
 
Boost your online e commerce with magnolia
Boost your online e commerce with magnoliaBoost your online e commerce with magnolia
Boost your online e commerce with magnolia
 
The slick YAML based configuration by file in Magnolia 5.4
The slick YAML based configuration by file in Magnolia 5.4The slick YAML based configuration by file in Magnolia 5.4
The slick YAML based configuration by file in Magnolia 5.4
 
Seamless integration with Magnolia's REST API
Seamless integration with Magnolia's REST APISeamless integration with Magnolia's REST API
Seamless integration with Magnolia's REST API
 
Dynamic page caching for Magnolia 5.4
Dynamic page caching for Magnolia 5.4Dynamic page caching for Magnolia 5.4
Dynamic page caching for Magnolia 5.4
 
An integrated, fail safe e-business platform based on open source solutions
An integrated, fail safe e-business platform based on open source solutionsAn integrated, fail safe e-business platform based on open source solutions
An integrated, fail safe e-business platform based on open source solutions
 
Magnolia conference 2015 - Boris Kraft's keynote
Magnolia conference 2015 - Boris Kraft's keynoteMagnolia conference 2015 - Boris Kraft's keynote
Magnolia conference 2015 - Boris Kraft's keynote
 
From business requirements to the development of magnolia cms.com - personali...
From business requirements to the development of magnolia cms.com - personali...From business requirements to the development of magnolia cms.com - personali...
From business requirements to the development of magnolia cms.com - personali...
 
Building on Magnolia's personalization
Building on Magnolia's personalizationBuilding on Magnolia's personalization
Building on Magnolia's personalization
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Using Magnolia in a Microservices Architecture

  • 1. Using Magnolia in a Microservices Architecture Presented by Nicolas Barbé Broadcast on 2015-09-10
  • 2. Nicolas Barbé Software engineer and technology enthusiast working for Magnolia
  • 3. MICROSERVICES “Loosely coupled service oriented architecture with bounded contexts” Adrian Cockcroft
  • 4. Your organisation can scale WHY DOES IT MATTER?
  • 5. NOT A FREE LUNCH Distributed systems are complex ๏ Testability ๏ Eventual consistency ๏ Operational complexity http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
  • 7. REQUEST - RESPONSE request response BLOCKED one to one and synchronous client server This is a service
  • 8. PUBLISH - SUBSCRIBE publish one to many and asynchronous subscribetopic producer consumers
  • 9. FACADE C Facade B A A facade provides an uniformed API abstracting several underlying services Request
  • 10. PROXY C proxy B A A proxy delegates a request to one of the underlying services Request
  • 11. CRUD Create / Read / Update / Delete Straightforward mapping to DB operators but does not perform well with task based UI
  • 12. CQRS Different models for queries and commands Commands Queries
  • 13. ROLE OF MAGNOLIA ๏ Editorial Content - Magnolia ๏ Dynamic or User Generated Content ๏ Content & Business Logic - Microservices ๏ Frontend - Magnolia ๏ Backend - Magnolia
  • 14. MAGNOLIA ASK A proof of concept of a Q&A website like stack-overflow
  • 15. WHICH SERVICES? References must be checked - Question / Answer - Question / User - Answer / User - Rating / Answer - Rating / Question Users have only one vote Answers are single threaded USERS QUESTIONS ANSWERS RATINGS
  • 17. ANATOMY OF A MICROSERVICE Commands Queries QUESTIONS ‣ AskQuestion ‣ CloseQuestion { title: Eget lacinia odio sem nec elit? description: Cum sociis natoque penatibus et magnis dis parturient ontes, nascetur ridiculus mus. initiator: nbarbe createdAt: 2015-08-14T14:45:43
 closed: false } ‣ ListQuestions ‣ ShowQuestion { title: Eget lacinia odio sem nec elit? description: Cum sociis natoque penatibus et magnis dis parturient ontes, nascetur ridiculus mus. initiator: Nicolas Barbé createdAt: 2015-08-14T14:45:43 closed: false votes: 12 answers: 3 answersBucketId: fh34t738 }
  • 18. DEEP DIVE IN THE IMPLEMENTATION
  • 19. CONTAINERS Additional layer of abstraction and automation of an OS
  • 20. CONTAINERS OR VM? Actually both ! Virtual machine for the hosts Containers for the microservices
  • 21. CONTAINER = MICROSERVICE ๏ Clear Boundaries ๏ Reproducible Builds ๏ Network Plumbing ๏ From Dev to Prod to Dev ๏ Uniform Operations - Packaging - Distribution - Deployment / Upgrade - Backup / Restore - Monitoring - Logging - Snaphots
  • 22. DOCKERIZE MAGNOLIA $ echo 'FROM nicolasbarbe/magnolia-base MAINTAINER Nicolas Barbé "https://github.com/nicolasbarbe" RUN wget -nv http://sourceforge.net/projects/magnolia/files/ magnolia/Magnolia%20CE%205.4.2/magnolia-bundled- webapp-5.4.2.war/download?use_mirror=autoselect -O $CATALINA_BASE/webapps/ROOT.war' > Dockerfile $ docker build -t magnolia . $ docker run -p 3000:8080 magnolia
  • 23. TIPS & TRICKS ๏ Follows the recommendations of the Filesystem Hierarchy Standard ๏ Configuration through environment variables - INSTANCE_TYPE - DB_TYPE - DB_SCHEMA - DB_USERNAME - DB_PASSWORD - DEVELOP_MODE - CLUSTER_ID ๏ Tomcat & JVM settings can be customised COPY setenv.sh $CATALINA_BASE/bin/setenv.sh ๏ Map a volume from the host to the container to persist the JCR repository -v /var/lib/magnolia/repositories:/var/lib/ magnolia/repositories ๏ Map a volume from the host to the container for the resources -v $MAGNOLIA_WEB_RESOURCES:/var/opt/magnolia
  • 25. FROM DEV … Build a clone of the production environment locally with Docker Compose db-author: image: postgres environment: - POSTGRES_USER=magnolia - POSTGRES_PASSWORD=mysecretpassword author: image: nicolasbarbe/ms-frontend:1.0-SNAPSHOT command: run ports: - "3000:8080" links: - db-author:db environment: - INSTANCE_TYPE=author - DB_TYPE=postgresql - DB_ADDRESS=db - DB_PORT=5432 - DB_SCHEMA=magnolia - DB_USERNAME=magnolia - DB_PASSWORD=mysecretpassword Create a new container for the database Create a network link between the database and magnolia Create another container for Magnolia Configure the instance as an author and to use the postgresql driver Thanks to the link, we don’t have to specify the database IP address
  • 26. … TO PROD ๏ Use a full Docker stack - Reuse the same Docker Compose definition - If the architectures are slightly different use extends keyword - Use Docker Swarm to deploy on multiple hosts - Use Docker Machine to provision the hosts ๏ But, wait, Docker Compose/Swarm are still in Beta - Use Kubernetes if you want a cluster with dynamic provisioning and hosts allocation - Use Ansible if you want static hosts provisioning and allocation (see my blog post*) ๏ In all cases use the same Docker Images ! * http://nicolasbarbe.com/2015/07/13/magnolia-devops-automate-deployment/
  • 27. SERVICE DISCOVERY Build a Service Registry to let Magnolia discovers the services automatically The Service Registry - Defines microservices in a YAML file - Discovers the services through environment variables, Java system properties, from the JCR or by value - Injects services in the templates - Provides a generic connector to build dedicated content apps in YAML services: questions: connection: host: QUESTIONS_QUERIES_HOST port: QUESTIONS_QUERIES_PORT type: env apiVersion: v1 resource: name: question properties: - name: id type: Integer - name: title type: String - name: description https://github.com/nicolasbarbe/magnolia-http-utils
  • 28. DISPLAYING CONTENT [#assign id=ctx.getParameter("id")] [#assign question=httpfn.service("question").GET(id)] <div class="row"> <h2>${question.title}</h2> <h4>${question.initiator}</h4> <p class="lead"> ${question.description} </p> <div class="pull-right">Asked ${question.createdAt?datetime?date}</div> </div>
  • 29. MANAGING CONTENT Presenters uses Query side Actions connect to the Command side