-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·114 lines (93 loc) · 3.78 KB
/
quickstart.sh
File metadata and controls
executable file
·114 lines (93 loc) · 3.78 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
#!/bin/bash
# IIIT Social - Quick Start Script
# Automated setup of backend infrastructure
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
echo -e "${BLUE} IIIT Social - Backend Quick Start${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════${NC}\n"
# Check prerequisites
echo -e "${YELLOW}Checking prerequisites...${NC}"
# Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}✗ Node.js not installed${NC}"
echo " Install from: https://nodejs.org (18+)"
exit 1
fi
echo -e "${GREEN}✓ Node.js $(node --version)${NC}"
# Supabase CLI
if ! command -v supabase &> /dev/null; then
echo -e "${RED}✗ Supabase CLI not installed${NC}"
echo " Install with: npm install -g supabase"
exit 1
fi
echo -e "${GREEN}✓ Supabase CLI $(supabase --version)${NC}\n"
# Install backend dependencies
echo -e "${YELLOW}Installing backend dependencies...${NC}"
cd Backend
npm install 2>&1 | tail -5
echo -e "${GREEN}✓ Dependencies installed${NC}\n"
# Start Supabase
echo -e "${YELLOW}Starting local Supabase...${NC}"
echo -e "${BLUE}This may take 2-3 minutes...${NC}\n"
cd ../supabase
# Check if already running
if pgrep -f "supabase" > /dev/null; then
echo -e "${GREEN}✓ Supabase already running${NC}"
else
echo "Starting Supabase..."
supabase start
fi
echo -e "\n${GREEN}✓ Supabase started${NC}\n"
# Get credentials
echo -e "${YELLOW}Retrieving credentials...${NC}"
CREDS=$(supabase status)
echo "$CREDS"
# Create .env.local
echo -e "\n${YELLOW}Creating .env.local file...${NC}"
cat > ../Backend/.env.local << 'EOF'
SUPABASE_URL=http://localhost:54321
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
EOF
echo -e "${GREEN}✓ .env.local created (update with actual keys from above)${NC}\n"
# Run migrations
echo -e "${YELLOW}Applying database migrations...${NC}"
supabase db push
echo -e "${GREEN}✓ Migrations applied${NC}\n"
# Deploy Edge Functions
echo -e "${YELLOW}Deploying Edge Functions...${NC}"
supabase functions deploy generate-embedding
supabase functions deploy find-teammates
supabase functions deploy global-search
echo -e "${GREEN}✓ Edge Functions deployed${NC}\n"
# Back to backend for tests
cd ../Backend
# Run tests
echo -e "${YELLOW}Running API tests...${NC}"
echo -e "${BLUE}This will take 30-60 seconds...${NC}\n"
npm test
echo -e "\n${GREEN}═══════════════════════════════════════════════${NC}"
echo -e "${GREEN}✅ Backend Setup Complete!${NC}"
echo -e "${GREEN}═══════════════════════════════════════════════${NC}\n"
echo -e "${BLUE}Next steps:${NC}"
echo -e "1. Update Backend/.env.local with Supabase credentials"
echo -e "2. Frontend setup:"
echo -e " cd Frontend"
echo -e " npm install"
echo -e " npm run dev"
echo -e "\n${BLUE}Useful commands:${NC}"
echo -e " npm run health-check - Check service status"
echo -e " npm test - Run test suite"
echo -e " supabase logs - View database logs"
echo -e " supabase stop - Stop Supabase"
echo -e "\n${BLUE}Documentation:${NC}"
echo -e " README.md - Project overview"
echo -e " SETUP_AND_VERIFICATION.md - Complete setup guide"
echo -e " Backend/Readme.md - Backend documentation"
echo -e " Documents/api-documentation.md - API reference\n"