How relaypro-open/dog_trainer works
Main System Components
a) Core Components:
• dog_trainer (Central Server)
• RethinkDB (Database)
• RabbitMQ (Message Broker)
• dog_agents (Client Components)
b) Supporting Services:
• Certificate Authority System
• AWS EC2 Integration (evident from erlcloud configuration)
Key Architectural Patterns
The project follows a distributed architecture with several key patterns:
• Publisher/Subscriber Pattern (via RabbitMQ)
• Supervisor Tree Pattern (Erlang/OTP)
• API-driven architecture (multiple API versions)
• Watcher Pattern (multiple *_watcher.erl files)
┌─────────────────────────────────────────────────────────────┐
• Client Layer │
• ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
• dog_agent1│ │dog_agent2│ │dog_agent3│ │ ... │ │
• ┴──────────┴──┴──────────┴──┴──────────┴──┴──────────┴───┘
┌─────────────────────────────────────────────────────────────┐
• Communication Layer │
• ┌─────────────────────────────────────────────┐ │
• RabbitMQ Cluster │ │
• (With SSL/TLS & Federation Support) │ │
• ┴─────────────────────────────────────────────┴───────────┘
┌─────────────────────────────────────────────────────────────┐
• Core Server Layer │
• ┌─────────────────────────────────────────────┐ │
• dog_trainer │ │
• ┌─────────┐ ┌─────────┐ ┌────────────┐ │ │
• API (v1) │ │API (v2) │ │Supervisors │ │ │
• ┘ └─────────┘ └────────────┘ │ │
• ┌─────────┐ ┌─────────┐ ┌────────────┐ │ │
• Watchers │ │Agents │ │State Mgmt │ │ │
• ┘ └─────────┘ └────────────┘ │ │
• ┴─────────────────────────────────────────────┴───────────┘
┌─────────────────────────────────────────────────────────────┐
• Persistence Layer │
• ┌─────────────────────────────────────────────┐ │
• RethinkDB Cluster │ │
• (With Sharding & Replication) │ │
• ┴─────────────────────────────────────────────┴───────────┘
Important Relationships
• Bidirectional communication between dog_agents and RabbitMQ
• Data flow between dog_trainer and RethinkDB
• Supervision hierarchies within dog_trainer
• Federation relationships between RabbitMQ instances
• Security certificate distribution paths
Key Components to Detail
Core Services (from src/ directory):
• API Handlers (api_handler*.erl)
• Database Operations (dog_rethink.erl)
• Configuration Management (dog_config.erl)
• State Management (dog_state.erl)
• File Transfer System (dog_file_transfer*.erl)
• EC2 Integration (dog_ec2*.erl)
Configuration and Security
Configuration flow:
• Certificate management
• RabbitMQ virtual hosts
• Database initialization
• Security groups and firewall rules
Monitoring and Health
Monitoring components:
• Keepalive system (dog_keepalive_agent.erl)
• Health checks (healthcheck_api_handler.erl)
• Watcher services (multiple *_watcher.erl files)
Remember to emphasize the high-availability aspects of the system, showing how RethinkDB clustering and RabbitMQ federation work together to provide a robust, distributed firewall management solution.