Drupal 10: un framework PHP di sviluppo Cloud Native moderno

Drupal 10:
un framework PHP
di sviluppo
Cloud Native moderno
28/09/2022 - Drupal@127.0.0.1
Marco Primitivo
Drupal / PHP developer @ SparkFabrik
Drupal.org: https://www.drupal.org/u/bladedu
Twitter: https://www.twitter.com/BladeduMP
LinkedIn: https://www.linkedin.com/in/marcoprimitivo
Cosa vedremo
NOVITÀ
●Symfony
●PHP 8
●Drupal e symfony
I PRINCIPI MACH
●Definizioni
●Drupal e microservizi
●Le iniziative Api-first
●JSON:API ecosystem
●12factor app
CONCLUSIONI
Drupal 10: le novità
- Symfony 6 e PHP 8.1
- CKEditor 5
- Olivero tema Front-end di default
- Claro tema amministrativo di default
- Core più snello
- Decoupled Menus (previsto dalla 10.1)
- Nessun supporto per IE11 🎉
- Conversione di alcuni componenti jQuery con Javascript più moderno
Symfony 6
Drupal 10 userà la nuova release 6.2 per un miglior supporto sul lungo termine
PHP 8.1 (8.2 ready)
Alcune nuove features introdotte a partire dalla versione 8.0:
- JIT
- Null safe operator
- Attributes
- Union and intersection types
- Match expression
- Named arguments
- Enums
- Fibers
Drupal e Symfony
Drupal e Symfony
Punti di contatto
- Console
- Dependency-injection
- Event-dispatcher
- Filesystem
- Http-foundation
- Http-kernel
- Routing
- Serializer
- Validator
- yaml
Drupal e Symfony
Drupal è sia un CMS sia un CMF
Drupal e Symfony
It’s really the Drupal community and not so much the
software that makes the Drupal project what it is. So
fostering the Drupal community is actually more important
than just managing the code base. Dries Buytaert
I principi del
MACH alliance
● Microservices
● API-First
● Cloud-native
● Headless
"Future proof enterprise technology
and propel current and future digital
experiences"
Microservices
Ma dunque Drupal 10 è architettato a microservizi?
Non nel senso stretto
Wikipedia
Microservizi
Martin Fowler
While there is no precise definition of
“Microservice Architecture”, there are
certain common characteristics
around organization around business
capability, automated deployment,
intelligence in the endpoints, and
decentralized control of languages
and data.
Non c’è una singola definizione di
microservizi.
I servizi in un’architettura a
microservizi sono spesso processi
che comunicano su un network per
raggiungere un obiettivo usando
protocolli technology-agnostic come
HTTP.
CNCF
Microservices are a modern approach
to application development that
takes advantage of cloud native
technologies
Tutto dipende dal sistema di riferimento da cui osservi le cose
Drupal As A Service (the big picture)
Microservizi
- Può essere rimodulato per specifiche funzioni di business
- Permette una governance decentralizzata
- Permette un data management decentralizzato
- Completamente automatizzabile al livello infrastrutturale (CI/CD)
- Comunicazione network con protocolli standard (di solito HTTP)
Drupal al microscopio
Microservizi
- Core estremamente modulare
- Servizi debolmente accoppiati tramite diversi meccanismi (sia Drupal che
Symfony)
- Composer e SemVer per un controllo serrato su dipendenze ed estensioni
- Facilmente estendibile
- Facilmente aggiornabile
- Rilasci di sicurezza frequenti
- Community attiva sia su nuove iniziative che sulla gestione delle issues
Microservizi
Services
Dependency Injection
- Dependency
inversion principle
- Facilita la testabilità
del software
- Overridable
- Decorator pattern
- Service Tags
- Service Providers
- Configurazione
tramite yaml file
(module_name.servi
ces.yaml)
- Sono definiti nel DIC
Plugins
- Discovery by
Annotations
- A runtime
- Estendibili
- KISS principle
- Factory e decorator
design patterns
Event dispatcher
- Observer pattern
- Subscribers definiti
con un tagged
service
Si, Drupal è ancora un monolite, ma un monolite estremamente modulare
API-First
Iniziative
API-first
Api-first initiative
- Creata il 29 Jun 2016
- Arrivata al capolinea
https://www.drupal.org/project/drupal/issues/3170020
- REST (core)
- JSON:API (core)
- GraphQL (contrib)
- OpenAPI (contrib)
Iniziative
API-first
Decoupled menus initiative
- Creata 10 settembre 2020
- https://www.drupal.org/project/decoupled_menus_init
iative
- In pieno sviluppo
- Al momento atteso nel core dalla 10.1
- Già disponibile come contrib module per Drupal 9
https://www.drupal.org/project/decoupled_menus
API-first
What’s coming
- Disaccoppiamento completo tra funzionalità del core e responsabilità delle logiche e dei
dati grazie anche ai seguenti moduli contrib:
- JSON:API Hypermedia support ( https://www.drupal.org/project/jsonapi_hypermedia)
- JSON:API Resources (https://www.drupal.org/project/jsonapi_resources)
- json-schema.org support (https://www.drupal.org/project/jsonapi_schema)
- JSON:API cross-bundles support
(https://www.drupal.org/project/jsonapi_cross_bundles)
- OpenApi per JSON:API (https://www.drupal.org/project/openapi_jsonapi)
- Nuovi scenari di integrazione cross-sites con Entity Share
(https://www.drupal.org/project/entity_share)
API-first
Nel futuro c’è JSON:API
https://jsonapi.org/
API-first
JSON:API
Client SDK
- JavaScript
- Typescript
- iOS
- Ruby
- PHP
- Dart
- Perl
- Java
- Android
- R
- Elm
- .NET
- Python
- Elixir
API-first
JSON:API
Server SDK
- Swift
- PHP
- Node.js
- Ruby
- Python
- Go
- .NET
- Java
- Scala
- Elixir
- Haskell
- Perl
- Vala
- Rust
- Dart
- Crystal
Cloud Native
Cloud Native
12factor.net per un Cloud Native di successo
12 factor app
Cloud Native
Business
● Riduzione dei costi
● Servizi più affidabili
● Migliori performance
● Nessun downtime durante i deploy
12 factor app
Cloud Native
Tech
● Deploy più frequenti e più veloci (anche di venerdì
pomeriggio dopo le 17)
● Scalabilità con poco sforzo
● Nessun bisogno di accedere all’infrastruttura
● Divergenza minima tra ambiente di sviluppo e
produzione
● Onboard di nuovi sviluppatori minimizzato
● Configurazione (anche) in code
● Dependencies management con Composer
● Drush per la linea di comando
● S3fs come filesystem
(https://www.drupal.org/project/s3fs)
● Integrazione con Prometheus
(https://www.drupal.org/project/prometheusio_e
xporter)
Drupal 10 è a
misura dei
DevOps
Cloud Native
● Ddev per il local stack
● DrupalPod
(https://github.com/shaal/DrupalPod)
● MinIO con s3fs module
● Monolog
(https://www.drupal.org/project/monolog)
● WebProfiler
(https://www.drupal.org/project/webprofi
ler)
● Config Manager (core)
● Upgrade paths con drush deploy
Ma anche
per i devs
Cloud Native
Headless
Vantaggi
- Front-end completamente disaccoppiato dal Back-end
- Omnichannel
- Team e tecnologie differenti
- UX/UI su misura
Headless
Alcune soluzioni già disponibili con e per Drupal
- REST (core)
- JSON:API (core)
- GraphQL (contrib)
- Next.js per Drupal (https://next-drupal.org/)
Headless
Headless
JSON:API
REST
Headless
// Create a DrupalClient.
const drupal = new DrupalClient("https://www.sparkfabrik.com",
{
auth: {} // Authentication
fetcher: {} // Custom fetcher
cache: {} // Cache support
serializer: {} // Custom serializer
})
// Fetch an article.
const article = await drupal.getResource(
"node--article",
"907034d4-ab35-4949-84e4-d2b7afed82df"
)
Headless
const article = await drupal.createResource("node--article",
{
attributes: {
title: "Title of Article",
body: {
value: "<p>Content of body field</p>",
format: "full_html",
},
},
})
Drupal 10: un framework PHP di sviluppo Cloud Native moderno
Conclusioni
- Semplicemente OOP e design patterns
- Ampio spazio di manovra su molti fronti
- Up-to-date con le ultime novità sul campo
- Backward compatible (nel limiti del possibile)
- Mai noioso 😄
Conclusioni
Citazioni
Grazie!
WE ARE A TECH COMPANY OF ENGINEERS,
DEVELOPERS AND DESIGNERS WHO WILL
THINK, DESIGN AND BUILD YOUR CUSTOM APPLICATIONS,
MODERNIZE YOUR LEGACY AND TAKE YOU TO THE
CLOUD NATIVE ERA.
SPARKFABRIK
We help italian businesses to bridge
the gap with China thanks to our
Official Partnership with
Alibaba Cloud.
SparkFabrik is Cloud Native
Computing Foundation
Silver Member.
SparkFabrik is Google Cloud Platform
Technology Partner.
SparkFabrik is AWS
Official Partner.
PROUD OF OUR PARTNERSHIPS
1 de 43

Más contenido relacionado

Similar a Drupal 10: un framework PHP di sviluppo Cloud Native moderno

Drupal 7Drupal 7
Drupal 7Alessandro Capra
2.7K vistas35 diapositivas
Rich Internet ApplicationRich Internet Application
Rich Internet ApplicationMarcello Teodori
700 vistas29 diapositivas
Software libero at ENEASoftware libero at ENEA
Software libero at ENEANaLUG
63 vistas36 diapositivas

Similar a Drupal 10: un framework PHP di sviluppo Cloud Native moderno(20)

Más de sparkfabrik(20)

Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
sparkfabrik2.1K vistas
Applicazioni Serverless con AWSApplicazioni Serverless con AWS
Applicazioni Serverless con AWS
sparkfabrik136 vistas

Drupal 10: un framework PHP di sviluppo Cloud Native moderno

  • 1. Drupal 10: un framework PHP di sviluppo Cloud Native moderno 28/09/2022 - Drupal@127.0.0.1
  • 2. Marco Primitivo Drupal / PHP developer @ SparkFabrik Drupal.org: https://www.drupal.org/u/bladedu Twitter: https://www.twitter.com/BladeduMP LinkedIn: https://www.linkedin.com/in/marcoprimitivo
  • 3. Cosa vedremo NOVITÀ ●Symfony ●PHP 8 ●Drupal e symfony I PRINCIPI MACH ●Definizioni ●Drupal e microservizi ●Le iniziative Api-first ●JSON:API ecosystem ●12factor app CONCLUSIONI
  • 4. Drupal 10: le novità - Symfony 6 e PHP 8.1 - CKEditor 5 - Olivero tema Front-end di default - Claro tema amministrativo di default - Core più snello - Decoupled Menus (previsto dalla 10.1) - Nessun supporto per IE11 🎉 - Conversione di alcuni componenti jQuery con Javascript più moderno
  • 5. Symfony 6 Drupal 10 userà la nuova release 6.2 per un miglior supporto sul lungo termine
  • 6. PHP 8.1 (8.2 ready) Alcune nuove features introdotte a partire dalla versione 8.0: - JIT - Null safe operator - Attributes - Union and intersection types - Match expression - Named arguments - Enums - Fibers
  • 7. Drupal e Symfony Drupal e Symfony Punti di contatto - Console - Dependency-injection - Event-dispatcher - Filesystem - Http-foundation - Http-kernel - Routing - Serializer - Validator - yaml
  • 8. Drupal e Symfony Drupal è sia un CMS sia un CMF
  • 9. Drupal e Symfony It’s really the Drupal community and not so much the software that makes the Drupal project what it is. So fostering the Drupal community is actually more important than just managing the code base. Dries Buytaert
  • 10. I principi del MACH alliance ● Microservices ● API-First ● Cloud-native ● Headless "Future proof enterprise technology and propel current and future digital experiences"
  • 12. Ma dunque Drupal 10 è architettato a microservizi?
  • 13. Non nel senso stretto
  • 14. Wikipedia Microservizi Martin Fowler While there is no precise definition of “Microservice Architecture”, there are certain common characteristics around organization around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data. Non c’è una singola definizione di microservizi. I servizi in un’architettura a microservizi sono spesso processi che comunicano su un network per raggiungere un obiettivo usando protocolli technology-agnostic come HTTP. CNCF Microservices are a modern approach to application development that takes advantage of cloud native technologies
  • 15. Tutto dipende dal sistema di riferimento da cui osservi le cose
  • 16. Drupal As A Service (the big picture) Microservizi - Può essere rimodulato per specifiche funzioni di business - Permette una governance decentralizzata - Permette un data management decentralizzato - Completamente automatizzabile al livello infrastrutturale (CI/CD) - Comunicazione network con protocolli standard (di solito HTTP)
  • 17. Drupal al microscopio Microservizi - Core estremamente modulare - Servizi debolmente accoppiati tramite diversi meccanismi (sia Drupal che Symfony) - Composer e SemVer per un controllo serrato su dipendenze ed estensioni - Facilmente estendibile - Facilmente aggiornabile - Rilasci di sicurezza frequenti - Community attiva sia su nuove iniziative che sulla gestione delle issues
  • 18. Microservizi Services Dependency Injection - Dependency inversion principle - Facilita la testabilità del software - Overridable - Decorator pattern - Service Tags - Service Providers - Configurazione tramite yaml file (module_name.servi ces.yaml) - Sono definiti nel DIC Plugins - Discovery by Annotations - A runtime - Estendibili - KISS principle - Factory e decorator design patterns Event dispatcher - Observer pattern - Subscribers definiti con un tagged service
  • 19. Si, Drupal è ancora un monolite, ma un monolite estremamente modulare
  • 21. Iniziative API-first Api-first initiative - Creata il 29 Jun 2016 - Arrivata al capolinea https://www.drupal.org/project/drupal/issues/3170020 - REST (core) - JSON:API (core) - GraphQL (contrib) - OpenAPI (contrib)
  • 22. Iniziative API-first Decoupled menus initiative - Creata 10 settembre 2020 - https://www.drupal.org/project/decoupled_menus_init iative - In pieno sviluppo - Al momento atteso nel core dalla 10.1 - Già disponibile come contrib module per Drupal 9 https://www.drupal.org/project/decoupled_menus
  • 23. API-first What’s coming - Disaccoppiamento completo tra funzionalità del core e responsabilità delle logiche e dei dati grazie anche ai seguenti moduli contrib: - JSON:API Hypermedia support ( https://www.drupal.org/project/jsonapi_hypermedia) - JSON:API Resources (https://www.drupal.org/project/jsonapi_resources) - json-schema.org support (https://www.drupal.org/project/jsonapi_schema) - JSON:API cross-bundles support (https://www.drupal.org/project/jsonapi_cross_bundles) - OpenApi per JSON:API (https://www.drupal.org/project/openapi_jsonapi) - Nuovi scenari di integrazione cross-sites con Entity Share (https://www.drupal.org/project/entity_share)
  • 24. API-first Nel futuro c’è JSON:API https://jsonapi.org/
  • 25. API-first JSON:API Client SDK - JavaScript - Typescript - iOS - Ruby - PHP - Dart - Perl - Java - Android - R - Elm - .NET - Python - Elixir
  • 26. API-first JSON:API Server SDK - Swift - PHP - Node.js - Ruby - Python - Go - .NET - Java - Scala - Elixir - Haskell - Perl - Vala - Rust - Dart - Crystal
  • 28. Cloud Native 12factor.net per un Cloud Native di successo
  • 29. 12 factor app Cloud Native Business ● Riduzione dei costi ● Servizi più affidabili ● Migliori performance ● Nessun downtime durante i deploy
  • 30. 12 factor app Cloud Native Tech ● Deploy più frequenti e più veloci (anche di venerdì pomeriggio dopo le 17) ● Scalabilità con poco sforzo ● Nessun bisogno di accedere all’infrastruttura ● Divergenza minima tra ambiente di sviluppo e produzione ● Onboard di nuovi sviluppatori minimizzato
  • 31. ● Configurazione (anche) in code ● Dependencies management con Composer ● Drush per la linea di comando ● S3fs come filesystem (https://www.drupal.org/project/s3fs) ● Integrazione con Prometheus (https://www.drupal.org/project/prometheusio_e xporter) Drupal 10 è a misura dei DevOps Cloud Native
  • 32. ● Ddev per il local stack ● DrupalPod (https://github.com/shaal/DrupalPod) ● MinIO con s3fs module ● Monolog (https://www.drupal.org/project/monolog) ● WebProfiler (https://www.drupal.org/project/webprofi ler) ● Config Manager (core) ● Upgrade paths con drush deploy Ma anche per i devs Cloud Native
  • 34. Vantaggi - Front-end completamente disaccoppiato dal Back-end - Omnichannel - Team e tecnologie differenti - UX/UI su misura Headless
  • 35. Alcune soluzioni già disponibili con e per Drupal - REST (core) - JSON:API (core) - GraphQL (contrib) - Next.js per Drupal (https://next-drupal.org/) Headless
  • 37. Headless // Create a DrupalClient. const drupal = new DrupalClient("https://www.sparkfabrik.com", { auth: {} // Authentication fetcher: {} // Custom fetcher cache: {} // Cache support serializer: {} // Custom serializer }) // Fetch an article. const article = await drupal.getResource( "node--article", "907034d4-ab35-4949-84e4-d2b7afed82df" )
  • 38. Headless const article = await drupal.createResource("node--article", { attributes: { title: "Title of Article", body: { value: "<p>Content of body field</p>", format: "full_html", }, }, })
  • 39. Drupal 10: un framework PHP di sviluppo Cloud Native moderno Conclusioni - Semplicemente OOP e design patterns - Ampio spazio di manovra su molti fronti - Up-to-date con le ultime novità sul campo - Backward compatible (nel limiti del possibile) - Mai noioso 😄
  • 42. WE ARE A TECH COMPANY OF ENGINEERS, DEVELOPERS AND DESIGNERS WHO WILL THINK, DESIGN AND BUILD YOUR CUSTOM APPLICATIONS, MODERNIZE YOUR LEGACY AND TAKE YOU TO THE CLOUD NATIVE ERA. SPARKFABRIK
  • 43. We help italian businesses to bridge the gap with China thanks to our Official Partnership with Alibaba Cloud. SparkFabrik is Cloud Native Computing Foundation Silver Member. SparkFabrik is Google Cloud Platform Technology Partner. SparkFabrik is AWS Official Partner. PROUD OF OUR PARTNERSHIPS