Add comprehensive Docker setup with PostgreSQL, Redis, ChromaDB, and Qdrant

- Enhanced install.py with Docker detection and automatic service setup
- Added docker-compose.services.yml for standalone database services
- Created docker-services.sh management script for easy service control
- Added DOCKER.md documentation with complete setup instructions
- Updated requirements.txt for Python 3.13 compatibility
- Added multiple test scripts and configuration files
- Enhanced collaborative creative projects with proper database integration
- Fixed SQLAlchemy metadata field conflicts in database models
- Added comprehensive quickstart and testing guides

Services now available:
- PostgreSQL with Docker
- Redis with Docker
- ChromaDB vector database
- Qdrant vector database (recommended)
- PgAdmin for database administration

The setup script now automatically detects Docker and offers streamlined
installation with one-command service deployment.
This commit is contained in:
2025-07-05 10:01:41 -07:00
parent 1b586582d4
commit 824b118e93
29 changed files with 2738 additions and 92 deletions

204
DOCKER.md Normal file
View File

@@ -0,0 +1,204 @@
# 🐳 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/)