- Support both docker-compose (v1) and docker compose (v2) commands - Auto-detect available Docker Compose version - Enhanced requirement checking with better version detection - Update all scripts to use dynamic Docker Compose command - Fixes compatibility with modern Docker Desktop installations
114 lines
No EOL
3.5 KiB
Bash
Executable file
114 lines
No EOL
3.5 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")/.."
|
|
|
|
# Determine which Docker Compose command to use
|
|
if command -v docker-compose &> /dev/null; then
|
|
DOCKER_COMPOSE="docker-compose"
|
|
else
|
|
DOCKER_COMPOSE="docker compose"
|
|
fi
|
|
|
|
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 |