This guide will help you set up Back.Serv on your system.
Before installing Back.Serv, ensure you have the following:
- Python 3.8 or higher
- Redis server
- MySQL server
- Git (for cloning the repository)
-
Clone the Repository
git clone https://github.com/yourusername/back.serv.git cd back.serv
-
Set Up Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment Variables
cp .env.example .env
Edit
.env
file with your configuration settings. -
Initialize Database Create the necessary database and tables using the provided SQL scripts:
mysql -u your_username -p your_database < scripts/init_db.sql
-
Start Redis Server Ensure Redis server is running on your system:
redis-server
-
Start Celery Worker
celery -A celery_tasks worker --loglevel=info
-
Run the Application
python back_serv.py
To verify that everything is working correctly:
-
Check if the Flask application is running:
curl http://localhost:4093/health
-
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"}'
- Verify Redis is running:
redis-cli ping
- Check Redis connection settings in
.env
- Verify MySQL is running
- Check database credentials in
.env
- Ensure database and tables exist
- Check Redis connection
- Verify Celery configuration
- Check log files for errors
- Read the API Documentation
- Check out Configuration Guide
- Learn about Deployment