Some checks failed
CI/CD Pipeline / Backend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Build Backend (push) Has been cancelled
CI/CD Pipeline / Build Frontend (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Performance Tests (push) Has been cancelled
CI/CD Pipeline / Dependency Updates (push) Has been cancelled
- Updated Anthropic API to latest version (2024-01-01) - Set Claude 3.7 Sonnet Latest as primary model - Removed deprecated Opus 3.5 references - Fixed LLM response validation and JSON parsing - Improved error handling and logging - Updated model configurations and pricing - Enhanced document processing reliability - Fixed TypeScript type issues - Updated environment configuration
184 lines
5.6 KiB
Bash
Executable File
184 lines
5.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Comprehensive Firebase Deployment Script
|
|
# This script sets up and deploys the CIM Document Processor to Firebase Functions
|
|
|
|
set -e # Exit on any error
|
|
|
|
echo "🚀 Starting comprehensive Firebase deployment..."
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to print colored output
|
|
print_status() {
|
|
echo -e "${BLUE}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_success() {
|
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Check if we're in the right directory
|
|
if [ ! -f "firebase.json" ]; then
|
|
print_error "firebase.json not found. Please run this script from the project root."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if Firebase CLI is installed
|
|
if ! command -v firebase &> /dev/null; then
|
|
print_error "Firebase CLI is not installed. Please install it first:"
|
|
echo "npm install -g firebase-tools"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if user is logged in to Firebase
|
|
if ! firebase projects:list &> /dev/null; then
|
|
print_error "Not logged in to Firebase. Please run:"
|
|
echo "firebase login"
|
|
exit 1
|
|
fi
|
|
|
|
print_status "Setting up Firebase Functions environment variables..."
|
|
|
|
# Set critical environment variables for Firebase Functions
|
|
print_status "Setting Firebase project configuration..."
|
|
firebase use cim-summarizer-testing
|
|
|
|
print_status "Setting environment variables..."
|
|
|
|
# Core configuration
|
|
firebase functions:config:set project.id="cim-summarizer-testing"
|
|
firebase functions:config:set project.environment="testing"
|
|
|
|
# Supabase configuration (these will be set via environment variables in firebase.json)
|
|
print_warning "Supabase configuration will be set via firebase.json environmentVariables"
|
|
|
|
# Google Cloud configuration
|
|
firebase functions:config:set gcloud.project_id="cim-summarizer-testing"
|
|
firebase functions:config:set gcloud.location="us"
|
|
firebase functions:config:set gcloud.gcs_bucket="cim-processor-testing-uploads"
|
|
firebase functions:config:set gcloud.output_bucket="cim-processor-testing-processed"
|
|
|
|
# LLM configuration
|
|
firebase functions:config:set llm.provider="anthropic"
|
|
firebase functions:config:set llm.model="claude-3-7-sonnet-20250219"
|
|
firebase functions:config:set llm.max_tokens="4000"
|
|
firebase functions:config:set llm.temperature="0.1"
|
|
|
|
# Agentic RAG configuration
|
|
firebase functions:config:set agentic_rag.enabled="true"
|
|
firebase functions:config:set agentic_rag.max_agents="6"
|
|
firebase functions:config:set agentic_rag.parallel_processing="true"
|
|
firebase functions:config:set agentic_rag.validation_strict="true"
|
|
firebase functions:config:set agentic_rag.retry_attempts="3"
|
|
firebase functions:config:set agentic_rag.timeout_per_agent="60000"
|
|
|
|
# Processing configuration
|
|
firebase functions:config:set processing.strategy="document_ai_agentic_rag"
|
|
firebase functions:config:set processing.enable_rag="true"
|
|
firebase functions:config:set processing.enable_comparison="false"
|
|
|
|
# Security configuration
|
|
firebase functions:config:set security.jwt_secret="default-jwt-secret-change-in-production"
|
|
firebase functions:config:set security.jwt_refresh_secret="default-refresh-secret-change-in-production"
|
|
firebase functions:config:set security.rate_limit_max_requests="1000"
|
|
firebase functions:config:set security.rate_limit_window_ms="900000"
|
|
|
|
# Logging configuration
|
|
firebase functions:config:set logging.level="debug"
|
|
firebase functions:config:set logging.file="logs/testing.log"
|
|
|
|
print_success "Environment variables configured"
|
|
|
|
# Build the backend
|
|
print_status "Building backend..."
|
|
cd backend
|
|
|
|
# Install dependencies if needed
|
|
if [ ! -d "node_modules" ]; then
|
|
print_status "Installing backend dependencies..."
|
|
npm install
|
|
fi
|
|
|
|
# Build TypeScript
|
|
print_status "Building TypeScript..."
|
|
npm run build
|
|
|
|
cd ..
|
|
|
|
# Build the frontend
|
|
print_status "Building frontend..."
|
|
cd frontend
|
|
|
|
# Install dependencies if needed
|
|
if [ ! -d "node_modules" ]; then
|
|
print_status "Installing frontend dependencies..."
|
|
npm install
|
|
fi
|
|
|
|
# Build frontend
|
|
print_status "Building frontend..."
|
|
npm run build
|
|
|
|
cd ..
|
|
|
|
# Deploy to Firebase
|
|
print_status "Deploying to Firebase Functions..."
|
|
firebase deploy --only functions
|
|
|
|
print_success "Firebase Functions deployed successfully!"
|
|
|
|
# Deploy hosting if configured
|
|
if [ -f "frontend/dist/index.html" ]; then
|
|
print_status "Deploying frontend to Firebase Hosting..."
|
|
firebase deploy --only hosting
|
|
print_success "Frontend deployed successfully!"
|
|
fi
|
|
|
|
# Show deployment information
|
|
print_status "Deployment completed!"
|
|
echo ""
|
|
echo "🌐 Firebase Functions URL: https://us-central1-cim-summarizer-testing.cloudfunctions.net/api"
|
|
echo "📊 Firebase Console: https://console.firebase.google.com/project/cim-summarizer-testing"
|
|
echo "🔧 Functions Logs: firebase functions:log"
|
|
echo ""
|
|
|
|
# Test the deployment
|
|
print_status "Testing deployment..."
|
|
sleep 5 # Wait for deployment to be ready
|
|
|
|
# Test health endpoint
|
|
HEALTH_URL="https://us-central1-cim-summarizer-testing.cloudfunctions.net/api/health"
|
|
print_status "Testing health endpoint: $HEALTH_URL"
|
|
|
|
if curl -s "$HEALTH_URL" | grep -q "healthy"; then
|
|
print_success "Health check passed!"
|
|
else
|
|
print_warning "Health check failed. Check the logs: firebase functions:log"
|
|
fi
|
|
|
|
print_success "🎉 Deployment completed successfully!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Set up your Supabase database and update the environment variables"
|
|
echo "2. Configure your Google Cloud Document AI processor"
|
|
echo "3. Set up your LLM API keys"
|
|
echo "4. Test the application"
|
|
echo ""
|
|
echo "For troubleshooting, check:"
|
|
echo "- firebase functions:log"
|
|
echo "- firebase functions:config:get"
|