.PHONY: help setup install-deps build-dashboard build-functions deploy-local deploy-knative clean logs status # Default target help: @echo "File Transformer S3 - Available Commands:" @echo "" @echo "Setup & Installation:" @echo " setup-full - Full setup with dependency installation (recommended)" @echo " setup - Initial setup (creates .env, installs dependencies)" @echo " install-deps - Install all dependencies" @echo " build-dashboard - Build React dashboard" @echo " build-functions - Build Knative functions" @echo "" @echo "Deployment:" @echo " deploy-local - Deploy locally with Docker Compose" @echo " deploy-knative - Deploy to Knative cluster" @echo " deploy-all - Deploy everything" @echo "" @echo "Management:" @echo " logs - View logs from all services" @echo " status - Check status of all services" @echo " clean - Clean up all resources" @echo " reset-db - Reset PostgreSQL database" @echo "" @echo "Development:" @echo " dev-dashboard - Start dashboard in development mode" @echo " dev-functions - Start functions in development mode" # Environment setup setup: @echo "Setting up File Transformer S3..." @if [ ! -f .env ]; then \ cp .env.example .env; \ echo "Created .env from .env.example"; \ else \ echo ".env already exists"; \ fi @echo "Please edit .env with your configuration values" @make install-deps # Full setup with dependency installation setup-full: @echo "Running full setup with dependency installation..." @./setup.sh # Install dependencies install-deps: @echo "Installing dependencies..." @if command -v npm &> /dev/null; then \ cd dashboard && npm install; \ else \ echo "⚠️ npm not found. Please install Node.js and npm first."; \ echo " Run: ./setup.sh"; \ exit 1; \ fi @if command -v pip3 &> /dev/null; then \ pip3 install -r functions/requirements.txt; \ else \ echo "⚠️ pip3 not found. Please install Python3 and pip first."; \ echo " Run: ./setup.sh"; \ exit 1; \ fi @echo "Dependencies installed successfully" # Build dashboard build-dashboard: @echo "Building React dashboard..." @if command -v npm &> /dev/null; then \ cd dashboard && npm run build; \ else \ echo "⚠️ npm not found. Please install Node.js and npm first."; \ echo " Run: ./setup.sh"; \ exit 1; \ fi @echo "Dashboard built successfully" # Build functions build-functions: @echo "Building Knative functions..." @cd functions && make build @echo "Functions built successfully" # Deploy locally deploy-local: @echo "Deploying locally with Docker Compose..." @docker-compose up -d @echo "Local deployment complete" @echo "Dashboard: http://localhost:$(shell grep REACT_APP_PORT .env | cut -d '=' -f2)" @echo "MinIO Console: http://localhost:$(shell grep MINIO_CONSOLE_PORT .env | cut -d '=' -f2)" # Deploy to Knative deploy-knative: @echo "Deploying to Knative cluster..." @kubectl apply -f k8s/namespace.yaml @kubectl apply -f k8s/postgres.yaml @kubectl apply -f k8s/minio.yaml @kubectl apply -f k8s/functions/ @kubectl apply -f k8s/dashboard.yaml @echo "Knative deployment complete" # Deploy everything deploy-all: build-dashboard build-functions deploy-knative # View logs logs: @echo "Viewing logs from all services..." @docker-compose logs -f # Check status status: @echo "Checking service status..." @docker-compose ps @echo "" @echo "Dashboard: http://localhost:$(shell grep REACT_APP_PORT .env | cut -d '=' -f2)" @echo "MinIO Console: http://localhost:$(shell grep MINIO_CONSOLE_PORT .env | cut -d '=' -f2)" # Clean up clean: @echo "Cleaning up resources..." @docker-compose down -v @docker system prune -f @echo "Cleanup complete" # Reset database reset-db: @echo "Resetting PostgreSQL database..." @docker-compose exec postgres psql -U $(shell grep POSTGRES_USER .env | cut -d '=' -f2) -d $(shell grep POSTGRES_DB .env | cut -d '=' -f2) -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" @docker-compose exec postgres psql -U $(shell grep POSTGRES_USER .env | cut -d '=' -f2) -d $(shell grep POSTGRES_DB .env | cut -d '=' -f2) -f /docker-entrypoint-initdb.d/init.sql @echo "Database reset complete" # Development mode dev-dashboard: @echo "Starting dashboard in development mode..." @if command -v npm &> /dev/null; then \ cd dashboard && npm start; \ else \ echo "⚠️ npm not found. Please install Node.js and npm first."; \ echo " Run: ./setup.sh"; \ exit 1; \ fi dev-functions: @echo "Starting functions in development mode..." @cd functions && python -m flask run --host=0.0.0.0 --port=5000