Files
BasharBotV2/DOCKER_DEPLOYMENT.md
2025-12-05 21:40:02 -05:00

2.3 KiB

Docker Deployment Guide

Quick Start

  1. Copy environment file:

    cp .env.example .env
    
  2. Edit .env with your Discord token:

    # Edit .env and add your DISCORD_TOKEN
    
  3. Build and run with Docker Compose:

    docker-compose up -d
    
  4. View logs:

    docker-compose logs -f basharbot
    

Portainer Deployment

Method 1: Using Portainer Stacks

  1. Log into Portainer
  2. Go to StacksAdd stack
  3. Name it basharbot
  4. Choose Upload and upload docker-compose.yml
  5. Add environment variables in the Environment variables section:
    • DISCORD_TOKEN: Your Discord bot token
    • WHISPER_MODEL_SIZE: small (or tiny/base/medium/large)
    • LOG_LEVEL: INFO
  6. Click Deploy the stack

Method 2: Using Git Repository

  1. In Portainer, go to StacksAdd stack
  2. Choose Repository
  3. Enter your Git repository URL
  4. Set compose path: docker-compose.yml
  5. Add environment variables
  6. Click Deploy the stack

Configuration

All configuration is done via environment variables in .env:

  • DISCORD_TOKEN: Your Discord bot token (required)
  • WHISPER_MODEL_SIZE: Model size for speech recognition (tiny/small/base/medium/large)
  • LOG_LEVEL: Logging level (DEBUG/INFO/WARNING/ERROR)
  • TRANSCRIPT_LOG_ENABLED: Enable transcript logging (true/false)
  • HOTWORD_ENABLED: Enable hotword detection (true/false)
  • GOODBOY_USER_ID: Special user ID for goodboy audio

Volumes

  • ./logs: Bot and transcript logs
  • ./data: Persistent data
  • whisper-models: Cached Whisper AI models

Commands

# Start the bot
docker-compose up -d

# Stop the bot
docker-compose down

# View logs
docker-compose logs -f

# Restart the bot
docker-compose restart

# Rebuild after code changes
docker-compose up -d --build

# Remove everything including volumes
docker-compose down -v

Troubleshooting

Bot won't start:

  • Check logs: docker-compose logs basharbot
  • Verify DISCORD_TOKEN is set correctly in .env

Audio issues:

  • Ensure ffmpeg is installed in container (included in Dockerfile)
  • Check opus library is available

High memory usage:

  • Use smaller Whisper model: WHISPER_MODEL_SIZE=tiny
  • Reduce model compute type in stt.py

Updates

To update the bot:

git pull
docker-compose up -d --build