Added documentation and start stop scripts.
This commit is contained in:
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define paths
|
||||
PROJECT_ROOT=$(pwd)
|
||||
PID_FILE="$PROJECT_ROOT/.server_manager.pids"
|
||||
|
||||
# Function to start backend
|
||||
start_backend() {
|
||||
echo "Starting Backend..."
|
||||
cd "$PROJECT_ROOT/backend"
|
||||
|
||||
# Check if a venv exists
|
||||
if [ -d "venv" ]; then
|
||||
source venv/bin/activate
|
||||
elif [ -d ".venv" ]; then
|
||||
source .venv/bin/activate
|
||||
fi
|
||||
|
||||
# Run uvicorn in background
|
||||
# Redirecting output to logs or /dev/null is often cleaner, but for now we keep it visible or rely on user
|
||||
uvicorn app.main:app --reload --port 8000 > ../logs/backend.log 2>&1 &
|
||||
BACKEND_PID=$!
|
||||
echo $BACKEND_PID >> "$PID_FILE"
|
||||
echo "Backend started (PID: $BACKEND_PID). Logs: logs/backend.log"
|
||||
}
|
||||
|
||||
# Function to start frontend
|
||||
start_frontend() {
|
||||
echo "Starting Frontend..."
|
||||
cd "$PROJECT_ROOT/frontend"
|
||||
npm run dev -- --port 5173 > ../logs/frontend.log 2>&1 &
|
||||
FRONTEND_PID=$!
|
||||
echo $FRONTEND_PID >> "$PID_FILE"
|
||||
echo "Frontend started (PID: $FRONTEND_PID). Logs: logs/frontend.log"
|
||||
}
|
||||
|
||||
# Ensure log directory exists
|
||||
mkdir -p "$PROJECT_ROOT/logs"
|
||||
|
||||
# Clear old pid file if it exists
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
echo "Warning: .server_manager.pids exists. Clearing..."
|
||||
rm "$PID_FILE"
|
||||
fi
|
||||
|
||||
start_backend
|
||||
start_frontend
|
||||
|
||||
echo "Application started."
|
||||
echo "Backend: http://localhost:8000"
|
||||
echo "Frontend: http://localhost:5173"
|
||||
Reference in New Issue
Block a user