ideas-generator/docker/scripts/deploy.sh
DJP a8e201dc52 🐳 Complete Docker deployment system with interactive setup
 Production-Ready Containerization:
- Multi-stage frontend build (Vue.js + Nginx)
- Optimized backend container (Node.js + Alpine)
- PostgreSQL 15 with persistent storage and health checks
- Custom Docker network for secure service communication

 Interactive Setup Wizard (setup.sh):
- Beautiful CLI interface with colors and progress indicators
- Automatic secure password and JWT secret generation
- Complete environment configuration with validation
- Domain, SSL, Azure AD, and OpenAI API setup
- One-command deployment with immediate startup option

 Production Security & Performance:
- Nginx reverse proxy with rate limiting and security headers
- HTTPS/SSL support with custom certificate mounting
- CORS protection and request validation
- Non-root container execution for all services
- Health checks and monitoring for reliability

 Management & Operations:
- Comprehensive deploy.sh script with all common operations
- Database backup and restore capabilities
- Service logs management and troubleshooting tools
- Docker Compose orchestration with dependency management
- Development vs production environment support

 Enterprise Features:
- Azure AD SSO integration with hybrid authentication
- OpenAI API configuration and secure key management
- Multi-environment support (localhost vs production)
- Comprehensive documentation and troubleshooting guides
- Resource optimization and performance tuning

🏗️ Architecture:
- Frontend: Vue.js + Vite → Nginx (port 80/443)
- Backend: Node.js + Express (internal port 3000)
- Database: PostgreSQL 15 (internal port 5432)
- Networking: Isolated Docker bridge network
- Storage: Named volumes for data persistence

🚀 Deployment Commands:
- ./setup.sh - Interactive deployment wizard
- ./scripts/deploy.sh [start|stop|build|logs|status]
- docker-compose up -d --build
- Automatic migrations and admin user creation

🔒 Security Hardening:
- Rate limiting on API endpoints (10 req/s) and auth (5 req/min)
- Security headers (X-Frame-Options, CSP, HSTS)
- CORS validation and origin checking
- SSL/TLS encryption support
- Container isolation and minimal attack surface

📚 Complete Documentation:
- Comprehensive README with architecture overview
- Troubleshooting guide with common issues
- Development vs production configuration
- Performance tuning and scaling recommendations

🎯 One-Command Production Deployment:
Everything needed to deploy Ideas Generator 2025 in production
with enterprise security, monitoring, and Azure AD SSO integration.

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 18:00:29 -04:00

107 lines
No EOL
3.4 KiB
Bash
Executable file

#!/bin/bash
# Ideas Generator 2025 - Deployment Management Script
# Simplified deployment commands
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
# Navigate to docker directory
cd "$(dirname "$0")/.."
print_usage() {
echo -e "${BLUE}Ideas Generator 2025 - Deployment Management${NC}"
echo ""
echo "Usage: $0 [command]"
echo ""
echo "Commands:"
echo " start Start all services"
echo " stop Stop all services"
echo " restart Restart all services"
echo " build Build and start with latest changes"
echo " status Show status of all services"
echo " logs Show logs from all services"
echo " logs [service] Show logs from specific service"
echo " shell [service] Open shell in running service"
echo " update Pull latest images and restart"
echo " backup Backup database"
echo " cleanup Remove unused containers and images"
echo ""
}
case "$1" in
start)
echo -e "${GREEN}🚀 Starting Ideas Generator 2025...${NC}"
docker-compose up -d
echo -e "${GREEN}✅ Services started!${NC}"
docker-compose ps
;;
stop)
echo -e "${YELLOW}⏹️ Stopping Ideas Generator 2025...${NC}"
docker-compose down
echo -e "${GREEN}✅ Services stopped!${NC}"
;;
restart)
echo -e "${YELLOW}🔄 Restarting Ideas Generator 2025...${NC}"
docker-compose restart
echo -e "${GREEN}✅ Services restarted!${NC}"
docker-compose ps
;;
build)
echo -e "${BLUE}🏗️ Building and starting Ideas Generator 2025...${NC}"
docker-compose up -d --build
echo -e "${GREEN}✅ Build complete and services started!${NC}"
docker-compose ps
;;
status)
echo -e "${BLUE}📊 Ideas Generator 2025 Status:${NC}"
docker-compose ps
;;
logs)
if [ -n "$2" ]; then
echo -e "${BLUE}📋 Showing logs for $2:${NC}"
docker-compose logs -f "$2"
else
echo -e "${BLUE}📋 Showing logs for all services:${NC}"
docker-compose logs -f
fi
;;
shell)
if [ -n "$2" ]; then
echo -e "${BLUE}🔧 Opening shell in $2:${NC}"
docker-compose exec "$2" sh
else
echo -e "${RED}❌ Please specify a service: backend, frontend, or database${NC}"
exit 1
fi
;;
update)
echo -e "${BLUE}🔄 Updating Ideas Generator 2025...${NC}"
docker-compose pull
docker-compose up -d --build
echo -e "${GREEN}✅ Update complete!${NC}"
docker-compose ps
;;
backup)
echo -e "${BLUE}💾 Creating database backup...${NC}"
BACKUP_FILE="backup_$(date +%Y%m%d_%H%M%S).sql"
docker-compose exec database pg_dump -U ideas_admin ideas_gen_prod > "$BACKUP_FILE"
echo -e "${GREEN}✅ Database backup saved to: $BACKUP_FILE${NC}"
;;
cleanup)
echo -e "${YELLOW}🧹 Cleaning up unused Docker resources...${NC}"
docker system prune -f
docker volume prune -f
echo -e "${GREEN}✅ Cleanup complete!${NC}"
;;
*)
print_usage
exit 1
;;
esac