feat: Add development scripts for environment check and service management

- check-env.sh: Validates Python 3.10+, Node.js, Docker, venv, .env, ports
- start-dev.sh: Starts MinIO, backend, frontend with health checks
- stop-dev.sh: Gracefully stops all services

Scripts are placed in project root for easy access.
Supports --help flag and colored output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-01 19:17:54 +08:00
parent c8966477b9
commit 77091eefb5
8 changed files with 1082 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
# Implementation Tasks
## 1. Project Structure
- [x] 1.1 Scripts placed in project root directory
## 2. Environment Check Script
- [x] 2.1 Create `check-env.sh` with executable permissions
- [x] 2.2 Implement Python version check (3.10+)
- [x] 2.3 Implement Node.js and npm check
- [x] 2.4 Implement Docker availability check
- [x] 2.5 Implement virtual environment check (venv/)
- [x] 2.6 Implement .env file check with template guidance
- [x] 2.7 Implement port availability check (8000, 3000, 9000, 9001)
- [x] 2.8 Add colored output and clear error messages
## 3. Start Development Script
- [x] 3.1 Create `start-dev.sh` with executable permissions
- [x] 3.2 Call check-env.sh before starting services
- [x] 3.3 Start MinIO via docker-compose (with health check wait)
- [x] 3.4 Activate venv and start backend (uvicorn in background)
- [x] 3.5 Wait for backend to be healthy (curl localhost:8000/health or similar)
- [x] 3.6 Install frontend dependencies if node_modules missing
- [x] 3.7 Start frontend dev server (npm run dev in background)
- [x] 3.8 Display service URLs when all services are running
- [x] 3.9 Handle Ctrl+C to trigger graceful shutdown
## 4. Stop Development Script
- [x] 4.1 Create `stop-dev.sh` with executable permissions
- [x] 4.2 Stop frontend dev server
- [x] 4.3 Stop backend uvicorn process
- [x] 4.4 Stop MinIO docker container
- [x] 4.5 Display confirmation messages
## 5. Documentation
- [x] 5.1 Add usage instructions to scripts (--help flag)
- [x] 5.2 Update .env.example with any new required variables if needed
## Summary
**Completed:** All 18 tasks across 5 sections
### Scripts Created (in project root)
```
./check-env.sh # Environment validation
./start-dev.sh # Start all services
./stop-dev.sh # Stop all services
```
### Service Ports
| Service | Port | Description |
|----------|------|-------------|
| Backend | 8000 | FastAPI server |
| Frontend | 3000 | Vite dev server |
| MinIO S3 | 9000 | Object storage API |
| MinIO UI | 9001 | Admin console |
### Usage
```bash
# Check environment prerequisites
./check-env.sh
# Start all services
./start-dev.sh
# Stop all services
./stop-dev.sh
# Start without MinIO (use external)
./start-dev.sh --no-minio
# Stop but keep MinIO running
./stop-dev.sh --keep-minio
```