#!/bin/bash echo "==========================================" echo " Movie Scheduler - Test Environment" echo "==========================================" echo "" # Make scripts executable chmod +x init-data.sh start-scheduler.sh 2>/dev/null || true # Check if docker compose is available if ! command -v docker &> /dev/null; then echo "✗ Docker is not installed!" echo "Please install Docker first: https://docs.docker.com/get-docker/" exit 1 fi if docker compose version &> /dev/null; then COMPOSE_CMD="docker compose" elif docker-compose --version &> /dev/null; then COMPOSE_CMD="docker-compose" else echo "✗ Docker Compose is not installed!" echo "Please install Docker Compose first" exit 1 fi echo "✓ Using: $COMPOSE_CMD" echo "" # Stop any existing containers echo "Stopping any existing containers..." $COMPOSE_CMD down 2>/dev/null || true # Build and start all services echo "" echo "Building and starting all services..." echo "This may take a few minutes on first run..." echo "" $COMPOSE_CMD up --build -d echo "" echo "==========================================" echo " Waiting for services to initialize..." echo "==========================================" echo "" # Wait for init to complete echo "Waiting for initialization to complete (this may take 30-60 seconds)..." sleep 5 # Follow init logs echo "" echo "--- Initialization Progress ---" $COMPOSE_CMD logs -f init & LOGS_PID=$! # Wait for init to complete while true; do STATUS=$($COMPOSE_CMD ps init --format json 2>/dev/null | jq -r '.[0].State' 2>/dev/null || echo "unknown") if [ "$STATUS" = "exited" ]; then kill $LOGS_PID 2>/dev/null || true wait $LOGS_PID 2>/dev/null || true echo "" echo "✓ Initialization completed!" break fi sleep 2 done echo "" echo "==========================================" echo " Test Environment Ready!" echo "==========================================" echo "" echo "📺 NocoDB Dashboard:" echo " URL: http://localhost:8080" echo " Email: admin@test.com" echo " Password: admin123" echo "" echo "📡 RTMP Server:" echo " Stream URL: rtmp://localhost:1935/live/stream" echo " Statistics: http://localhost:8081/stat" echo "" echo "🎬 Scheduler:" echo " Status: Running" echo " Database: ./scheduler.db" echo "" echo "==========================================" echo " Useful Commands:" echo "==========================================" echo "" echo "View scheduler logs:" echo " $COMPOSE_CMD logs -f scheduler" echo "" echo "View all logs:" echo " $COMPOSE_CMD logs -f" echo "" echo "Check service status:" echo " $COMPOSE_CMD ps" echo "" echo "Stop all services:" echo " $COMPOSE_CMD down" echo "" echo "Stop and remove all data:" echo " $COMPOSE_CMD down -v" echo "" echo "==========================================" echo "" echo "The scheduler is now monitoring NocoDB for movies to process." echo "A test movie 'BigBuckBunny' has been added and will be" echo "processed 6 hours before its scheduled time." echo "" echo "To watch the stream, use a player like VLC:" echo " vlc rtmp://localhost:1935/live/stream" echo ""