Self-hosting
This guide will help you run the entire Rhesis platform using Docker Compose for self-hosted deployments.
Important: This guide uses Docker Compose V2 syntax (
docker compose
without hyphen). If you’re using an older version of Docker, you may need to install Docker Compose V2 or use the legacydocker compose
command.
Prerequisites
- Docker Desktop installed and running
- Git (to clone the repository)
- Ports 3000, 8080, 8081, 5432, and 6379 available on your system
System Requirements
Development Environment
For local development, testing, and evaluation:
Resource | Minimum | Recommended |
---|---|---|
RAM | 4 GB | 6 GB |
Storage | 8 GB free | 15 GB free |
CPU | 2 cores | 4 cores |
Network | Stable internet | Broadband |
Development Notes:
- Includes hot-reload and development tools
- Lower concurrent user load
- Smaller dataset for testing
- Debug logging enabled
Production Environment
For production deployment with real users:
Resource | Minimum | Recommended | High-Scale |
---|---|---|---|
RAM | 8 GB | 16 GB | 32 GB+ |
Storage | 20 GB SSD | 50 GB SSD | 100 GB+ SSD |
CPU | 4 cores | 8 cores | 16+ cores |
Network | 50 Mbps | 100 Mbps | 1 Gbps+ |
Production Notes:
- Optimized builds without development overhead
- Higher concurrent user capacity
- Production logging levels
- Database connection pooling
Detailed Resource Breakdown
Memory Usage by Environment:
Service | Development | Production |
---|---|---|
PostgreSQL | ~256 MB | ~1-2 GB |
Redis | ~50 MB | ~500 MB - 1 GB |
Backend | ~150 MB | ~500 MB - 1 GB |
Worker | ~200 MB | ~1-2 GB |
Frontend | ~100 MB | ~200-400 MB |
Docker Overhead | ~300 MB | ~500 MB - 1 GB |
Total Estimated | ~1.1 GB | ~3.7-7.1 GB |
Storage Requirements:
Component | Development | Production |
---|---|---|
Application Code | ~2 GB | ~2 GB |
Database | ~500 MB | ~5-50 GB+ |
Docker Images | ~3 GB | ~3-4 GB |
Logs & Cache | ~500 MB | ~2-10 GB |
Working Space | ~1 GB | ~3-5 GB |
Total Estimated | ~7 GB | ~15-75 GB+ |
Performance Characteristics
CPU Usage Patterns:
- High Load: AI processing, bulk data operations, migrations
- Normal Load: API requests, background tasks, web serving
- Idle: Minimal CPU during low activity periods
Scaling Factors:
- AI Operations: Memory spikes during model inference
- Concurrent Users: ~50-100 MB RAM per active user
- Database Growth: Storage scales with user data and analytics
- Background Tasks: CPU-intensive during batch processing
Docker Compose Version Note
Why docker compose
instead of docker-compose
?
docker-compose
(V1): The original standalone tool written in Python, deprecated as of June 2023docker compose
(V2): The modern version integrated into Docker CLI, written in Go with better performance
If you encounter errors with docker-compose
, you’re likely using the deprecated V1. Switch to docker compose
(V2) for:
- Better performance and reliability
- Active maintenance and security updates
- Support for newer Docker features
- Improved integration with Docker CLI
Quick Start
- Clone the repository
- Copy environment variables
-
Configure environment variables
Edit the
.env.docker
file and update the following configurations:- Auth0 configuration
- JWT configuration
- Azure OpenAI configuration
- Gemini configuration
- SMTP configuration
- NextAuth.js configuration
- Any other environment variables as needed
-
Start all services
- Access the applications
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080/docs
- Worker Health: http://localhost:8081/health/basic
Architecture Overview
Services
The Rhesis platform consists of several interconnected services:
Service | Port | Description | Health Check |
---|---|---|---|
PostgreSQL | 5432 | Primary database | pg_isready |
Redis | 6379 | Cache & message broker | redis-cli ping |
Backend | 8080 | FastAPI application | curl /health |
Worker | 8081 | Celery background tasks | curl /health/basic |
Frontend | 3000 | Next.js application | curl /api/auth/session |
Service Dependencies
Automated Database Setup
No manual database setup required! The system automatically handles:
- PostgreSQL database and user creation
- Database ownership and permissions setup
- Automatic Alembic migration execution
- Table and relationship creation
- Migration status checking (prevents duplicate migrations)
The backend container startup process:
- Waits for PostgreSQL to be ready
- Sets proper database ownership
- Runs all pending migrations
- Starts the FastAPI application
Environment Configuration
Required Environment Variables
Update your .env.docker
file with the following configurations:
Authentication & Security
These variables configure user authentication and security for the platform:
OAuth Providers (Optional)
Additional authentication providers for user login options:
Email Configuration (Optional)
Required for sending system emails, notifications, and user communications:
AI Model Configuration (Optional)
Configure AI providers for natural language processing and content generation:
Note: At least one AI provider configuration is recommended for full platform functionality. You can choose between Gemini, Azure OpenAI, or OpenAI based on your preferences and requirements.
Management Commands
Service Management
Start services:
Stop services:
Restart services:
Monitoring and Logs
View logs:
Check service status:
Building and Updates
Rebuild services:
Database Operations
The database is automatically managed, but you can access it directly if needed:
Troubleshooting
Common Issues
Database Migration Problems:
- Check migration status:
- View migration logs:
- Reset database (WARNING: deletes all data):
Service Health Issues:
- Check service status:
- Verify environment variables:
- Check resource usage:
Port Conflicts:
If you encounter port conflicts, you can modify the ports in docker compose.yml
or stop conflicting services:
Performance Optimization
Resource Allocation:
- Ensure Docker has at least 4GB RAM allocated
- Monitor disk space usage with
docker system df
- Clean up unused resources with
docker system prune
Database Performance:
- Monitor PostgreSQL logs:
docker compose logs postgres
- Check connection counts and slow queries
Security Considerations
- Change default passwords in production
- Use strong JWT secrets
- Configure proper firewall rules
- Keep environment variables secure
- Regularly update Docker images
Backup and Recovery
Database Backup
Full System Backup
Support and Resources
Getting Help
If you encounter issues:
- Check the logs:
docker compose logs
- Verify environment variables are set correctly
- Ensure Docker has sufficient resources
- Check if ports are available and not in use
- Review the main documentation for additional guidance
Additional Resources
For development setup and local development without Docker, see the 🔧 Environment Setup Guide.