- Update docker-start.sh to force correct profiles (qdrant, admin) - Fix PostgreSQL port mapping from 5432 to 15432 across all configs - Resolve MCP import conflicts by renaming src/mcp to src/mcp_servers - Fix admin interface StaticFiles mount syntax error - Update LLM client to support both Ollama and OpenAI-compatible APIs - Configure host networking for Discord bot container access - Correct database connection handling for async context managers - Update environment variables and Docker compose configurations - Add missing production dependencies and Dockerfile improvements
232 lines
6.2 KiB
Bash
Executable File
232 lines
6.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Discord Fishbowl Docker Services Management Script
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
COMPOSE_FILE="docker-compose.services.yml"
|
|
ENV_FILE=".env.docker"
|
|
|
|
print_usage() {
|
|
echo "Discord Fishbowl Docker Services Manager"
|
|
echo ""
|
|
echo "Usage: $0 {start|stop|restart|status|logs|admin|chromadb|qdrant|clean}"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " start - Start PostgreSQL and Redis services"
|
|
echo " stop - Stop all services"
|
|
echo " restart - Restart all services"
|
|
echo " status - Show service status"
|
|
echo " logs - Show service logs"
|
|
echo " admin - Start with PgAdmin (database admin interface)"
|
|
echo " chromadb - Start with ChromaDB vector database"
|
|
echo " qdrant - Start with Qdrant vector database"
|
|
echo " clean - Stop services and remove volumes (WARNING: deletes data)"
|
|
echo ""
|
|
}
|
|
|
|
check_requirements() {
|
|
if ! command -v docker &> /dev/null; then
|
|
echo -e "${RED}Error: Docker is not installed${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
if ! docker compose version &> /dev/null; then
|
|
echo -e "${RED}Error: Docker Compose is not available${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$COMPOSE_FILE" ]; then
|
|
echo -e "${RED}Error: $COMPOSE_FILE not found${NC}"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
start_services() {
|
|
echo -e "${GREEN}🐠 Starting Discord Fishbowl services...${NC}"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo -e "${YELLOW}Creating default environment file...${NC}"
|
|
cat > "$ENV_FILE" << EOF
|
|
# Default Docker environment
|
|
DB_PASSWORD=fishbowl_password
|
|
REDIS_PASSWORD=redis_password
|
|
PGADMIN_PASSWORD=admin123
|
|
EOF
|
|
fi
|
|
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" up -d
|
|
|
|
echo -e "${GREEN}✅ Services started successfully!${NC}"
|
|
echo ""
|
|
echo "Services available at:"
|
|
echo " 📊 PostgreSQL: localhost:15432"
|
|
echo " 🔴 Redis: localhost:6379"
|
|
echo ""
|
|
echo "Run '$0 status' to check service health"
|
|
echo "Use '$0 chromadb' or '$0 qdrant' to add vector database"
|
|
}
|
|
|
|
start_with_admin() {
|
|
echo -e "${GREEN}🐠 Starting Discord Fishbowl services with PgAdmin...${NC}"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo -e "${YELLOW}Creating default environment file...${NC}"
|
|
cat > "$ENV_FILE" << EOF
|
|
# Default Docker environment
|
|
DB_PASSWORD=fishbowl_password
|
|
REDIS_PASSWORD=redis_password
|
|
PGADMIN_PASSWORD=admin123
|
|
EOF
|
|
fi
|
|
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" --profile admin up -d
|
|
|
|
echo -e "${GREEN}✅ Services started successfully!${NC}"
|
|
echo ""
|
|
echo "Services available at:"
|
|
echo " 📊 PostgreSQL: localhost:15432"
|
|
echo " 🔴 Redis: localhost:6379"
|
|
echo " 🧠 ChromaDB: http://localhost:8000"
|
|
echo " 🌐 PgAdmin: http://localhost:8080"
|
|
echo " Login: admin@fishbowl.dev / admin123"
|
|
echo ""
|
|
}
|
|
|
|
start_with_chromadb() {
|
|
echo -e "${GREEN}🐠 Starting Discord Fishbowl services with ChromaDB...${NC}"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo -e "${YELLOW}Creating default environment file...${NC}"
|
|
cat > "$ENV_FILE" << EOF
|
|
# Default Docker environment
|
|
DB_PASSWORD=fishbowl_password
|
|
REDIS_PASSWORD=redis_password
|
|
PGADMIN_PASSWORD=admin123
|
|
EOF
|
|
fi
|
|
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" --profile chromadb up -d
|
|
|
|
echo -e "${GREEN}✅ Services started successfully!${NC}"
|
|
echo ""
|
|
echo "Services available at:"
|
|
echo " 📊 PostgreSQL: localhost:15432"
|
|
echo " 🔴 Redis: localhost:6379"
|
|
echo " 🧠 ChromaDB: http://localhost:8000"
|
|
echo ""
|
|
}
|
|
|
|
start_with_qdrant() {
|
|
echo -e "${GREEN}🐠 Starting Discord Fishbowl services with Qdrant...${NC}"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo -e "${YELLOW}Creating default environment file...${NC}"
|
|
cat > "$ENV_FILE" << EOF
|
|
# Default Docker environment
|
|
DB_PASSWORD=fishbowl_password
|
|
REDIS_PASSWORD=redis_password
|
|
PGADMIN_PASSWORD=admin123
|
|
EOF
|
|
fi
|
|
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" --profile qdrant up -d
|
|
|
|
echo -e "${GREEN}✅ Services started successfully!${NC}"
|
|
echo ""
|
|
echo "Services available at:"
|
|
echo " 📊 PostgreSQL: localhost:15432"
|
|
echo " 🔴 Redis: localhost:6379"
|
|
echo " 🔍 Qdrant: http://localhost:6333"
|
|
echo " Dashboard: http://localhost:6333/dashboard"
|
|
echo ""
|
|
}
|
|
|
|
stop_services() {
|
|
echo -e "${YELLOW}🛑 Stopping Discord Fishbowl services...${NC}"
|
|
docker compose -f "$COMPOSE_FILE" down
|
|
echo -e "${GREEN}✅ Services stopped${NC}"
|
|
}
|
|
|
|
restart_services() {
|
|
stop_services
|
|
sleep 2
|
|
start_services
|
|
}
|
|
|
|
show_status() {
|
|
echo -e "${GREEN}📊 Discord Fishbowl Service Status${NC}"
|
|
echo ""
|
|
docker compose -f "$COMPOSE_FILE" ps
|
|
echo ""
|
|
|
|
# Check health
|
|
echo "Health checks:"
|
|
for service in postgres redis chromadb; do
|
|
if docker compose -f "$COMPOSE_FILE" ps --services --filter "status=running" | grep -q "$service"; then
|
|
echo -e " ${GREEN}✅ $service: Running${NC}"
|
|
else
|
|
echo -e " ${RED}❌ $service: Not running${NC}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
show_logs() {
|
|
echo -e "${GREEN}📋 Service Logs${NC}"
|
|
docker compose -f "$COMPOSE_FILE" logs -f
|
|
}
|
|
|
|
clean_services() {
|
|
echo -e "${RED}⚠️ WARNING: This will delete all data in PostgreSQL, Redis, and ChromaDB!${NC}"
|
|
read -p "Are you sure? Type 'yes' to continue: " confirm
|
|
|
|
if [ "$confirm" = "yes" ]; then
|
|
echo -e "${YELLOW}🧹 Cleaning up services and data...${NC}"
|
|
docker compose -f "$COMPOSE_FILE" down -v
|
|
echo -e "${GREEN}✅ Cleanup complete${NC}"
|
|
else
|
|
echo -e "${YELLOW}Cleanup cancelled${NC}"
|
|
fi
|
|
}
|
|
|
|
# Main script
|
|
check_requirements
|
|
|
|
case "${1:-}" in
|
|
start)
|
|
start_services
|
|
;;
|
|
stop)
|
|
stop_services
|
|
;;
|
|
restart)
|
|
restart_services
|
|
;;
|
|
status)
|
|
show_status
|
|
;;
|
|
logs)
|
|
show_logs
|
|
;;
|
|
admin)
|
|
start_with_admin
|
|
;;
|
|
chromadb)
|
|
start_with_chromadb
|
|
;;
|
|
qdrant)
|
|
start_with_qdrant
|
|
;;
|
|
clean)
|
|
clean_services
|
|
;;
|
|
*)
|
|
print_usage
|
|
exit 1
|
|
;;
|
|
esac |