# 🐳 Docker Setup for Discord Fishbowl This document explains how to use Docker with Discord Fishbowl for easy PostgreSQL, Redis, and ChromaDB setup. ## 🚀 Quick Start ### Option 1: Interactive Setup (Recommended) ```bash python install.py # Choose "PostgreSQL with Docker" when prompted # Setup script will handle everything automatically ``` ### Option 2: Manual Docker Setup ```bash # Start services ./docker-services.sh start # Or with PgAdmin for database management ./docker-services.sh admin ``` ## 📋 Available Services | Service | Port | Purpose | Admin URL | |---------|------|---------|-----------| | PostgreSQL | 5432 | Main database | - | | Redis | 6379 | Caching & pub/sub | - | | ChromaDB | 8000 | Vector embeddings | http://localhost:8000 | | PgAdmin | 8080 | Database admin | http://localhost:8080 | ## 🔧 Docker Commands ### Service Management ```bash # Start all services ./docker-services.sh start # Start with database admin interface ./docker-services.sh admin # Check service status ./docker-services.sh status # View logs ./docker-services.sh logs # Stop services ./docker-services.sh stop # Restart services ./docker-services.sh restart # Clean up (WARNING: deletes all data) ./docker-services.sh clean ``` ### Direct Docker Compose ```bash # Start services only docker compose -f docker-compose.services.yml up -d # Start with PgAdmin docker compose -f docker-compose.services.yml --profile admin up -d # Stop services docker compose -f docker-compose.services.yml down # View logs docker compose -f docker-compose.services.yml logs -f ``` ## 🔑 Default Credentials ### PostgreSQL - **Host**: localhost:5432 - **Database**: discord_fishbowl - **Username**: postgres - **Password**: fishbowl_password (configurable) ### Redis - **Host**: localhost:6379 - **Password**: redis_password (configurable) ### PgAdmin (if using admin profile) - **URL**: http://localhost:8080 - **Email**: admin@fishbowl.dev - **Password**: admin123 ## 📁 File Structure ``` discord_fishbowl/ ├── docker-compose.yml # Full application stack ├── docker-compose.services.yml # Services only (recommended) ├── docker-services.sh # Management script ├── .env.docker # Docker environment variables └── DOCKER.md # This file ``` ## 🔧 Configuration ### Environment Variables (.env.docker) ```bash # Database DB_PASSWORD=your_secure_password # Redis REDIS_PASSWORD=your_redis_password # PgAdmin (optional) PGADMIN_PASSWORD=admin123 ``` ### Connecting Discord Fishbowl to Docker Services When using Docker services, update your Discord Fishbowl configuration: **config/fishbowl_config.json**: ```json { "database": { "type": "postgresql", "host": "localhost", "port": 5432, "name": "discord_fishbowl", "username": "postgres", "password": "fishbowl_password" }, "redis": { "enabled": true, "host": "localhost", "port": 6379, "password": "redis_password" }, "vector_db": { "type": "chromadb", "host": "localhost", "port": 8000 } } ``` ## 🐛 Troubleshooting ### Services Won't Start 1. Check if Docker is running: `docker info` 2. Check port conflicts: `lsof -i :5432` (PostgreSQL), `lsof -i :6379` (Redis) 3. Check logs: `./docker-services.sh logs` ### Permission Errors ```bash # Fix Docker permissions (macOS/Linux) sudo chmod +x docker-services.sh ``` ### Data Persistence - PostgreSQL data: Docker volume `fishbowl_postgres_data` - Redis data: Docker volume `fishbowl_redis_data` - ChromaDB data: Docker volume `fishbowl_chroma_data` To backup data: ```bash # Backup PostgreSQL docker exec fishbowl_postgres pg_dump -U postgres discord_fishbowl > backup.sql # Restore PostgreSQL docker exec -i fishbowl_postgres psql -U postgres discord_fishbowl < backup.sql ``` ### Reset Everything ```bash # Stop and remove all data (WARNING: destructive) ./docker-services.sh clean # Restart fresh ./docker-services.sh start ``` ## 🔗 Integration with Install Script The `install.py` script automatically: 1. Detects Docker availability 2. Offers Docker-based setup options 3. Creates `.env.docker` with your passwords 4. Starts services automatically 5. Configures Discord Fishbowl to use Docker services ## 🎯 Production Deployment For production, consider: 1. Using the full `docker-compose.yml` (includes the app) 2. Setting strong passwords in environment variables 3. Using Docker secrets for sensitive data 4. Setting up proper network security 5. Regular backups of volumes ## 📚 Additional Resources - [Docker Documentation](https://docs.docker.com/) - [Docker Compose Documentation](https://docs.docker.com/compose/) - [PostgreSQL Docker Image](https://hub.docker.com/_/postgres) - [Redis Docker Image](https://hub.docker.com/_/redis) - [ChromaDB Documentation](https://docs.trychroma.com/)