ayushlostvolts/tmg

โ˜… 0Forks 0PythonGitHub โ†—Compare

README

๐Ÿš€ PROJECT PREDATOR: PRODUCTION DEPLOYMENT & HOSTING GUIDE

CONFIDENTIAL A&R INFRASTRUCTURE โ€“ 2026 DEPLOYMENT
Consolidated Production Package (Phases 1โ€“5 Complete)


๐Ÿ“‹ Overview

PREDATOR_PRODUCTION contains the complete, battle-tested codebase for Agent PREDATOR and its Swarm. It ingests raw platform data from YouTube, Spotify, Shazam, and SoundCloud, calculates algorithmic velocity and comment density, enforces zero-bloat database maintenance, and routes high-priority viral trends directly to ClickUp.


โšก Option 1: Quick Start with Docker Compose (Recommended)

Deploying with Docker is the fastest, cleanest method for Hetzner or any bare-metal Ubuntu Linux server.

Prerequisites

  • Docker Engine installed (docker --version)
  • Docker Compose installed (docker-compose --version)

Deployment Steps

  1. Clone/Copy Project: Upload PREDATOR_PRODUCTION to your server directory (e.g., /opt/predator).

  2. Configure Environment Variables: Copy .env.example to .env:

    cp .env.example .env

    Edit .env to include your actual API keys and Webhook URLs:

    CLICKUP_API_KEY=pk_your_actual_clickup_api_key
    CLICKUP_LIST_ID=your_list_id
    CLICKUP_USER_ID_AYDEN=81352468
    DISCORD_LOGS_WEBHOOK_URL=https://discord.com/api/webhooks/...
    DISCORD_FATAL_WEBHOOK_URL=https://discord.com/api/webhooks/...
  3. Initialize Database Tables:

    docker-compose run --rm predator_swarm python -m src.main --init-db
  4. Launch the Swarm in Daemon Mode:

    docker-compose up -d
  5. Check Container Logs:

    docker-compose logs -f predator_swarm

๐Ÿง Option 2: Bare-Metal Linux Deployment (Systemd Daemon)

To run natively on Hetzner Ubuntu bare-metal:

  1. Install System Dependencies:

    sudo apt update && sudo apt install -y python3-pip python3-venv postgresql redis-server git
  2. Setup Virtual Environment & Dependencies:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
    python3 -m playwright install chromium
    python3 -m playwright install-deps chromium
  3. Initialize Database & Verify Environment:

    python3 -m src.main --init-db
    python3 -m src.main --mock-validation-phase5
  4. Create Systemd Service (/etc/systemd/system/predator.service):

    [Unit]
    Description=Project Predator Swarm Daemon
    After=network.target postgresql.service redis-server.service
    
    [Service]
    Type=simple
    User=ubuntu
    WorkingDirectory=/opt/predator
    ExecStart=/opt/predator/.venv/bin/python -m src.main --daemon
    Restart=always
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
  5. Enable and Start Service:

    sudo systemctl daemon-reload
    sudo systemctl enable predator
    sudo systemctl start predator
    sudo systemctl status predator

๐Ÿ› ๏ธ CLI Operations & Admin Commands (PRD 9.2)

You can run individual CLI operations or admin overrides at any time:

Admin Injections

  • Add VIP Channel:
    python -m src.main --admin-cmd "/vip add https://www.youtube.com/channel/UC_channel_id"
  • Inject Search Keyword:
    python -m src.main --admin-cmd "/addkeyword hardstyle sped up"

Manual Sweeps & Queue Processing

  • Run External Chart Sweep: python -m src.main --sweep-charts
  • Process YouTube Search Queue: python -m src.main --process-queue
  • Process 12H Hunts & Early Kills: python -m src.main --process-hunts
  • Run ClickUp Task Drip Feed: python -m src.main --drip-feed

๐Ÿงช System Health & Validation Commands

To verify full pipeline integrity in production:

python -m src.main --mock-validation-full

Or run the complete Pytest test suite:

pytest tests/test_full_suite.py -v

๐Ÿ“ System Architecture Overview

PREDATOR_PRODUCTION/
โ”œโ”€โ”€ docker-compose.yml       # Production Docker orchestration (DB, Redis, App)
โ”œโ”€โ”€ Dockerfile               # Production container image manifest
โ”œโ”€โ”€ .env.example             # Environment template
โ”œโ”€โ”€ requirements.txt         # Consolidated Python requirements
โ”œโ”€โ”€ README.md                # Hosting & ops manual
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py              # CLI & Daemon Orchestrator
โ”‚   โ”œโ”€โ”€ scoring.py           # 0-100 Predator Score Engine
โ”‚   โ”œโ”€โ”€ trend_logic.py       # Title Clustering & Format Counter-Strike
โ”‚   โ”œโ”€โ”€ health_monitor.py    # Fatal Alert Monitors & Hardware Ceiling
โ”‚   โ”œโ”€โ”€ admin_commands.py    # /vip add & /addkeyword Injections
โ”‚   โ”œโ”€โ”€ database_maintenance.py # 30-Day TTL Purge & Zero-Bloat Cleanup
โ”‚   โ”œโ”€โ”€ phase2_staging.py    # Self-learning dataset exporter
โ”‚   โ”œโ”€โ”€ redis_queue.py       # Redis drip-feed & DB fallback queue
โ”‚   โ”œโ”€โ”€ clickup.py           # ClickUp API, @mentions, Google Trends
โ”‚   โ”œโ”€โ”€ discord_alerts.py    # #swarm-logs & #swarm-fatal webhooks
โ”‚   โ”œโ”€โ”€ youtube_tracker.py   # Individual video metric scraper
โ”‚   โ”œโ”€โ”€ scrapers.py          # Spotify, Shazam, Beatport, Apple, YouTube Trending scrapers
โ”‚   โ”œโ”€โ”€ normalizer.py        # Base title extraction & Unicode text normalizer
โ”‚   โ””โ”€โ”€ database.py          # PostgreSQL / SQLite DB connection & migrations
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_full_suite.py   # Full test suite covering all 5 phases

Issues