Installation & Setup Guide
Prerequisites
- Python 3.9+
- Google Chrome (Managed by Playwright)
- MySQL Database (For task persistence)
Step-by-Step Installation
Navigate to the project directory:
bashcd social-publisherCreate and activate a virtual environment:
bashpython3 -m venv venv source venv/bin/activateInstall Python dependencies:
bashpip install -r requirements.txtInstall Playwright browsers:
bashplaywright install chromiumConfigure Environment Variables: Create a
.envfile in thesocial-publisherdirectory with your database credentials:envDB_HOST=127.0.0.1 DB_PORT=3306 DB_USERNAME=root DB_PASSWORD=your_password DB_DATABASE=your_database DB_PREFIX=sets_Database Migration: Ensure the database table exists. The system expects a
publish_taskstable (prefixed). You can run the migration via the main ThinkPHP project or ensure the table structure matchesdatabase.py.
Running the Service
Start the API Server
To start the FastAPI server and the background worker:
bash
./start.sh serverThis will launch the server on port 8989.
Run a Single Task via CLI
To publish a video immediately without the server:
bash
./start.sh cli --video "/path/to/video.mp4" --title "My Video" --account_name "default_user"Docker Deployment (Optional)
If deploying via Docker, ensure the container has:
- A non-root user (for Chrome security).
- Necessary system dependencies for Chromium (libnss3, libatk, etc.).
HEADLESS=trueenvironment variable set.