docs: Add deployment and project documentation with unified env config
- Add DEPLOYMENT.md for 1Panel deployment guide with troubleshooting - Add README.md with project architecture and quick start guide - Update .gitignore to exclude development docs (openspec/, CLAUDE.md, etc.) - Unify port configuration via .env (BACKEND_PORT, FRONTEND_PORT, MINIO_API_PORT, MINIO_CONSOLE_PORT) - Update start-dev.sh and check-env.sh to read ports from .env 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
43
start-dev.sh
43
start-dev.sh
@@ -18,6 +18,21 @@ NC='\033[0m' # No Color
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$SCRIPT_DIR"
|
||||
|
||||
# Load environment variables from .env file
|
||||
if [[ -f "$PROJECT_ROOT/.env" ]]; then
|
||||
# Export only specific port variables to avoid overriding shell environment
|
||||
export BACKEND_PORT="${BACKEND_PORT:-$(grep -E '^BACKEND_PORT=' "$PROJECT_ROOT/.env" 2>/dev/null | cut -d'=' -f2 || echo '8000')}"
|
||||
export FRONTEND_PORT="${FRONTEND_PORT:-$(grep -E '^FRONTEND_PORT=' "$PROJECT_ROOT/.env" 2>/dev/null | cut -d'=' -f2 || echo '3000')}"
|
||||
export MINIO_API_PORT="${MINIO_API_PORT:-$(grep -E '^MINIO_API_PORT=' "$PROJECT_ROOT/.env" 2>/dev/null | cut -d'=' -f2 || echo '9000')}"
|
||||
export MINIO_CONSOLE_PORT="${MINIO_CONSOLE_PORT:-$(grep -E '^MINIO_CONSOLE_PORT=' "$PROJECT_ROOT/.env" 2>/dev/null | cut -d'=' -f2 || echo '9001')}"
|
||||
else
|
||||
# Default values if .env doesn't exist
|
||||
export BACKEND_PORT="${BACKEND_PORT:-8000}"
|
||||
export FRONTEND_PORT="${FRONTEND_PORT:-3000}"
|
||||
export MINIO_API_PORT="${MINIO_API_PORT:-9000}"
|
||||
export MINIO_CONSOLE_PORT="${MINIO_CONSOLE_PORT:-9001}"
|
||||
fi
|
||||
|
||||
# PID file locations
|
||||
PID_DIR="$PROJECT_ROOT/.pids"
|
||||
BACKEND_PID_FILE="$PID_DIR/backend.pid"
|
||||
@@ -62,9 +77,9 @@ show_help() {
|
||||
echo " --no-minio Don't start MinIO (use external)"
|
||||
echo ""
|
||||
echo "Services started:"
|
||||
echo " - MinIO (Object Storage) - http://localhost:9000 (API), http://localhost:9001 (Console)"
|
||||
echo " - Backend (FastAPI) - http://localhost:8000"
|
||||
echo " - Frontend (Vite) - http://localhost:3000"
|
||||
echo " - MinIO (Object Storage) - http://localhost:\$MINIO_API_PORT (API), http://localhost:\$MINIO_CONSOLE_PORT (Console)"
|
||||
echo " - Backend (FastAPI) - http://localhost:\$BACKEND_PORT"
|
||||
echo " - Frontend (Vite) - http://localhost:\$FRONTEND_PORT"
|
||||
}
|
||||
|
||||
# Cleanup function for graceful shutdown
|
||||
@@ -151,7 +166,7 @@ if [[ "$NO_MINIO" == "false" ]]; then
|
||||
print_info "Waiting for MinIO to be healthy..."
|
||||
MINIO_READY=false
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:9000/minio/health/live > /dev/null 2>&1; then
|
||||
if curl -s "http://localhost:$MINIO_API_PORT/minio/health/live" > /dev/null 2>&1; then
|
||||
MINIO_READY=true
|
||||
break
|
||||
fi
|
||||
@@ -168,7 +183,7 @@ if [[ "$NO_MINIO" == "false" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
print_info "MinIO Console: http://localhost:9001 (minioadmin/minioadmin)"
|
||||
print_info "MinIO Console: http://localhost:$MINIO_CONSOLE_PORT (minioadmin/minioadmin)"
|
||||
fi
|
||||
|
||||
# ============================================================================
|
||||
@@ -189,7 +204,7 @@ else
|
||||
(
|
||||
source "$PROJECT_ROOT/venv/bin/activate"
|
||||
cd "$PROJECT_ROOT"
|
||||
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 > "$BACKEND_LOG" 2>&1 &
|
||||
uvicorn app.main:app --reload --host 0.0.0.0 --port "$BACKEND_PORT" > "$BACKEND_LOG" 2>&1 &
|
||||
echo $! > "$BACKEND_PID_FILE"
|
||||
)
|
||||
|
||||
@@ -197,7 +212,7 @@ else
|
||||
print_info "Waiting for backend to be ready..."
|
||||
BACKEND_READY=false
|
||||
for i in {1..15}; do
|
||||
if curl -s http://localhost:8000/api/health > /dev/null 2>&1 || curl -s http://localhost:8000/docs > /dev/null 2>&1; then
|
||||
if curl -s "http://localhost:$BACKEND_PORT/api/health" > /dev/null 2>&1 || curl -s "http://localhost:$BACKEND_PORT/docs" > /dev/null 2>&1; then
|
||||
BACKEND_READY=true
|
||||
break
|
||||
fi
|
||||
@@ -213,8 +228,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
print_info "Backend API: http://localhost:8000"
|
||||
print_info "API Docs: http://localhost:8000/docs"
|
||||
print_info "Backend API: http://localhost:$BACKEND_PORT"
|
||||
print_info "API Docs: http://localhost:$BACKEND_PORT/docs"
|
||||
|
||||
# ============================================================================
|
||||
# Start Frontend
|
||||
@@ -248,7 +263,7 @@ if [[ "$NO_FRONTEND" == "false" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
print_info "Frontend: http://localhost:3000"
|
||||
print_info "Frontend: http://localhost:$FRONTEND_PORT"
|
||||
fi
|
||||
|
||||
# ============================================================================
|
||||
@@ -260,10 +275,10 @@ echo -e "${GREEN}============================================${NC}"
|
||||
echo -e "${GREEN} All services are running!${NC}"
|
||||
echo -e "${GREEN}============================================${NC}"
|
||||
echo ""
|
||||
echo -e " ${CYAN}Frontend:${NC} http://localhost:3000"
|
||||
echo -e " ${CYAN}Backend API:${NC} http://localhost:8000"
|
||||
echo -e " ${CYAN}API Docs:${NC} http://localhost:8000/docs"
|
||||
echo -e " ${CYAN}MinIO Console:${NC} http://localhost:9001"
|
||||
echo -e " ${CYAN}Frontend:${NC} http://localhost:$FRONTEND_PORT"
|
||||
echo -e " ${CYAN}Backend API:${NC} http://localhost:$BACKEND_PORT"
|
||||
echo -e " ${CYAN}API Docs:${NC} http://localhost:$BACKEND_PORT/docs"
|
||||
echo -e " ${CYAN}MinIO Console:${NC} http://localhost:$MINIO_CONSOLE_PORT"
|
||||
echo ""
|
||||
echo -e " ${YELLOW}Logs:${NC}"
|
||||
echo -e " Backend: $BACKEND_LOG"
|
||||
|
||||
Reference in New Issue
Block a user