-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·127 lines (109 loc) · 4.17 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·127 lines (109 loc) · 4.17 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# Rift Deployment Script
# Deploys frontend to Vercel and backend to DigitalOcean
set -e
echo "🚀 Starting Rift Deployment..."
echo ""
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if we're in the right directory
if [ ! -f "PROJECT_STORY.md" ]; then
echo "❌ Please run this script from the root of the Rift repository"
exit 1
fi
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo "${BLUE} Frontend Deployment - Vercel${NC}"
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Deploy frontend
cd frontend
# Check if Vercel CLI is installed
if ! command -v vercel &> /dev/null; then
echo "${YELLOW}⚠️ Vercel CLI not found. Installing...${NC}"
npm install -g vercel
fi
echo "📦 Deploying frontend to Vercel..."
vercel --prod
echo ""
echo "${GREEN}✅ Frontend deployed successfully!${NC}"
echo ""
cd ..
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo "${BLUE} Backend Deployment - DigitalOcean${NC}"
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Check if doctl is installed
if ! command -v doctl &> /dev/null; then
echo "${YELLOW}⚠️ doctl CLI not found.${NC}"
echo ""
echo "Please choose deployment method:"
echo " 1) Install doctl and deploy via CLI"
echo " 2) Deploy manually via DigitalOcean Dashboard"
echo ""
read -p "Enter choice (1 or 2): " choice
if [ "$choice" = "1" ]; then
echo ""
echo "Install doctl:"
echo " macOS: brew install doctl"
echo " Linux: snap install doctl"
echo ""
echo "Then authenticate:"
echo " doctl auth init"
echo ""
echo "Run this script again after installation."
exit 0
else
echo ""
echo "${YELLOW}Manual Deployment Steps:${NC}"
echo ""
echo "1. Go to: https://cloud.digitalocean.com/apps/new"
echo "2. Connect GitHub repo: itisaby/rift"
echo "3. Use configuration from: .do/app.yaml"
echo "4. Add environment variables from: backend/.env"
echo "5. Deploy!"
echo ""
exit 0
fi
fi
echo "🐙 Deploying backend to DigitalOcean App Platform..."
# Check if app already exists
APP_ID=$(doctl apps list --format ID,Spec.Name --no-header | grep "rift-backend" | awk '{print $1}' || echo "")
if [ -z "$APP_ID" ]; then
echo "📝 Creating new app..."
doctl apps create --spec .do/app.yaml
echo ""
echo "${GREEN}✅ Backend app created successfully!${NC}"
echo ""
echo "${YELLOW}⚠️ Remember to add SECRET environment variables in the dashboard:${NC}"
echo " - DIGITALOCEAN_API_TOKEN"
echo " - MONITOR_AGENT_ENDPOINT, KEY, ID"
echo " - DIAGNOSTIC_AGENT_ENDPOINT, KEY, ID"
echo " - REMEDIATION_AGENT_ENDPOINT, KEY, ID"
echo " - PROVISIONER_AGENT_ENDPOINT, KEY, ID"
echo " - KNOWLEDGE_BASE_ID"
echo ""
echo "Dashboard: https://cloud.digitalocean.com/apps"
else
echo "📝 Updating existing app (ID: $APP_ID)..."
doctl apps update $APP_ID --spec .do/app.yaml
echo ""
echo "${GREEN}✅ Backend app updated successfully!${NC}"
fi
echo ""
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo "${GREEN} Deployment Complete!${NC}"
echo "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo "📱 Frontend: Check Vercel dashboard for URL"
echo "🖥️ Backend: Check DigitalOcean Apps dashboard for URL"
echo ""
echo "${YELLOW}Next Steps:${NC}"
echo "1. Get backend URL from DO Apps dashboard"
echo "2. Update Vercel environment variable:"
echo " NEXT_PUBLIC_API_URL=https://your-backend-url.com"
echo "3. Redeploy frontend on Vercel"
echo ""
echo "🎉 Happy deploying!"