mirror of
https://github.com/srbhr/Resume-Matcher.git
synced 2026-01-14 03:40:02 +00:00
- Added config.json to .dockerignore and .gitignore to prevent committing sensitive API keys. - Modified start.sh to remove unnecessary dependencies during Playwright installation.
147 lines
5.1 KiB
Bash
147 lines
5.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
BOLD='\033[1m'
|
|
|
|
# Print banner
|
|
print_banner() {
|
|
echo -e "${CYAN}"
|
|
cat << 'EOF'
|
|
|
|
██████╗ ███████╗███████╗██╗ ██╗███╗ ███╗███████╗
|
|
██╔══██╗██╔════╝██╔════╝██║ ██║████╗ ████║██╔════╝
|
|
██████╔╝█████╗ ███████╗██║ ██║██╔████╔██║█████╗
|
|
██╔══██╗██╔══╝ ╚════██║██║ ██║██║╚██╔╝██║██╔══╝
|
|
██║ ██║███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗
|
|
╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
|
|
|
███╗ ███╗ █████╗ ████████╗ ██████╗██╗ ██╗███████╗██████╗
|
|
████╗ ████║██╔══██╗╚══██╔══╝██╔════╝██║ ██║██╔════╝██╔══██╗
|
|
██╔████╔██║███████║ ██║ ██║ ███████║█████╗ ██████╔╝
|
|
██║╚██╔╝██║██╔══██║ ██║ ██║ ██╔══██║██╔══╝ ██╔══██╗
|
|
██║ ╚═╝ ██║██║ ██║ ██║ ╚██████╗██║ ██║███████╗██║ ██║
|
|
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
|
|
|
EOF
|
|
echo -e "${NC}"
|
|
echo -e "${BOLD} Crazy Stuff with Resumes and Cover letters${NC}"
|
|
echo ""
|
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
echo ""
|
|
}
|
|
|
|
# Print status message
|
|
status() {
|
|
echo -e "${GREEN}[✓]${NC} $1"
|
|
}
|
|
|
|
# Print info message
|
|
info() {
|
|
echo -e "${BLUE}[i]${NC} $1"
|
|
}
|
|
|
|
# Print warning message
|
|
warn() {
|
|
echo -e "${YELLOW}[!]${NC} $1"
|
|
}
|
|
|
|
# Print error message
|
|
error() {
|
|
echo -e "${RED}[✗]${NC} $1"
|
|
}
|
|
|
|
# Cleanup function for graceful shutdown
|
|
cleanup() {
|
|
echo ""
|
|
info "Shutting down Resume Matcher..."
|
|
|
|
# Kill backend if running
|
|
if [ -n "$BACKEND_PID" ] && kill -0 "$BACKEND_PID" 2>/dev/null; then
|
|
kill "$BACKEND_PID" 2>/dev/null || true
|
|
wait "$BACKEND_PID" 2>/dev/null || true
|
|
fi
|
|
|
|
status "Shutdown complete"
|
|
exit 0
|
|
}
|
|
|
|
# Set up signal handlers
|
|
trap cleanup SIGTERM SIGINT SIGQUIT
|
|
|
|
# Print banner
|
|
print_banner
|
|
|
|
# Check and create data directory
|
|
info "Checking data directory..."
|
|
DATA_DIR="/app/backend/data"
|
|
if [ ! -d "$DATA_DIR" ]; then
|
|
mkdir -p "$DATA_DIR"
|
|
status "Created data directory: $DATA_DIR"
|
|
else
|
|
status "Data directory exists: $DATA_DIR"
|
|
fi
|
|
|
|
# Check for Playwright browsers
|
|
info "Checking Playwright browsers..."
|
|
if [ -d "/root/.cache/ms-playwright" ] || [ -d "/home/appuser/.cache/ms-playwright" ]; then
|
|
status "Playwright browsers found"
|
|
else
|
|
warn "Installing Playwright Chromium (this may take a moment)..."
|
|
cd /app/backend && python -m playwright install chromium 2>/dev/null || {
|
|
warn "Playwright installation had warnings (this is usually OK)"
|
|
}
|
|
status "Playwright setup complete"
|
|
fi
|
|
|
|
# Start backend
|
|
echo ""
|
|
info "Starting backend server..."
|
|
cd /app/backend
|
|
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 &
|
|
BACKEND_PID=$!
|
|
|
|
# Wait for backend to be ready
|
|
info "Waiting for backend to be ready..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:8000/api/v1/health > /dev/null 2>&1; then
|
|
status "Backend is ready (PID: $BACKEND_PID)"
|
|
break
|
|
fi
|
|
if [ $i -eq 30 ]; then
|
|
error "Backend failed to start within 30 seconds"
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# Start frontend
|
|
echo ""
|
|
info "Starting frontend server..."
|
|
cd /app/frontend
|
|
npm start &
|
|
FRONTEND_PID=$!
|
|
|
|
echo ""
|
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
echo ""
|
|
status "Resume Matcher is running!"
|
|
echo ""
|
|
echo -e " ${BOLD}Frontend:${NC} http://localhost:3000"
|
|
echo -e " ${BOLD}Backend:${NC} http://localhost:8000"
|
|
echo -e " ${BOLD}API Docs:${NC} http://localhost:8000/docs"
|
|
echo ""
|
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
echo ""
|
|
info "Press Ctrl+C to stop"
|
|
echo ""
|
|
|
|
# Wait for processes
|
|
wait $FRONTEND_PID
|