- Rewrite README.md with comprehensive architecture overview, component descriptions, and deployment instructions - Update controller/README.md to focus on Docker deployment with pre-built images from Gitea registry - Simplify epistine-webserver/README.md by removing development setup and focusing on Docker Compose deployment - Add detailed system diagrams, task type tables, and configuration examples - Remove redundant development workflow instructions in favor of containerized deployment
Controller Server
This is the centralized controller for agent/task management, logging, and database operations within the Epistine system.
Features
- FastAPI-based REST API: Provides endpoints for managing agents, tasks, and system operations
- PostgreSQL Database Integration: Handles database connections, schema management, and SQL operations
- Security API Key Management: Implements API key validation and authentication
- Logging System: Manages system logs with configurable directory and file size limits
- CORS Middleware: Configurable CORS settings with support for Streamlit origins
Architecture
The controller follows a modular FastAPI structure:
- app.py: Main FastAPI application with CORS middleware configuration
- confighelper.py: Configuration loader using TOML format
- dbhandler.py: PostgreSQL database handler with connection pooling
- api_key_handler.py: Security handler for API key validation
- logger.py: Logging configuration and message handling
- routers/routes.py: Contains the FastAPI router configuration
Configuration
The system uses environment variables (via .env file) and TOML configuration (via settings.toml):
Environment Variables
POSTGRES_SUPERUSER_NAME=your_superuser
POSTGRES_SUPERUSER_PASSWORD=your_secure_password
POSTGRES_IP=localhost
POSTGRES_PORT=5432
SCHEMA_FILE_PATH=./schema/version1.sql
MASTER_API_KEY=your_master_api_key
SSL_KEYFILE=/app/certs/controller.local-key.pem
SSL_CERTFILE=/app/certs/controller.local.pem
CONTROLLER_PORT=8000
STREAMLIT_ORIGIN=http://localhost:8501
TOML Configuration
The settings.toml file contains structured configuration including:
- Shared Configuration: Controller address and logging settings
- PostgreSQL Database: Connection parameters and authentication
- Logging System: Log types, levels, and directory configuration
- Security Settings: API key requirements and validation rules
- Agent Configuration: Agent-specific settings
- Task Configuration: Task-specific settings
API Endpoints
The controller exposes the following REST API endpoints:
GET /health: Health check endpoint (returns status and timestamp)- Additional endpoints defined in
app/routers/routes.py
Running the Controller
The controller is available as a Docker image from the Gitea container registry. Use the following command to run it:
docker run -p 8000:8000 \
-e POSTGRES_SUPERUSER_NAME=your_superuser \
-e POSTGRES_SUPERUSER_PASSWORD=your_secure_password \
-e POSTGRES_IP=localhost \
-e POSTGRES_PORT=5432 \
-e SCHEMA_FILE_PATH=./schema/version1.sql \
-e MASTER_API_KEY=your_master_api_key \
-e SSL_KEYFILE=/app/certs/controller.local-key.pem \
-e SSL_CERTFILE=/app/certs/controller.local.pem \
-e CONTROLLER_PORT=8000 \
-e STREAMLIT_ORIGIN=http://localhost:8501 \
-v /path/to/certs:/app/certs:ro \
-v /path/to/logs:/logs \
gitea.kareemhorstink.me/imrayya/epistinefiles/controller:latest
Alternatively, you can use Docker Compose with the pre‑built image:
version: '3.8'
services:
controller:
image: gitea.kareemhorstink.me/imrayya/epistinefiles/controller:latest
ports:
- "8000:8000"
env_file: .env
volumes:
- ./certs:/app/certs:ro
- /path/to/your/logs:/logs
Note
: Replace the environment variables and volume paths with your actual configuration. The image is automatically updated when changes are pushed to the repository.
Dependencies
All required dependencies are listed in requirements.txt:
- FastAPI==0.104.1
- Uvicorn==0.24.0 (with standard dependencies)
- Pydantic==2.5.0
- Requests==2.31.0
- Psycopg2-binary==2.9.11
- Tomli==2.3.