Concepts
Architecture Overview
AutoHost follows a distributed architecture where a central cloud backend manages multiple self-hosting nodes.
AutoHost follows a distributed architecture where a central cloud backend manages multiple self-hosting nodes.
System Diagram
plaintext
┌─────────────────────────────────────────────────────────┐
│ AutoHost Cloud │
│ │
│ ┌──────────────┐ ┌──────────────────────────┐ │
│ │ Cloud Panel │ ──────▶ │ Cloud API │ │
│ │ (Next.js) │ │ REST :8080 + gRPC :9090 │ │
│ └──────────────┘ └────────────┬─────────────┘ │
│ │ │
│ PostgreSQL │
└─────────────────────────────────────────┼───────────────┘
│
┌──────────────────────────────────┼──────────────────────────┐
│ │ │
┌──────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐
│ Node A │ │ Node B │ │ Node C │
│ │ │ │ │ │
│ CLI │ │ CLI │ │ CLI │
│ Agent │ │ Agent │ │ Agent │
│ Docker apps │ │ Docker apps │ │ Docker apps │
└─────────────┘ └─────────────┘ └─────────────┘Component Roles
CLI (autohost)
Runs interactively on each node. Sets up the server environment (Docker, Tailscale). Enrolls the node with the cloud. Installs and manages Docker-based applications.
Agent (autohost-agent)
Runs as a background systemd service. Sends heartbeats every 15s to report node liveness. Collects and sends system metrics (CPU, memory, disk) every 15s. Connects to the cloud via gRPC to receive remote commands.
Cloud API (autohost-cloud-api)
Central backend (Go + PostgreSQL). Manages users, authentication (JWT + OAuth). Handles node enrollment with single-use tokens. Dispatches remote commands to agents via gRPC.
Cloud Panel (autohost-cloud-lite)
Web UI (Next.js + shadcn/ui). Visualizes node status and metrics. Generates enrollment tokens. Triggers remote command execution.
AutoHost follows a distributed architecture designed for reliability, security, and ease of use.
Core Components
- Control Plane - Centralized management and orchestration logic
- API Gateway - Secure entry point for all API requests
- Agent - Runs on each node, executes deployment commands
- State Store - Distributed storage for configuration and state
Data Flow
When you deploy a service, the request flows through several components:
- CLI/API sends deployment request to Control Plane
- Control Plane validates and schedules the deployment
- Agents on target nodes receive deployment instructions
- Agents pull images and start containers
- Health checks confirm successful deployment
Security Model
Security is built into every layer of AutoHost:
- All communication encrypted with TLS 1.3
- Agent-to-cloud authentication via mTLS
- Role-based access control (RBAC)
- Audit logging for all operations
- Secrets management with encryption at rest