74 lines
3.7 KiB
Markdown
74 lines
3.7 KiB
Markdown
# Chronos Architecture
|
|
|
|
This document outlines the high-level architecture of Chronos, a Rust-based workflow automation platform.
|
|
|
|
## Overview
|
|
|
|
Chronos is built as a Cargo workspace with multiple crates that implement different components:
|
|
|
|
- `chronos-core`: Shared data models and utilities
|
|
- `chronos-api`: HTTP API server using Axum
|
|
- `chronos-scheduler`: Scheduling service
|
|
- `chronos-worker`: Worker execution service
|
|
- `chronos-workflow`: Workflow engine
|
|
- `chronos-database`: Database interface
|
|
- `chronos-auth`: Authentication system
|
|
- `chronos-executor`: Native process execution engine
|
|
- `chronos-notifications`: Notification delivery system
|
|
- `chronos-metrics`: Metrics collection
|
|
- `chronos-cli`: Command-line interface
|
|
|
|
## Component Interactions
|
|
|
|
```
|
|
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
|
│ Browser │ │ Chronos │ │ Database │
|
|
└───────────┘ │ (API) │ └───────────┘
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────────┐ │ │ │
|
|
│ Workflow│ │ │ │
|
|
│ Editor│ │ │ │
|
|
└───────────┘ │ │ │
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────────┐ │ │ │
|
|
│ Scheduler │ │ │ │
|
|
│ │ │ │ │
|
|
└───────────┘ │ │ │
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────────┐ │ │ │
|
|
│ Worker │ │ │ │
|
|
│ Executor│ │ │ │
|
|
└───────────┘ │ │ │
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────────┐ │ │ │
|
|
│ Executor │ │ │ │
|
|
│ (Native)│ │ │ │
|
|
└───────────┘ │ │ │
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────────┐ │ │ │
|
|
│ Executor │ │ │ │
|
|
│ (Native)│ │ │ │
|
|
└───────────┘ │ │ │
|
|
```
|
|
|
|
## Core Data Flow
|
|
|
|
1. **User Interface**: Users interact with the web dashboard to create and manage workflows
|
|
2. **API Layer**: The Axum API server receives requests, validates them, and dispatches to appropriate services
|
|
3. **Scheduler**: Handles scheduling decisions and job creation in the database
|
|
4. **Worker Pool**: Workers pick up scheduled jobs and execute them via the executor
|
|
5. **Executor**: Runs actual commands in isolated processes with resource limits
|
|
6. **Database**: Stores all persistent state including workflows, schedules, executions, and user data
|
|
|
|
## Security Model
|
|
|
|
- All user inputs are validated and sanitized
|
|
- Authentication is enforced at API layer
|
|
- Workers execute tasks in isolated native processes
|
|
- Sensitive credentials are encrypted at rest
|
|
- Access control is implemented through role-based permissions |