-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-firebase.sh
More file actions
103 lines (82 loc) · 2.72 KB
/
Copy pathdeploy-firebase.sh
File metadata and controls
103 lines (82 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Firebase Deployment Script for SentinelAI MVP
# This script handles the complete deployment process
set -e # Exit on any error
echo "🚀 Starting Firebase Deployment for SentinelAI MVP"
echo "=================================================="
# Check if Firebase CLI is installed
if ! command -v firebase &> /dev/null; then
echo "❌ Firebase CLI not found. Installing..."
npm install -g firebase-tools
fi
# Check if user is logged in to Firebase
if ! firebase projects:list &> /dev/null; then
echo "🔐 Please login to Firebase:"
firebase login
fi
# Step 1: Build Frontend for Firebase
echo ""
echo "📦 Building Frontend for Firebase..."
cd Frontend
# Install dependencies
echo "📥 Installing frontend dependencies..."
npm install
# Build with Firebase configuration
echo "🔨 Building Next.js app for Firebase..."
cp next.config.firebase.js next.config.js
npm run build
# Verify build
if [ ! -d "out" ]; then
echo "❌ Build failed - 'out' directory not found"
exit 1
fi
echo "✅ Frontend build completed"
cd ..
# Step 2: Prepare Backend for Firebase Functions
echo ""
echo "🔧 Preparing Backend for Firebase Functions..."
cd Backend
# Create functions directory if it doesn't exist
mkdir -p functions
# Copy main Firebase function
echo "📋 Copying Firebase functions..."
cp main_firebase.py functions/main.py
# Copy requirements
echo "📋 Copying requirements..."
cp requirements-firebase.txt functions/requirements.txt
# Create __init__.py
touch functions/__init__.py
echo "✅ Backend preparation completed"
cd ..
# Step 3: Deploy to Firebase
echo ""
echo "🌍 Deploying to Firebase..."
# Deploy functions first
echo "⚡ Deploying Firebase Functions..."
firebase deploy --only functions
# Deploy hosting
echo "🌐 Deploying Firebase Hosting..."
firebase deploy --only hosting
# Full deployment
echo "🚀 Full Firebase deployment..."
firebase deploy
echo ""
echo "✅ Firebase Deployment Completed Successfully!"
echo "=================================================="
echo ""
echo "📱 Your SentinelAI MVP is now live at:"
echo " https://sentinelai-mvp.web.app"
echo " https://sentinelai-mvp.firebaseapp.com"
echo ""
echo "⚡ Backend Functions URL:"
echo " https://us-central1-sentinelai-mvp.cloudfunctions.net"
echo ""
echo "🔧 API Endpoints:"
echo " - Health Check: https://us-central1-sentinelai-mvp.cloudfunctions.net/health_check"
echo " - Analyze: https://us-central1-sentinelai-mvp.cloudfunctions.net/analyze_external"
echo " - Settings: https://us-central1-sentinelai-mvp.cloudfunctions.net/get_settings"
echo ""
echo "📊 Firebase Console:"
echo " https://console.firebase.google.com/project/sentinelai-mvp"
echo ""
echo "🎉 Your SentinelAI MVP is now live on Firebase!"