Files
GitMa/start.sh
panw 44921c5646 feat: complete Git Repo Manager MVP implementation
Backend (Phase 1-6):
- Pydantic schemas for request/response validation
- Service layer (SSH Key, Server, Repo, Sync)
- API routes with authentication
- FastAPI main application with lifespan management
- ORM models (SshKey, Server, Repo, SyncLog)

Frontend (Phase 7):
- Vue 3 + Element Plus + Pinia + Vue Router
- API client with Axios and interceptors
- State management stores
- All page components (Dashboard, Servers, Repos, SyncLogs, SshKeys, Settings)

Deployment (Phase 8):
- README with quick start guide
- Startup script (start.sh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 16:30:13 +08:00

74 lines
1.9 KiB
Bash

#!/bin/bash
#
# Git Manager Startup Script
#
# This script checks the environment, initializes the database if needed,
# and starts the uvicorn server.
#
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$SCRIPT_DIR/backend"
ENV_FILE="$SCRIPT_DIR/.env"
echo "=================================="
echo " Git Manager Startup Script"
echo "=================================="
echo
# Check if .env file exists
if [ ! -f "$ENV_FILE" ]; then
echo -e "${RED}Error: .env file not found${NC}"
echo
echo "Please create a .env file from the example:"
echo " cp .env.example .env"
echo
echo "Then edit .env and set:"
echo " - GM_ENCRYPT_KEY (generate with: python -c \"import base64, os; print(base64.b64encode(os.urandom(32)).decode())\")"
echo " - GM_API_TOKEN (generate with: python -c \"import secrets; print(secrets.token_urlsafe(32))\")"
exit 1
fi
echo -e "${GREEN}${NC} Environment configuration found"
# Check if database exists
DB_PATH="$SCRIPT_DIR/data/git_manager.db"
if [ ! -f "$DB_PATH" ]; then
echo
echo -e "${YELLOW}Database not found. Initializing...${NC}"
cd "$BACKEND_DIR"
python init_db.py
echo -e "${GREEN}${NC} Database initialized"
else
echo -e "${GREEN}${NC} Database exists"
fi
# Load environment variables
export $(grep -v '^#' "$ENV_FILE" | xargs)
# Use defaults if not set in .env
HOST=${GM_HOST:-0.0.0.0}
PORT=${GM_PORT:-8000}
echo
echo "=================================="
echo " Starting Git Manager"
echo "=================================="
echo "Host: $HOST"
echo "Port: $PORT"
echo "Web UI: http://localhost:$PORT"
echo "API Docs: http://localhost:$PORT/api/docs"
echo
# Start the server
cd "$BACKEND_DIR"
python -m uvicorn app.main:app --host "$HOST" --port "$PORT" --reload