Introduction

At ShitOps, we are constantly pushing the boundaries of technological innovation to solve common problems in unique ways. Recently, we tackled the challenge of delivering WordPress email notifications with unprecedented reliability, scalability, and modularity. Our team designed an elaborate multi-layered microservices architecture leveraging ROS 2, Apache Kafka, Kubernetes, and Terraform, integrating ROS 2's DDS communications with WordPress's PHP ecosystem in a completely novel way.

In this post, I will walk you through our engineered solution that ensures every email notification from WordPress is processed, tracked, and delivered flawlessly through an intricate web of ROS 2 microservices.

The Problem

WordPress' native email system often suffers from reliability issues, insufficient monitoring, and lack of scalability. At ShitOps, our WordPress instances require a robust solution to:

The Solution Overview

To achieve these goals, we introduced ROS 2 (Robot Operating System 2) into the pipeline, leveraging its DDS (Data Distribution Service) built-in communication middleware for distributed message passing.

Our architecture utilizes:

Architecture Details

The WordPress plugin publishes email requests as JSON messages via a REST endpoint, which a ROS 2-based microservice subscribes to via a DDS message bridge.

This microservice then forwards the email event to Kafka, ensuring durability.

Separate ROS 2 consumer nodes subscribe to the Kafka topic, process the email templates, and pass finalized emails to an SMTP ROS 2 microservice.

Each step is encapsulated as a ROS 2 node to maintain modularity and high observability.

Detailed Flowchart

sequenceDiagram participant WP as WordPress Plugin participant ROSListener as ROS 2 Listener Node participant Kafka as Apache Kafka participant TemplateNode as ROS 2 Template Node participant SMTPNode as ROS 2 SMTP Node participant Monitor as ROS 2 Monitoring Node WP->>ROSListener: Post email JSON ROSListener->>Kafka: Publish email event Kafka->>TemplateNode: Consume email event TemplateNode->>SMTPNode: Send templated email SMTPNode->>Monitor: Deliver status Monitor->>WP: Report delivery metrics

Implementation Details

ROS 2 Listener Node

Written in C++ with the rclcpp library, this node subscribes to a DDS topic that reflects WordPress emails posted via HTTP REST. It translates HTTP JSON requests into ROS 2 messages.

Kafka Integration

We leveraged the rclcpp Apache Kafka bridge to communicate between ROS 2 and Kafka. This setup enables distributed buffering, replay, and fault-tolerance in our email pipeline.

Email Template Node

A Python-based ROS 2 node using Jinja2 templating consumes email events from Kafka and produces customized HTML or plain text emails.

SMTP Node

Implemented in C++ again for performance, this ROS 2 node connects securely to our SMTP server cluster, sends emails, and publishes delivery success or failure events.

Monitoring Node

Using ROS 2's built-in diagnostics framework, the monitoring node consumes email status events and pushes detailed metrics dashboards to WordPress via REST callbacks.

Infrastructure as Code

All Kubernetes clusters, ROS 2 microservices, and Kafka clusters are declared in Terraform modules for consistency, repeatability, and scalability.

Conclusion

Employing ROS 2 as the backbone for WordPress email notifications allowed us to build an email delivery system that is fault-tolerant, scalable, and highly modular. The integration with Kafka and Kubernetes makes the system production-ready for massive scale.

This solution embodies ShitOps' ethos of architecting modern engineering marvels to tackle everyday challenges.

Feel free to reach out for detailed repositories, Terraform scripts, and ROS 2 package documentation in upcoming blog posts.