Installation Guide
This guide will walk you through setting up RedHarmony on your system.
System Requirements
Before installing RedHarmony, ensure your system meets these requirements:
Basic Requirements
- Python 3.8 or higher
- pip (Python package manager)
- Git (for cloning the repository)
- 100MB free disk space
- Internet connection for API access
AI Provider Requirements
Choose one of the following:
- OpenAI API key with GPT-4 access (default option)
- DeepSeek API key (alternative option)
Web Server Requirements
- Flask 3.1.0 or higher
- Gunicorn (for production deployment)
- Available port (default: 8080)
- Network access for web interface
- SSL certificate (for production HTTPS)
Step-by-Step Installation
1. Clone the Repository
git clone https://github.com/jeffersonnnn/redharmony.git
cd redharmony
2. Create a Virtual Environment
# On Linux/MacOS
python3 -m venv venv
source venv/bin/activate
# On Windows
python3-m venv venv
venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
4. Provider Setup
-
Choose your AI provider:
- OpenAI (default): Get your API key from OpenAI Platform
- DeepSeek (alternative): Get your API key from DeepSeek Platform
-
Configure your chosen provider:
# Copy the example environment file
cp .env.example .env
For OpenAI:
USE_DEEPSEEK="False"
OPENAI_API_KEY="your_openai_api_key"
For DeepSeek:
USE_DEEPSEEK="True"
DEEPSEEK_API_KEY="your_deepseek_api_key"
5. Reddit Configuration
Add your Reddit credentials to .env
:
REDDIT_USERNAME="your_reddit_username"
REDDIT_PASSWORD="your_reddit_password"
REDDIT_CLIENT_ID="your_client_id"
REDDIT_CLIENT_SECRET="your_client_secret"
REDDIT_USER_AGENT="script:redharmony:v1.0 (by u/your_username)"
6. Environment Setup
- Copy the example environment file:
cp .env.example .env
- Edit
.env
with your credentials:
# OpenAI API Configuration
OPENAI_API_KEY="your_openai_api_key"
# Reddit API Configuration
REDDIT_USERNAME="your_reddit_username"
REDDIT_PASSWORD="your_reddit_password"
REDDIT_CLIENT_ID="your_client_id"
REDDIT_CLIENT_SECRET="your_client_secret"
REDDIT_USER_AGENT="script:redharmony:v1.0 (by u/your_username)"
# Web Server Configuration (Optional)
FLASK_ENV="development" # or "production"
FLASK_PORT="8080"
FLASK_HOST="localhost"
7. Database Initialization
The database will be automatically initialized when you first run the application. The default SQLite database will be created as reddit_bot.db
.
For detailed information about:
- Database schema and structure, see Database Schema Overview
- Maintenance and backups, see Database Maintenance
- Security considerations, see Database Security
If you encounter any database-related issues during installation, refer to our Database Troubleshooting Guide.
8. Verify Installation
Run the following command to verify your installation:
python main.py --test
You should see a success message indicating that the installation is complete.
9. Web Server Setup (Optional)
For development:
python app.py
For production:
gunicorn app:app --bind localhost:8080
Troubleshooting
Common Issues
-
ModuleNotFoundError
pip install --upgrade -r requirements.txt
-
Database Permission Error Ensure you have write permissions in the project directory.
-
API Authentication Errors Double-check your credentials in the
.env
file.
Web Server Issues
-
Port Already in Use
# Check what's using the port
lsof -i :8080
# Change port in .env or kill the process -
Connection Refused
- Verify the server is running
- Check firewall settings
- Ensure correct host/port configuration
- Verify network permissions
-
SSL Certificate Errors
- Ensure valid SSL certificate for HTTPS
- Check certificate path configuration
- Verify certificate permissions
-
Performance Issues
- Increase worker processes in Gunicorn
- Monitor system resources
- Check application logs
- Consider load balancing
-
Authentication Failures
- Verify environment variables
- Check authentication configuration
- Review access logs
- Test with curl or Postman
Getting Help
If you encounter any issues: