SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
#PHPTour Nantes 18 mai 2017
Gilles Félix, cofounder & Engineer
gilles@mailclark.ai @felixgilles
My Slack bot speaks PHP
● MailClark est installé dans 6800 teams
● Microsoft Teams depuis une semaine
● Plus de 3.5 millions d’emails reçus
● Plus de 300 000 emails envoyés
● Plus 600 comptes twitter et facebook
Backend PHP (Silex)
Frontend SPA React
● Délégation d’interface
● Focus sur le pont email
We <3 PHP
Travailler en startup
Consumer
Autre
queue
Service
Services asynchrones en cascade
Génération email
Envoi Email
...
Consumer
Autre
queue
Queue
QueueQueue
/ team
ConsumerConsumer
Consumer
/ team
Service
Services asynchrones en cascade
Génération email
Envoi Email
...
Bot2Hook
x Batchs
Clients
WebsocketPilote
Serveur
Websocket
Websocket
Websocket : Devristo/phpws basé sur ReactPHP
7000
teams
Websocket
$loop = ReactEventLoopFactory::create();
$client = new ClientWebSocket($websocket_server_url);
$client->on("connect", function() {
// Avertir le pilote
});
$client->on("message", function($message) use ($rabbitmq){
$rabbitmq->publishString($queue_name, $message->getData());
});
$client->on("close", function() {
// Gérer la reconnexion
});
$client->open()->otherwise(function($e) {
// Gérer l’erreur, éventuellement bot revoked
});
$loop->addPeriodicTimer(60, function() {
// Envoi de stats au pilote
});
$loop->run();
Blinder les filets de sécurités.
● Surveillance des points névralgiques
● Des logs, des logs, des logs
● Différents niveaux d’alertes
● Maximum d’auto-fix
● DM avec chaque client
Compenser par la réactivité
#PHPTour Nantes 18 mai 2017
Gilles Félix, cofounder & Engineer
gilles@mailclark.ai @felixgilles
Merci !
Questions
https://joind.in/talk/56ce0

Contenu connexe

Dernier

Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdf
Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdfActions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdf
Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdfalainfahed961
 
Câblage, installation et paramétrage d’un réseau informatique.pdf
Câblage, installation et paramétrage d’un réseau informatique.pdfCâblage, installation et paramétrage d’un réseau informatique.pdf
Câblage, installation et paramétrage d’un réseau informatique.pdfmia884611
 
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdf
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdfSciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdf
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdfSKennel
 
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...maach1
 
présentation sur la logistique (4).
présentation     sur la  logistique (4).présentation     sur la  logistique (4).
présentation sur la logistique (4).FatimaEzzahra753100
 
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.ppt
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.pptCHAPITRE 2 VARIABLE ALEATOIRE probabilité.ppt
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.pptbentaha1011
 

Dernier (8)

Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdf
Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdfActions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdf
Actions du vent sur les bâtiments selon lEurocode 1 – Partie 1-4.pdf
 
Câblage, installation et paramétrage d’un réseau informatique.pdf
Câblage, installation et paramétrage d’un réseau informatique.pdfCâblage, installation et paramétrage d’un réseau informatique.pdf
Câblage, installation et paramétrage d’un réseau informatique.pdf
 
CAP2ER_GC_Presentation_Outil_20240422.pptx
CAP2ER_GC_Presentation_Outil_20240422.pptxCAP2ER_GC_Presentation_Outil_20240422.pptx
CAP2ER_GC_Presentation_Outil_20240422.pptx
 
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdf
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdfSciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdf
SciencesPo_Aix_InnovationPédagogique_Atelier_APC.pdf
 
Note agro-climatique n°2 - 17 Avril 2024
Note agro-climatique n°2 - 17 Avril 2024Note agro-climatique n°2 - 17 Avril 2024
Note agro-climatique n°2 - 17 Avril 2024
 
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...
Cours-de-Ponts Cours de Ponts Principes généraux - Conception Méthodes de con...
 
présentation sur la logistique (4).
présentation     sur la  logistique (4).présentation     sur la  logistique (4).
présentation sur la logistique (4).
 
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.ppt
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.pptCHAPITRE 2 VARIABLE ALEATOIRE probabilité.ppt
CHAPITRE 2 VARIABLE ALEATOIRE probabilité.ppt
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

My slack bot speaks PHP

Notes de l'éditeur

  1. Bonjour à tous, Merci d’être ici Merci à Vincent pour sa présentation Je m’appelle Gilles Félix Je suis co-fondateur et ingénieur chez MailClark Et je vais donc vous expliquer pourquoi et comment on a créé notre Slack bot, MailClark, en PHP
  2. Bonjour à tous, Merci d’être ici Merci à Vincent pour sa présentation Je m’appelle Gilles Félix Je suis co-fondateur et ingénieur chez MailClark Et je vais donc vous expliquer pourquoi et comment on a créé notre Slack bot, MailClark, en PHP
  3. * Impossible de présenter Slack pour ceux qui connaissent pas * Mais démo de MailClark pour comprendre à quoi sert notre bot * une fois le bot installé dans votre team, vous allez l’inviter dans un channel Introduction slide suivante : Des metrics pour avoir les ordres de grandeur
  4. Introduction slide suivante : Pour résumer MailClark en une image, Mailclark c’est ça
  5. Un énorme rond point avec des entrées sorties que sont Slack, twitter, facebook, l’email Trafic permanent, venant de toute la planête Et le policier au millieu qui doit gérer les accidents, les embouteillages, les travaux sur chacune des voix d’accès Il faut déjà être un peu inconscient pour aller se fourrer là --------- Introduction slide suivant : Pour vous montrer notre niveau d’inconscience
  6. * Slack team dev4slack, communauté des développeurs d’intégrations Slack * Channel #language-php dédié à ceux qui développe pour Slack en PHP * Comparer avec #language-js ou #language-phyton --------- * PHP n’est pas mainstream pour développer des bots --------- Introduction slide suivante : Mais alors, à part l’inconscience, pourquoi avoir choisi PHP ?
  7. Pour 2 raisons Introduction slide suivante : D’abord c’est l’histoire
  8. * screenshot de Clubble.com * Clubble.com webapp lancé fin 2014 avec 3 ex-collègue * Clubble.com = Google group modernisé et plus sexy * Ancienne équipe logiciels d’une web agency, longue histoire avec le PHP donc choix dans la continuité --------- * Ressemblance avec interface Slack
  9. * Ressemblence également remarquée par les investisseurs rencontrés * Slack est LE phénomène. 1 millions d’utilisateurs quotidien en moins d’un an * Une sorte d’énorme paquebot lancé à la vitesse d’un hors bord et dont les vagues générées qui coule tous les concurrents dans son sillage. * Plutôt que de couler avec les autres, on décide d’attraper le paquebot, et se servir de sa traction pour sortir de l’eau. --------- Second affichage : email = backend = PHP =&amp;gt; CQFD
  10. * Pas qu’un choix par défaut * PHP a beaucoup évolué (performant, composer gestion des dépendances, frameworks dont Silex, démonisation possible) * Maîtrise, à l’aise donc efficace --------- Efficacité important pour une startup
  11. * Pour ceux qui ne connaissent pas, travailler dans une startup c’est ça --------- * Flux tendu / Accélération permanente * Changer de cap en quelques minutes * Horizon a 2/3 mois et donc fatalement * Peu de tests automatisés - délégation de traitement à des services tiers --------- Contexte à garder à l’esprit pour la suite, ce que je présente a été construit au fil de l’eau --------- Introduction slide suivante : On est pas passé du jour au lendemain de Clubble.com à MailClark
  12. Clubble.io Intégration Slack basée sur les slash commands (webhooks) Transformation d’une webapp classique en un service beaucoup plus modulaire On sort du schéma requête en entrée, response en sortie. Les deux peuvent être décorélées
  13. Structure de l’application MailClark Un système de Services asynchrones en cascade Mutualisation de brique et meilleur gestion des problèmes RabbitMq : php-amqplib --------- * Cas d’erreurs : service (interne ou externe) ne répond pas ou répond une erreur, * Retries avec délais de plus en plus long * Différents exemples d’événements --------- * Séparation par team pour ne pas pénaliser toutes les teams en cas de raz de marée sur une team * Consumer et queue par team détruient après un temps d’inactivité ---------- Introduction slide suivante : retour à clubble.io
  14. Structure de l’application MailClark Un système de Services asynchrones en cascade Mutualisation de brique et meilleur gestion des problèmes RabbitMq : php-amqplib --------- * Cas d’erreurs : service (interne ou externe) ne répond pas ou répond une erreur, * Retries avec délais de plus en plus long * Différents exemples d’événements --------- * Séparation par team pour ne pas pénaliser toutes les teams en cas de raz de marée sur une team * Consumer et queue par team détruient après un temps d’inactivité ---------- Introduction slide suivante : retour à clubble.io
  15. Après quelques mois de clubble.io, on sent que pour pleinenement décoler il faut qu’on en passe par un bot Qui dit bot, dit Webscoket Changement backend écarté Tests librairies Websocket PHP Introduction slide suivante : Nouvelle poussée d’inconscience, Banco, on crée bot2hook
  16. * Rester dans le schéma services asynchrone en cascade de clubble.io * Avoir quelque chose qui puisse monter en charge
  17. * Supervisor comme commande du container, outil “process supervision“ * Supervisor = gestionnaire de processus, donc plusieurs services dans le container * Websocket avec Devistro/phpws avec ReactPHP --------- * Pourquoi 20 batchs : Si tombe redémarrage automatique (supervisor) et que 300 à 400 teams impactées * Reconnections automatiques et optimisées (Migration Slack) * Batch redemarré mais Pilote tourne non stop --------- Introduction slide suivante : coder de l’asynchrone en PHP
  18. * EventLoop : La boucle d&amp;apos;événement est le noyau de ReactPHP sur laquelle viennent s’appuyer traitements asynchrones, * Définition des callbacks sur les différents événements websocket * Ouverture de connection et gestion d’erreur * Démarrage de la boucle Introduction slide suivante : Pour finir, on est pas totalement inconscient
  19. * Rappel context startup --------- * Points névralgiques : bot2hook, webhook emails * Logs fichiers, Slack , Grafana, par services, consumers, fonctionnel, technique, monétisation, entrée, sortie * Niveaux d’alertes : notifications slack, SMS * Retry des services, B2H * Écoute permanente client en DM
  20. * L’objectif de ces filets de sécurités c’est d’être réactif * Tout le monde fait des erreurs, même des très bon comme nous :-) * problème est d’autant moins gros qu’on le détecte tôt et qu’on agit vite * Aucune perte de données * Mieux vaut un délai plutôt que rien * exemple du collègue dans Slack * exemple de la boite d’envoi du mailer
  21. Qui utilise Slack, MSTeams, MailClark ? RabbitMQ : fonctionnalité des délais, mainstream, test de SQS peu concluant