Containerizing MuleSoft
applications for Hybrid
deployment
Moscow MuleSoft Meetup Group
October 12 2021
2
Introductions
A SHOW OF HANDS:
Who is new to this Meetup?
Artem Fomenko
Leadex Systems Technical Lead
● Our personal experience of using Docker Swarm with
MuleSoft Standalone Runtime
● Technical demonstration of the deployment approach
● Summing-up our experience and further plans on the
proposed solution
● Q&A session
● Trivia game
Agenda
MuleSoft Customer-managed Deployment Options
Hybrid Deployments
https://docs.mulesoft.com/runtime-manager/deployment-strategies
Anypoint Runtime Fabric Deployments
● Isolation – each application is run independently from the others
and and doesn’t affect them in terms of shared platform resources.
● Immutability – applications are baked into Docker images along
with Mule Runtime.
● Self-healing – whenever a node gets crashed, all the deployed
applications within that node are automatically moved to healthy
nodes.
● Zero-downtime rolling updates – a Mule application can be
automatically updated without any service downtime.
● Secrets – secret values are securely stored and injected into
containers at runtime.
Virtues of MuleSoft containerization
MuleSoft Applications within Docker Swarm
● cAdvisor – collects
container-specific metrics directly
from Docker.
● node-exporter – Prometheus
exporter for hardware and OS
metrics exposed by *NIX kernels.
● dockerd-exporter – Docker
daemon metrics collector.
● Prometheus – metrics database.
● Alertmanager – alerts dispatcher
for Prometheus.
● Unsee – Alertmanager dashboard
tool.
● Grafana – web application for
metrics interactive visualization.
● Caddy – reverse proxy and basic
auth provider.
Docker Swarm Cluster Monitoring
All credits to Stefan Prodan’s swarmprom
Organizing CI/CD Pipeline
● All application logs must be redirected to STDOUT and sent
to a log aggregation tool
● OS signals, such as SIGINT and SIGTERM, must be properly
redirected to the Mule Runtime process.
● Memory footprint of Mule runtime must be optimized to
run one application in accordance with the container’s
resource limits.
● Exposing JMX beans can be helpful to monitor Mule
runtime and tune up logging levels.
● Image labels are important to keep useful information
about the Docker image of a container.
Baking a Proper MuleSoft container
● environment configuration is to be externalized into a separate
repository;
● logging events must contain a unique identifier to correlate
them across different services;
● only inter-process communication protocols are to be used
(VM queues are forbidden!);
● health check endpoint is to be provided.
Developing a Proper MuleSoft application
For distributed systems, such as microservices, it is important
not to just properly break down an application into decoupled
and cohesive services, but also put in place additional
mechanisms to handle cross-cutting concerns:
● We will be using an accelerator
provide by MuleSoft as an
application example
● We will be running a one-node
local Docker Swarm cluster to
show how Docker images and
built and Swarm services
deployed
● All applications are to be
registered in Runtime Manager
Technical Live Demonstration
https://anypoint.mulesoft.com/exchange/org.mule.examples/mule
soft-accelerator-for-financial-services/
● Anypoint Runtime Fabric seems like a better choice when it
comes to on-premises microservice-like deployments.
● Getting along Docker Swarm and Anypoint Platform requires
a lot of low-level plumbing.
● It needs to be extra careful about setting up resource limits to
prevent resource starvation for high-throughput services.
● It is always possible to switch to another orchestrator or even
RTF without major changes of applications.
● Docker Swarm is a decent choice when you need to quickly
adopt a microservice approach.
Summing-up
● GitHub repository with the demo application
● Official Mule Runtime in Docker FAQ
● Official Docker Swarm Documentation
● Mule Runtime containerization (article)
● Unofficial Mule Runtime images
● HAProxy on Docker Swarm (official article)
Useful Links and Articles
Thanks for your
attention!
Q&A
Trivia game

Containerizing MuleSoft applications for hybrid deployment

  • 1.
    Containerizing MuleSoft applications forHybrid deployment Moscow MuleSoft Meetup Group October 12 2021
  • 2.
    2 Introductions A SHOW OFHANDS: Who is new to this Meetup? Artem Fomenko Leadex Systems Technical Lead
  • 3.
    ● Our personalexperience of using Docker Swarm with MuleSoft Standalone Runtime ● Technical demonstration of the deployment approach ● Summing-up our experience and further plans on the proposed solution ● Q&A session ● Trivia game Agenda
  • 4.
    MuleSoft Customer-managed DeploymentOptions Hybrid Deployments https://docs.mulesoft.com/runtime-manager/deployment-strategies Anypoint Runtime Fabric Deployments
  • 5.
    ● Isolation –each application is run independently from the others and and doesn’t affect them in terms of shared platform resources. ● Immutability – applications are baked into Docker images along with Mule Runtime. ● Self-healing – whenever a node gets crashed, all the deployed applications within that node are automatically moved to healthy nodes. ● Zero-downtime rolling updates – a Mule application can be automatically updated without any service downtime. ● Secrets – secret values are securely stored and injected into containers at runtime. Virtues of MuleSoft containerization
  • 6.
  • 7.
    ● cAdvisor –collects container-specific metrics directly from Docker. ● node-exporter – Prometheus exporter for hardware and OS metrics exposed by *NIX kernels. ● dockerd-exporter – Docker daemon metrics collector. ● Prometheus – metrics database. ● Alertmanager – alerts dispatcher for Prometheus. ● Unsee – Alertmanager dashboard tool. ● Grafana – web application for metrics interactive visualization. ● Caddy – reverse proxy and basic auth provider. Docker Swarm Cluster Monitoring All credits to Stefan Prodan’s swarmprom
  • 8.
  • 9.
    ● All applicationlogs must be redirected to STDOUT and sent to a log aggregation tool ● OS signals, such as SIGINT and SIGTERM, must be properly redirected to the Mule Runtime process. ● Memory footprint of Mule runtime must be optimized to run one application in accordance with the container’s resource limits. ● Exposing JMX beans can be helpful to monitor Mule runtime and tune up logging levels. ● Image labels are important to keep useful information about the Docker image of a container. Baking a Proper MuleSoft container
  • 10.
    ● environment configurationis to be externalized into a separate repository; ● logging events must contain a unique identifier to correlate them across different services; ● only inter-process communication protocols are to be used (VM queues are forbidden!); ● health check endpoint is to be provided. Developing a Proper MuleSoft application For distributed systems, such as microservices, it is important not to just properly break down an application into decoupled and cohesive services, but also put in place additional mechanisms to handle cross-cutting concerns:
  • 11.
    ● We willbe using an accelerator provide by MuleSoft as an application example ● We will be running a one-node local Docker Swarm cluster to show how Docker images and built and Swarm services deployed ● All applications are to be registered in Runtime Manager Technical Live Demonstration https://anypoint.mulesoft.com/exchange/org.mule.examples/mule soft-accelerator-for-financial-services/
  • 12.
    ● Anypoint RuntimeFabric seems like a better choice when it comes to on-premises microservice-like deployments. ● Getting along Docker Swarm and Anypoint Platform requires a lot of low-level plumbing. ● It needs to be extra careful about setting up resource limits to prevent resource starvation for high-throughput services. ● It is always possible to switch to another orchestrator or even RTF without major changes of applications. ● Docker Swarm is a decent choice when you need to quickly adopt a microservice approach. Summing-up
  • 13.
    ● GitHub repositorywith the demo application ● Official Mule Runtime in Docker FAQ ● Official Docker Swarm Documentation ● Mule Runtime containerization (article) ● Unofficial Mule Runtime images ● HAProxy on Docker Swarm (official article) Useful Links and Articles
  • 14.
  • 15.
  • 16.