Docker Swarm Stack Architecture

This is our multi-stack Docker Swarm setup. It leverages Docker Swarm to orchestrate containerized services across multiple nodes or on a single host. A central Traefik reverse proxy manages inbound requests by routing them to the appropriate service via domain-based rules.

Each stack is specialized, ranging from database services and bot development to rendering services and centralized logging. Below is a short overview diagram, followed by detailed service cards (with clickable links), and a draft list of business requirements.

Infrastructure Diagram

Docker Swarm Stack Architecture

The diagram (img/infra_diagram.svg) highlights the major stacks, services, and external integrations such as WhatsApp, operators, and customers connecting to the system.

Traefik Stack

Central API Gateway & Reverse Proxy, handling domain-based routing for all microservices. Also includes ngrok to securely expose services to the public when needed.

Traefik

Routes traffic for all stacks using Docker & file providers. Primary entry point for domain-based requests.

ngrok-traefik

Exposes Traefik externally, generating secure public URLs for local services. Useful for remote testing or integration.

DB Stack

Provides a global MySQL/MariaDB database and a phpMyAdmin interface for management (reachable at storage.localhost).

mysqldb

Central MySQL/MariaDB instance used by multiple services across stacks.

phpMyAdmin (Global DB)

Convenient UI for administering the global database.

Bots Dev Stack

A suite of development-oriented bot services, each with its own domain. Redis is used as a shared caching layer for high performance. Some bots can also integrate with WhatsApp.

wtfast-dev-riccio

Bot accessible at devriccio.localhost. Supports "reply" flows and example docs at /docs.

wtfast-dev-ranni

Bot accessible at devranni.localhost. Another "reply" bot with docs at /docs.

wtfast-dev-machinga

Bot accessible at machinga.localhost

wtfast-officer

Bot accessible at officer.localhost. A web-based maintenance service (no separate docs link).

redis-cache

A shared Redis instance that provides caching for all bots to reduce latency.

Dashboard Stack

Laravel-based dashboard for system management and monitoring. Has its own dedicated database and phpMyAdmin interface.

dashboard-app

Laravel application served at dash.localhost. Used for internal management and monitoring tasks.

dashboard-db

MariaDB instance dedicated to the dashboard. Stores config, user data, and more.

phpMyAdmin (Dashboard)

Managing the dashboard-db. Usually accessible via a subdomain such as pma.render.localhost or similar.

Renderer Stack

Handles rendering and serves static/public files via Nginx. Includes a dedicated database and phpMyAdmin for data management.

renderer-backend

Core rendering service at render.localhost. Processes user requests and outputs. Docs at /docs.

renderer-nginx

Serves static/public files at media.localhost. Currently includes images at .porcherface/1.png, 2.png, 3.png.

renderer-db

MySQL database used by the renderer-backend for job data. Integrates seamlessly with rendering processes.

renderer-pma

Dedicated phpMyAdmin instance for the renderer DB, accessible at pma.render.localhost.

Logger Stack

Centralized logging solution with a NestJS backend and a browser-based dashboard. Collects logs from all microservices and stores them in a dedicated database.

wapiulogger-mariadb

Database for all system logs, ensuring historical records and analytics.

wapiulogger-pma

phpMyAdmin interface for inspecting and managing the logger DB.

wapiulogger-backend

A NestJS service that receives log data, persists it, and exposes an API for log retrieval or analysis.

wapiulogger-frontend

The logging dashboard at logger.localhost. Contains search, filter, and real-time stream features. May also have docs at /docs.

Websites Stack

Collection of static websites. Contains waPiu's website and this documentation

www

The main website at www.localhost. Contains a single page placeholder.

docs

This document

Connections & Data Flows

Services are deployed in Docker Swarm, connected by dedicated networks. Traefik handles inbound requests and routes traffic to each stack via domain name rules. Some key flows:

System Requirements (Draft)

Below is a static listing of our preliminary business requirements (BR) and associated details. This is a placeholder for a future automated docs pipeline.

Requirement
Code
Description Requirements Infrastructures
BR01-01 Our services must be reachable using WhatsApp
  • BR01-01_AR01: system must receive WhatsApp messages on multiple numbers
  • BR01-01_AR02: system must send WhatsApp messages on multiple numbers
  • api-gateway
  • vonage-client
BR01-02 Our services must be reachable using RCS
  • BR01-02_AR01: system must receive RCS messages on multiple accounts
  • BR01-02_AR02: system must send RCS messages on multiple accounts
  • api-gateway
  • vonage-client
BR02-01 Our services must be able to respond with an automated chatbot
  • BR02-01_AR01: respond with low latency
  • BR02-01_AR02: load customizable business logic per customer
  • BR02-01_AR03: allow chatbot personalization
  • api-gateway
  • vonage-client
  • business-logic
  • dashboard
  • data-storage
BR02-02 Our services must be able to send marketing and service campaigns
  • BR02-02_AR01: send large numbers of messages in batch
  • BR02-02_AR02: schedule campaigns
  • BR02-02_AR03: trigger campaigns
  • BR02-02_AR04: ensure top-notch sendout speed
  • BR02-02_AR05: allow segmentation and customization
  • BR02-02_AR06: monitor campaign status
  • vonage-client
  • dashboard
  • data-storage
  • service-webhooks
BR02-03 Our services must allow customers to reply individually to users
  • BR02-03_AR01: see messages received by chatbots
  • BR02-03_AR02: mute/unmute the bot
  • BR02-03_AR03: send messages via chatbot
  • vonage-client
  • dashboard
  • data-storage
  • service-webhooks
BR02-04 Our services must be highly customizable
  • BR02-04_AR01: edit texts, templates, and assets
  • BR02-04_AR02: modify chatbot flow
  • BR02-04_AR03: apply changes live without interruption
  • BR02-04_AR04: test before going live
  • dashboard
  • data-storage
  • service-webhooks
BR03-01 Our services must ensure maximal uptimes and operational resilience
  • BR03-01_AR01: deploy in high-availability environments
  • BR03-01_AR02: avoid single points of failure
  • BR03-01_AR03: auto-monitor system health
  • BR03-01_AR04: zero-downtime deployments
  • BR03-01_AR05: support horizontal scalability
  • api-gateway
  • system-deployer
  • system-monitor
  • load-balancer
BR03-02 Our services must ensure fault tolerance
  • BR03-02_AR01: isolate failures to prevent cascading
  • BR03-02_AR02: auto-recovery procedures
  • BR03-01_AR03: provide alerting for critical services
  • system-deployer
  • system-monitor
BR03-03 Our services must ensure fast responses
  • BR03-03_AR01: optimize gateway performance & caching
  • BR03-03_AR02: minimize latency
  • api-gateway
  • load-balancer
  • caching-service
BR03-04 Our services must ensure data safety
  • BR03-04_AR01: encryption at rest and in transit
  • BR03-04_AR02: robust access control and audit logging
  • data-storage
  • encryption-engine
BR03-05 Our services must ensure data persistence
  • BR03-05_AR01: DB replication & regular backups
  • BR03-05_AR02: log replication & backups
  • BR03-05_AR03: support disaster recovery
  • data-storage
  • data-backup
  • system-monitor
BR03-06 Our services must ensure communication safety
  • BR03-06_AR01: use secure communication protocols
  • api-gateway
BR04-01 Our services must be able to deploy continuously
  • BR04-01_AR01: automated workflows
  • BR04-01_AR02: deploy independently of underlying machine
  • BR04-01_AR03: rollback on failure
  • system-deployer
  • system-monitor
BR04-02 Our services must be able to fix immediately
  • BR04-02_AR01: find errors via automated workflows
  • BR04-02_AR02: find errors via log inspection
  • BR04-02_AR03: deploy hot-fixes
  • BR04-02_AR04: backtrack hot-fixes
  • BR04-02_AR05: integrate hot-fixes
  • system-deployer
  • system-monitor
BR04-03 Our services must be able to release continuously
  • BR04-03_AR01: releases via automated workflows
  • BR04-03_AR02: support semantic versioning
  • BR04-03_AR03: support API versioning
  • system-deployer
  • system-monitor
BR04-04 Our services must be able to adapt to tech changes
  • BR04-04_AR01: system must be modular
  • BR04-04_AR02: system must be code agnostic
  • BR04-04_AR03: allow module replacement
  • system-deployer
  • system-monitor
BR05-01 Our services must log all processed data
  • BR05-01_AR01: log received data
  • BR05-01_AR02: log sent data
  • BR05-01_AR03: log every access
  • BR05-01_AR04: log every error
  • data-storage
  • system-monitor
  • vonage-client
  • api-gateway
BR05-02 Our services must transmit customers relevant data
  • BR05-02_AR01: process raw data to generate KPI
  • BR05-02_AR02: show raw KPI metrics
  • BR05-02_AR03: generate automatic reports
  • data-storage
  • data-analytics
  • dashboard
BR05-03 Our services must allow customers to use their data
  • BR05-03_AR01: operate based on provided data
  • dashboard
BR05-04 Our services must ensure all customer data is protected
  • BR05-04_AR01: store data in sharded storage
  • BR05-04_AR02: encrypt data at rest & in transit
  • BR05-04_AR03: enforce cross-customer data access protection
  • data-storage
  • encryption-engine
  • system-monitor
BR06-01 Our services must be able to integrate anytime with external actors
  • BR06-01_AR01: expose secure, well-documented APIs
  • BR06-01_AR02: support real-time data exchange
  • api-gateway
  • integration-hub
BR06-02 Our services must ensure low integration downtimes
  • BR06-02_AR01: redundant integration endpoints
  • BR06-02_AR02: automated failover & recovery
  • api-gateway
  • system-monitor
  • integration-hub
BR06-03 Our services must ensure integration protection
  • BR06-03_AR01: strict authentication & authorization
  • BR06-03_AR02: continuous monitoring & logging of integration activities
  • api-gateway
  • system-monitor
  • integration-hub
BR06-04 Our services must ensure retrocompatibility
  • BR06-04_AR01: support API versioning for integrations
  • BR06-04_AR02: provide backward compatibility for integration
  • api-gateway
BR07-01 Our services must provide a user-friendly interface for non-technical users
  • BR07-01_AR01: intuitive and responsive UI/UX design
  • BR07-01_AR02: clear navigation, context-sensitive help
  • dashboard
BR07-02 Our services must facilitate guided onboarding
  • BR07-02_AR01: interactive tutorials & step-by-step onboarding
  • BR07-02_AR02: contextual support and in-app tips
  • dashboard
  • support
BR07-03 Our services must provide up-to-date documentation & tutorials
  • BR07-03_AR01: host comprehensive docs updated with every release
  • BR07-03_AR02: step-by-step guides accessible in-platform
  • dashboard
  • support
BR07-04 Our services must offer support channels
  • BR07-04_AR01: live chat support integrated in the dashboard
  • BR07-04_AR02: ticketing system for issue tracking
  • BR07-04_AR03: knowledge base for self-service support
  • support
  • dashboard