-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·88 lines (71 loc) · 2.66 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·88 lines (71 loc) · 2.66 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
#!/bin/bash
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}Starting Autonomous Procurement Agent Setup${NC}"
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check prerequisites
if ! command_exists node; then
echo -e "${RED}Error: Node.js is not installed.${NC}"
exit 1
fi
if ! command_exists python3; then
echo -e "${RED}Error: Python 3 is not installed.${NC}"
exit 1
fi
# ============================================================================
# Python Virtual Environment Setup
# ============================================================================
echo -e "${GREEN}Setting up Python Virtual Environment...${NC}"
if [ ! -d ".venv" ]; then
python3 -m venv .venv
echo -e "${GREEN}Created .venv${NC}"
fi
# Activate venv
source .venv/bin/activate
# Upgrade pip
echo -e "${GREEN}Upgrading pip...${NC}"
pip install --upgrade pip
# Check and install Yarn if missing
if ! command_exists yarn; then
echo -e "${GREEN}Yarn not found. Installing yarn...${NC}"
npm install -g yarn
fi
# Install Python dependencies
echo -e "${GREEN}Installing Python dependencies...${NC}"
pip install -r requirements.txt
pip install -r mcp_server/mongodb/requirements.txt
pip install -r mcp_server/pdf-generation/requirements.txt
# Install Playwright browsers (required for PDF generation)
echo -e "${GREEN}Installing Playwright browsers...${NC}"
playwright install chromium
# ============================================================================
# Environment Variables Setup
# ============================================================================
echo -e "${GREEN}Checking Environment Variables...${NC}"
# Check for .env files and copy from .env.example if missing
if [ ! -f procurement/.env ]; then
echo -e "${GREEN}Creating procurement/.env from .env.example...${NC}"
cp procurement/.env.example procurement/.env
fi
if [ ! -f mcp_server/mongodb/.env ]; then
echo -e "${GREEN}Creating mcp_server/mongodb/.env from .env.example...${NC}"
cp mcp_server/mongodb/.env.example mcp_server/mongodb/.env
fi
if [ ! -f mcp_server/pdf-generation/.env ]; then
echo -e "${GREEN}Creating mcp_server/pdf-generation/.env from .env.example...${NC}"
cp mcp_server/pdf-generation/.env.example mcp_server/pdf-generation/.env
fi
# ============================================================================
# Frontend Setup
# ============================================================================
echo -e "${GREEN}Setting up Frontend...${NC}"
cd app
yarn install
cd ..
echo -e "${GREEN}Setup Complete!${NC}"
echo -e "You can now run the application using: ./run.sh"