-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·42 lines (33 loc) · 1.06 KB
/
startup.sh
File metadata and controls
executable file
·42 lines (33 loc) · 1.06 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
#!/bin/bash
# GCP VM Startup Script for DocChat Backend
# This script sets up the environment and runs the FastAPI application
set -e # Exit on error
echo "=== DocChat Backend Setup ==="
# Update system packages
echo "Updating system packages..."
sudo apt-get update
sudo apt-get install -y python3-pip python3-venv git
# Navigate to app directory
APP_DIR="/home/$USER/DocChat"
cd $APP_DIR
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Install dependencies
echo "Installing Python dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
# Install Google Cloud SDK if not present
if ! command -v gcloud &> /dev/null; then
echo "Installing Google Cloud SDK..."
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
fi
echo "=== Setup Complete ==="
echo "To start the server manually, run:"
echo " source venv/bin/activate"
echo " uvicorn fastApi.api:app --host 0.0.0.0 --port 8000"