docs: rewrite README with correct structure, Docker deploy, v1.2.0
- Add frontend/ directory (was missing from structure) - Fix frontend path from core/frontend to ./frontend - Fix .env copy path from core/backend/.env to root .env - Add Docker deployment as primary method - Add version info referencing VERSIONS.json - Update subtree pull command with correct Gitea URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
125
README.md
125
README.md
@@ -1,30 +1,111 @@
|
|||||||
# 天普大兴园区 智慧能源管理平台 (tp-ems)
|
# Tianpu Daxing Park EMS (tp-ems)
|
||||||
|
|
||||||
## 项目说明
|
> Tianpu Daxing Zero-Carbon Park Smart Energy Management System
|
||||||
天普大兴园区EMS客户定制项目,基于 ems-core 标准产品。
|
|
||||||
|
|
||||||
## 目录结构
|
**Current Version: 1.2.0** | Core: 1.1.0 | See `VERSIONS.json`
|
||||||
- `core/` — EMS核心代码(通过git subtree引入,勿直接修改)
|
|
||||||
- `customers/tianpu/` — 天普专属配置(设备、计费、品牌)
|
|
||||||
- `scripts/` — 天普数据初始化脚本
|
|
||||||
- `.env.example` — 环境变量模板
|
|
||||||
|
|
||||||
## 快速开始
|
Customer project for Tianpu Daxing Zero-Carbon Park, built on [ems-core](http://100.69.143.96:3300/tianpu/ems-core).
|
||||||
1. 复制环境配置:`cp .env.example core/backend/.env`
|
|
||||||
2. 安装后端依赖:`cd core/backend && pip install -r requirements.txt`
|
|
||||||
3. 初始化数据库:`cd core/backend && python -m alembic upgrade head`
|
|
||||||
4. 导入种子数据:`cd scripts && python seed_data.py`(需先cd回项目根目录的scripts)
|
|
||||||
|
|
||||||
或者:`cd 项目根目录 && python scripts/seed_data.py`
|
---
|
||||||
5. 启动后端:`cd core/backend && python -m uvicorn app.main:app --port 8000 --reload`
|
|
||||||
6. 启动前端:`cd core/frontend && npm install && npm run dev`
|
## Directory Structure
|
||||||
7. 访问:http://localhost:3000(admin / admin123)
|
|
||||||
|
|
||||||
## 更新核心代码
|
|
||||||
当 ems-core 发布新版本时:
|
|
||||||
```
|
```
|
||||||
git subtree pull --prefix=core http://192.168.1.77:3300/tianpu/ems-core.git v1.1.0 --squash
|
tp-ems/
|
||||||
|
+-- core/ # EMS core (git subtree, DO NOT modify directly)
|
||||||
|
+-- frontend/ # Customer frontend (React/TypeScript)
|
||||||
|
| +-- src/ # React source code
|
||||||
|
| +-- Dockerfile # Frontend container
|
||||||
|
| +-- package.json
|
||||||
|
| +-- vite.config.ts
|
||||||
|
+-- customers/tianpu/ # Customer configuration
|
||||||
|
| +-- config.yaml # Branding and feature flags
|
||||||
|
| +-- devices.json # Device inventory
|
||||||
|
| +-- pricing.json # Electricity pricing
|
||||||
|
| +-- hooks/ # Customer hooks plugin
|
||||||
|
+-- backend/ # Backend customer overrides
|
||||||
|
+-- scripts/ # Data seeding scripts
|
||||||
|
| +-- seed_data.py # Tianpu seed data
|
||||||
|
+-- docker-compose.override.yml # Customer Docker overrides
|
||||||
|
+-- docker-compose.ports.yml # Port configuration
|
||||||
|
+-- VERSIONS.json # Version tracking
|
||||||
|
+-- .env.example # Environment variables template
|
||||||
```
|
```
|
||||||
|
|
||||||
## 当前核心版本
|
---
|
||||||
查看 `core/VERSION` 文件。
|
|
||||||
|
## Quick Start (Docker)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure environment
|
||||||
|
cp .env.example .env
|
||||||
|
# Edit .env with your settings
|
||||||
|
|
||||||
|
# Start all services
|
||||||
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml up -d
|
||||||
|
|
||||||
|
# Seed data
|
||||||
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml exec backend python scripts/seed_data.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### Access
|
||||||
|
|
||||||
|
| Service | URL |
|
||||||
|
|---------|-----|
|
||||||
|
| Frontend | http://localhost:3000 |
|
||||||
|
| Backend API | http://localhost:8000 |
|
||||||
|
| API Docs | http://localhost:8000/docs |
|
||||||
|
|
||||||
|
### Default Login
|
||||||
|
|
||||||
|
| Role | Username | Password |
|
||||||
|
|------|----------|----------|
|
||||||
|
| Admin | admin | admin123 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Local Development
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd core/backend
|
||||||
|
python -m venv venv
|
||||||
|
source venv/bin/activate # Windows: venv\Scripts\activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
python -m alembic upgrade head
|
||||||
|
uvicorn app.main:app --port 8000 --reload
|
||||||
|
```
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd frontend
|
||||||
|
npm install
|
||||||
|
npm run dev
|
||||||
|
# Opens at http://localhost:3000, proxies /api to localhost:8000
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Updating Core
|
||||||
|
|
||||||
|
When ems-core releases a new version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git subtree pull --prefix=core ems-core main --squash
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure the `ems-core` remote is configured:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git remote add ems-core http://100.69.143.96:3300/tianpu/ems-core.git
|
||||||
|
```
|
||||||
|
|
||||||
|
After pulling, update `core_version` in `VERSIONS.json`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright 2026. All rights reserved.
|
||||||
|
|||||||
Reference in New Issue
Block a user