- Add volume cleanup to simple-setup.sh to prevent database password issues - Fix chat API sendStreamingMessage to include Authorization header and userId - Ensure fresh database initialization on every deployment - Chat should now work properly with authentication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
169 lines
No EOL
4.7 KiB
Bash
Executable file
169 lines
No EOL
4.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Ideas Generator 2025 - Simple Setup Script
|
|
# Ultra-reliable version with visible prompts
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m'
|
|
|
|
echo ""
|
|
echo -e "${GREEN}🚀 Ideas Generator 2025 - Simple Docker Setup${NC}"
|
|
echo ""
|
|
echo "This will create your Docker deployment with a few simple questions."
|
|
echo ""
|
|
echo -n "Press Enter to continue... "
|
|
read
|
|
|
|
# Check Docker
|
|
if ! command -v docker &> /dev/null; then
|
|
echo -e "${RED}Error: Docker not found. Please install Docker first.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
if command -v docker-compose &> /dev/null; then
|
|
COMPOSE="docker-compose"
|
|
elif docker compose version &> /dev/null; then
|
|
COMPOSE="docker compose"
|
|
else
|
|
echo -e "${RED}Error: Docker Compose not found. Please install Docker Compose.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${CYAN}━━━ 🌐 Basic Configuration ━━━${NC}"
|
|
echo ""
|
|
|
|
echo -n "What domain will you use? [localhost]: "
|
|
read DOMAIN
|
|
if [ -z "$DOMAIN" ]; then
|
|
DOMAIN="localhost"
|
|
fi
|
|
echo "Using domain: $DOMAIN"
|
|
|
|
echo ""
|
|
echo -n "What HTTP port to use? [8080]: "
|
|
read HTTP_PORT
|
|
if [ -z "$HTTP_PORT" ]; then
|
|
HTTP_PORT="8080"
|
|
fi
|
|
echo "Using port: $HTTP_PORT"
|
|
|
|
echo ""
|
|
echo -e "${CYAN}━━━ 🤖 OpenAI Configuration ━━━${NC}"
|
|
echo ""
|
|
echo "You need an OpenAI API key to use the AI features."
|
|
echo "Get one from: https://platform.openai.com/api-keys"
|
|
echo ""
|
|
|
|
while [ -z "$OPENAI_API_KEY" ]; do
|
|
echo -n "Enter your OpenAI API Key: "
|
|
read -s OPENAI_API_KEY
|
|
echo ""
|
|
if [ -z "$OPENAI_API_KEY" ]; then
|
|
echo -e "${RED}OpenAI API Key is required! Please enter a valid key.${NC}"
|
|
echo ""
|
|
fi
|
|
done
|
|
echo "✅ OpenAI API Key set"
|
|
|
|
echo ""
|
|
echo -e "${CYAN}━━━ 📝 Generating Configuration ━━━${NC}"
|
|
echo ""
|
|
|
|
# Generate secure passwords
|
|
DB_PASSWORD=$(openssl rand -base64 20 2>/dev/null || echo "secure-db-password-$(date +%s)")
|
|
JWT_SECRET=$(openssl rand -base64 40 2>/dev/null || echo "jwt-secret-$(date +%s)-make-this-longer-and-more-secure")
|
|
|
|
echo "Creating .env configuration file..."
|
|
|
|
cat > .env << EOF
|
|
# Ideas Generator 2025 - Docker Configuration
|
|
# Generated: $(date)
|
|
|
|
# Basic Configuration
|
|
DOMAIN_NAME=$DOMAIN
|
|
HTTP_PORT=$HTTP_PORT
|
|
HTTPS_PORT=443
|
|
|
|
# Database Configuration
|
|
DATABASE_NAME=ideas_gen_prod
|
|
DATABASE_USER=ideas_admin
|
|
DATABASE_PASSWORD=$DB_PASSWORD
|
|
|
|
# Security Configuration
|
|
JWT_SECRET=$JWT_SECRET
|
|
|
|
# Azure AD Configuration (Oliver Agency)
|
|
AZURE_TENANT_ID=e519c2e6-bc6d-4fdf-8d9c-923c2f002385
|
|
AZURE_CLIENT_ID=9079054c-9620-4757-a256-23413042f1ef
|
|
|
|
# OpenAI Configuration
|
|
OPENAI_API_KEY=$OPENAI_API_KEY
|
|
|
|
# URL Configuration
|
|
FRONTEND_URL=http://$DOMAIN:$HTTP_PORT
|
|
BACKEND_URL=http://$DOMAIN:$HTTP_PORT/api
|
|
CORS_ORIGIN=http://$DOMAIN:$HTTP_PORT,http://localhost:$HTTP_PORT
|
|
|
|
# SSL Configuration (for production)
|
|
SSL_CERT_PATH=./certs
|
|
EOF
|
|
|
|
echo "✅ Configuration saved to .env"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}📋 Important Information:${NC}"
|
|
echo -e "${YELLOW} After deployment, you can login with:${NC}"
|
|
echo -e "${CYAN} Email: admin@oliver.agency${NC}"
|
|
echo -e "${CYAN} Password: admin123${NC}"
|
|
echo -e "${YELLOW} The database will be automatically initialized on first start.${NC}"
|
|
echo ""
|
|
|
|
echo ""
|
|
echo -e "${CYAN}━━━ 🚀 Starting Docker Deployment ━━━${NC}"
|
|
echo ""
|
|
echo "This will download and build the Docker containers."
|
|
echo "First time may take 5-10 minutes depending on your internet speed."
|
|
echo ""
|
|
echo -n "Ready to start? Press Enter to continue... "
|
|
read
|
|
|
|
echo "Starting deployment..."
|
|
echo ""
|
|
|
|
# Clean up any existing volumes first (ensures fresh database)
|
|
echo "Cleaning up any existing Docker volumes..."
|
|
$COMPOSE down --volumes 2>/dev/null || true
|
|
docker system prune -f >/dev/null 2>&1 || true
|
|
|
|
# Start the deployment
|
|
$COMPOSE up -d --build
|
|
|
|
echo ""
|
|
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
echo -e "${GREEN}🎉 DEPLOYMENT COMPLETE! 🎉${NC}"
|
|
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
echo ""
|
|
echo -e "${CYAN}🌐 Your Ideas Generator 2025 is now running at:${NC}"
|
|
echo -e "${YELLOW} http://$DOMAIN:$HTTP_PORT${NC}"
|
|
echo ""
|
|
echo -e "${BLUE}📊 Service Status:${NC}"
|
|
$COMPOSE ps
|
|
|
|
echo ""
|
|
echo -e "${BLUE}📋 Useful Commands:${NC}"
|
|
echo -e " View logs: ${CYAN}$COMPOSE logs -f${NC}"
|
|
echo -e " Stop all: ${CYAN}$COMPOSE down${NC}"
|
|
echo -e " Restart: ${CYAN}$COMPOSE restart${NC}"
|
|
echo -e " Rebuild: ${CYAN}$COMPOSE up -d --build${NC}"
|
|
|
|
echo ""
|
|
echo -e "${GREEN}✨ Setup Complete! Open your browser to the URL above! ✨${NC}"
|
|
echo "" |