Skip to content

Latest commit

 

History

History
97 lines (74 loc) · 2.12 KB

installation.md

File metadata and controls

97 lines (74 loc) · 2.12 KB

Installation Guide

This guide will help you set up Back.Serv on your system.

Prerequisites

Before installing Back.Serv, ensure you have the following:

  • Python 3.8 or higher
  • Redis server
  • MySQL server
  • Git (for cloning the repository)

Step-by-Step Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/back.serv.git
    cd back.serv
  2. Set Up Virtual Environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure Environment Variables

    cp .env.example .env

    Edit .env file with your configuration settings.

  5. Initialize Database Create the necessary database and tables using the provided SQL scripts:

    mysql -u your_username -p your_database < scripts/init_db.sql
  6. Start Redis Server Ensure Redis server is running on your system:

    redis-server
  7. Start Celery Worker

    celery -A celery_tasks worker --loglevel=info
  8. Run the Application

    python back_serv.py

Verifying Installation

To verify that everything is working correctly:

  1. Check if the Flask application is running:

    curl http://localhost:4093/health
  2. Submit a test task:

    curl -X POST http://localhost:4093/submit_task \
         -H "Content-Type: application/json" \
         -d '{"task_type": "image_creation", "task_params": {}, "user_id": "test_user"}'

Common Issues and Solutions

Redis Connection Error

  • Verify Redis is running: redis-cli ping
  • Check Redis connection settings in .env

Database Connection Error

  • Verify MySQL is running
  • Check database credentials in .env
  • Ensure database and tables exist

Celery Worker Not Starting

  • Check Redis connection
  • Verify Celery configuration
  • Check log files for errors

Next Steps