#!/bin/bash set -e echo "=========================================" echo "Test Artifact Data Lake - Production Build" echo "=========================================" echo "" # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "Error: Node.js is not installed. Please install Node.js 18+ first." exit 1 fi # Check if Docker is installed if ! command -v docker &> /dev/null; then echo "Error: Docker is not installed. Please install Docker first." exit 1 fi # Check if Docker Compose is installed if ! command -v docker-compose &> /dev/null; then echo "Error: Docker Compose is not installed. Please install Docker Compose first." exit 1 fi # Create .env file if it doesn't exist if [ ! -f .env ]; then echo "Creating .env file from .env.example..." cp .env.example .env echo "✓ .env file created" else echo "✓ .env file already exists" fi echo "" echo "=========================================" echo "Building Angular Frontend..." echo "=========================================" echo "" cd frontend # Install dependencies if node_modules doesn't exist if [ ! -d "node_modules" ]; then echo "Installing frontend dependencies..." npm install fi # Build the Angular app for production echo "Building Angular app for production..." npm run build if [ $? -ne 0 ]; then echo "Error: Frontend build failed. Please check the errors above." exit 1 fi echo "✓ Frontend built successfully" cd .. echo "" echo "=========================================" echo "Starting Docker Services..." echo "=========================================" echo "" docker-compose -f docker-compose.production.yml up -d echo "" echo "Waiting for services to be ready..." sleep 15 echo "" echo "=========================================" echo "Services are running!" echo "=========================================" echo "" echo "Frontend (UI): http://localhost:80" echo "API: http://localhost:8000" echo "API Docs: http://localhost:8000/docs" echo "MinIO Console: http://localhost:9001" echo " Username: minioadmin" echo " Password: minioadmin" echo "" echo "To view logs: docker-compose -f docker-compose.production.yml logs -f" echo "To stop: docker-compose -f docker-compose.production.yml down" echo "" echo "NOTE: The main application UI is now available at http://localhost:80" echo " This is an Angular application with Material Design components." echo "" # Test health endpoint sleep 5 if curl -s http://localhost:8000/health | grep -q "healthy"; then echo "✓ API is healthy!" echo "" echo "=========================================" echo "Setup complete! 🚀" echo "=========================================" else echo "⚠ API is not responding yet. Please wait a moment and check http://localhost:80" fi